PoC Watch
NGINX HTTP/2 integer underflow leading to remote code execution
PoC demonstratedCritical 9.2
Rapid7 and F5 disclosed a flaw in nginx HTTP/2 flow-control handling that corrupts memory and can let an unauthenticated remote client execute code in the worker process under certain conditions. Rapid7 reports building a working proof of concept against a vulnerable nginx 1.31.8 container. A fix is available.
Mitigation by layer
Patch
- Upgrade nginx to the fixed version listed in the F5 advisory, including nginx bundled inside container images, ingress controllers and appliances.
Step by step
- Check the running version on each host.
nginx -vExpected output
nginx version: nginx/<version> Compare <version> with the fixed versions in the advisory.
- Check whether HTTP/2 is enabled anywhere in the loaded configuration. No output means HTTP/2 is not enabled on this instance.
sudo nginx -T 2>/dev/null | grep -nE 'http2' - Find nginx inside running containers on a Docker host.
docker ps --format '{{.Names}}' | while read c; do printf '%s: ' "$c"; docker exec "$c" nginx -v 2>&1 || echo 'no nginx'; done - Install the fixed package from your normal package source, then validate the configuration and restart so the new binary is the one running.
sudo nginx -t && sudo systemctl restart nginx && nginx -v
- Check the running version on each host.
- Rebuild and redeploy images. Updating the host package does not update running containers.
Reduce exposure
- If you cannot patch immediately, consider disabling HTTP/2 on internet-facing listeners and check the vendor advisory for supported workarounds.
Step by step
- Edit each affected server block. Use the form that matches your nginx version.
# nginx 1.25.1 and later: inside the server block http2 off; # older syntax: remove the http2 parameter from listen lines # before: listen 443 ssl http2; # after: listen 443 ssl; - Validate and reload.
sudo nginx -t && sudo systemctl reload nginx - Verify from a client that the server no longer negotiates HTTP/2.
curl -s -o /dev/null --http2 -w '%{http_version}\n' https://<your-host>/Expected output
1.1
- Edit each affected server block. Use the form that matches your nginx version.
- Inventory every nginx instance, including ones embedded in other products, so none is missed.
Harden access
- Run worker processes as an unprivileged user with a read-only filesystem and no access to secrets they do not need.
- Apply seccomp or AppArmor profiles and drop container capabilities so code execution in a worker has limited reach.
Detect
- Alert on repeated nginx worker crashes or restarts, which are a common side effect of memory corruption attempts.
Step by step
- Search the error log for workers killed by a signal. Adjust the path if your logs live elsewhere.
sudo grep -E 'worker process [0-9]+ exited on signal' /var/log/nginx/error.log | tail -n 20Expected output
No output is the normal case. Repeated lines, especially signal 11, warrant investigation.
- Turn the same pattern into an alert in your log pipeline so it does not depend on someone running the search.
- Search the error log for workers killed by a signal. Adjust the path if your logs live elsewhere.
- Watch for nginx processes spawning shells or making unexpected outbound connections.
Contain and recover
- Segment web tiers from internal networks so a compromised proxy cannot reach databases or management planes directly.
- Rotate TLS private keys and upstream credentials on any host where exploitation is suspected.