CVE-2026-140103: http-proxy-middleware smuggles a second request when fixRequestBody runs before body arrival
Affects http-proxy-middlewareSource GCVE Database
Not known to be exploited · CVSS 5.4 Medium : upgrade to 4.2.1 when convenient.
Data as of 1 Dec 2026, 19:00 UTC
Thin evidence
One scorer or none| CNA (GitHub_M) | CVSS 3.1 | 5.4 |
|---|
- Patch
- Available – fixed in 4.2.1, 3.0.10, 2.0.11
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:NExploitation evidence
Disclosed: evidence found.
CVE published 30 Nov 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 1 Dec 2026.
What to do
Upgrade http-proxy-middleware to 4.2.1; http-proxy-middleware to 3.0.10; http-proxy-middleware to 2.0.11.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npmhttp-proxy-middleware | Affected
| Fixed in
|
| npmhttp-proxy-middleware | Affected
| Fixed in
|
| npmhttp-proxy-middleware | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
Description
### Summary `fixRequestBody` treats `req.readableLength === 0` as proof that a body parser consumed the request body. The same value is observed before any body byte has arrived. An unauthenticated client can therefore send the request headers first, wait one event-loop turn, and then send a body containing a complete second HTTP request. When a body-parser 1.x parser declined the declared media type, it has already assigned a truthy `req.body` but has not consumed the stream. `fixRequestBody` serializes that empty body, changes the upstream `Content-Length`, and writes it. `httpxy` subsequently pipes the still-live request stream into the same upstream request. The backend consumes the synthesized body at the declared length and parses the attacker's withheld bytes as a second request on the persistent connection. That second request bypasses the gateway's route filter, explicit `/admin` denial, and trusted-header normalization. On the default 4.2.0 upstream pool, a following request can also receive the smuggled request's response. The PoC below uses no attacker credential: a public `/api/thing` request produces a backend `/admin/secret` request carrying the attacker-selected internal identity header, and an attacker-controlled follow-up receives `SECRET_ADMIN_ONLY`. ### Details The vulnerable guard is in [`src/handlers/fix-request-body.ts:30-39`](https://github.com/chimurai/http-proxy-middleware/blob/1c8255248e619ec01fd20e6eb1f660f7a1e38221/src/handlers/fix-request-body.ts#L30-L39): ```ts // skip fixRequestBody() when req.readableLength not 0 (bodyParser failure) if (req.readableLength !== 0) { return; } const requestBody = req.body; if (!requestBody) { return; } ``` `readableLength` reports bytes currently buffered in the readable queue. It is zero both after a parser drains the stream and before the client sends the body. The client controls which state applies by controlling body arrival. With body-parser 1.20.3, [`json()` assigns `req.body = req.body || {}` before its media-type test](https://github.com/expressjs/body-parser/blob/1.20.3/lib/types/json.js#L101-L123). A request declared as `application/x-www-form-urlencoded` therefore reaches the proxy with a truthy empty object even when only `express.json()` is mounted. [Body-parser 2.2.0 initializes a previously absent body to `undefined`](https://github.com/expressjs/body-parser/blob/2.2.0/lib/types/json.js#L86-L95), so the second guard returns; the relevant prerequisite is the body-parser major, not the Express major. The handler then assumes ownership of the upstream framing at [`src/handlers/fix-request-body.ts:47-81`](https://github.com/chimurai/http-proxy-middleware/blob/1c8255248e619ec01fd20e6eb1f660f7a1e38221/src/handlers/fix-request-body.ts#L47-L81): ```ts const writeBody = (bodyData: string) => { let proxyData: string | Buffer = bodyData; // compression branches omitted proxyReq.setHeader('Content-Length', Buffer.byteLength(proxyData)); proxyReq.write(proxyData); }; if (contentType.includes('application/json') || contentType.includes('+json')) { writeBody(JSON.stringify(requestBody)); } else if (contentType.includes('application/x-www-form-urlencoded')) { writeBody(querystring.stringify(requestBody)); } else if (contentType.includes('multipart/form-data')) { writeBody(stringifyFormData(contentType, requestBody)); } else if (contentType.includes('text/plain')) { writeBody(requestBody); } ``` In the PoC, `requestBody` is `{}`, so the URL-encoded form is an empty string and the outgoing length becomes zero. In the published `httpxy` 0.5.5 artifact, `dist/index.mjs:288-290` emits `proxyReq` from one `socket` listener and `dist/index.mjs:325-327` registers the original request pipe in a later `socket` listener. The event handler writes the synthetic zero-length body first; the pipe writes the real body afterward. The backend therefore receives this shape from one client request: ```http POST /api/thing HTTP/1.1 content-type: application/x-www-form-urlencoded content-length: 0 connection: keep-alive x-authenticated-user: anonymous GET /admin/secret HTTP/1.1 Host: backend X-Authenticated-User: admin Content-Length: 0 ``` The smuggled request never traverses the gateway. A backend that trusts identity headers written by the gateway sees the attacker-selected `admin` value, while an ordinary client request has that header deleted and replaced by the gateway. The necessary conditions are: - A body-parser 1.x parser runs before the proxy and declines the request media type, leaving a truthy `req.body` and an unread stream. - `fixRequestBody` is registered as `on.proxyReq`. - The body arrives after the headers in a later event-loop turn. - The upstream connection remains persistent. This is the 4.x default from 4.0.0-beta.2. On 2.x, 3.x, and 4.0.0-beta.0, a pooling agent supplies persistence when the client omits `Connection`; a plain non-pooling `new http.Agent()` requires the client to send `Connection: keep-a
References
- github.com/chimurai/http-proxy-middleware/security/advisories/GHSA-vp89-2qrg-8fwc (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-140103 (opens in a new tab)
- github.com/chimurai/http-proxy-middleware/pull/1309 (opens in a new tab)
- github.com/chimurai/http-proxy-middleware/pull/1310 (opens in a new tab)
- github.com/chimurai/http-proxy-middleware/pull/1311 (opens in a new tab)
- github.com/chimurai/http-proxy-middleware/commit/32b56d3f22f0c77eed6828abef84104dacf202f4 (opens in a new tab)
- github.com/chimurai/http-proxy-middleware/commit/412856f29168a815aeb2ede15266d7097b9060cc (opens in a new tab)
- github.com/chimurai/http-proxy-middleware/commit/77febf656f730ca28cd2188ba372aa4fa98f9404 (opens in a new tab)
- github.com/chimurai/http-proxy-middleware (opens in a new tab)
- github.com/chimurai/http-proxy-middleware/releases/tag/v2.0.11 (opens in a new tab)
- github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.8 (opens in a new tab)
- github.com/chimurai/http-proxy-middleware/releases/tag/v4.2.1 (opens in a new tab)