
Automated one-click shell script to detect and patch NGINX CVE-2026-42945 across major Linux distributions, with config backup, version validation, and automatic rollback on failure.
Automatically detect OS distribution, upgrade NGINX to the fixed version (≥1.30.1), backup configuration, and auto-rollback.
Vulnerability ID: CVE-2026-42945 Vulnerability Name: NGINX Rift
When NGINX processes specific rewrite redirect rules, the calculated request content length does not match the actual written length. Attackers can craft malicious requests to trigger memory corruption, causing worker processes to crash, and potentially leading to remote code execution.
Affected Versions: All versions below NGINX 1.30.1 / 1.31.0 Fixed Versions: NGINX 1.30.1 / 1.31.0 and above
/etc/nginx to a timestamped directory before upgrade| Distribution | Version |
|---|---|
| Ubuntu | 18.04 and above |
| Debian | 10 and above |
| CentOS | 7 and above |
| RHEL | 7 and above |
| Fedora | 33 and above |
curl -fsSL https://raw.githubusercontent.com/fkj-src/fix_nginx_cve_2026_42945/refs/heads/main/fix_nginx_cve_2026_42945.sh -o /usr/local/bin/fix_nginx_cve.sh && chmod +x /usr/local/bin/fix_nginx_cve.sh && fix_nginx_cve.sh
grep -rn "rewrite" /etc/nginx/conf.d/ /etc/nginx/sites-enabled/ 2>/dev/null
If found, you can ask AI to rewrite the rewrite statements into equivalent alternatives, such as return
cat /proc/sys/kernel/randomize_va_space
Return 2 indicates it is enabled.