nginx CVE-2026-15176 (1.30.6): alias Check, Ubuntu 24.04
Check nginx CVE-2026-15176 (fixed in 1.30.6/1.31.7) alias and rewrite conditions with nginx -T. Ubuntu 24.04 is fixed in 1.24.0-2ubuntu7.19 (USN-8955-1).
nginx 1.30.6 (stable) and 1.31.7 (mainline), released on 2026-10-14, fix a buffer overflow when alias is used with rewrite (CVE-2026-15176). Ubuntu 24.04 fixed it on 2026-10-26 in USN-8955-1 with **1.24.0-2ubuntu7.19**, so if you run the Ubuntu package, upgrade to that first. Whether your config meets the conditions is something you can read off the config files. This post covers the check only; no attack request is built or sent.
[1] Start with the vendor's conditions. This is the first paragraph of the CVE record's description.
The nginx.org security advisories list rates it medium, gives "Not vulnerable" as 1.31.7+ and 1.30.6+, and "Vulnerable" as 0.1.29-1.31.6. Links are at the end.
[2] Check the version you run. With upstream builds nginx -v is enough, but an Ubuntu package needs the package version too.
$ nginx -v$ dpkg -l nginx | tail -n 1nginx version: nginx/1.24.0 (Ubuntu)ii nginx 1.24.0-2ubuntu7.18 amd64 small, powerful, scalable web/proxy servernginx -v prints only 1.24.0; the -2ubuntu7.18 part shows up in dpkg alone. The advisory's version numbers are upstream numbers, so comparing them cannot tell you whether Ubuntu has carried the fix into its package. The 7.18 above is still unfixed; 7.19 or later is the fixed build. Step [4] shows the evidence.
[3] Grep the config for the conditions. nginx -T prints the full configuration with every include expanded and a # configuration file line before each file, so you can see which file each match is in.
$ nginx -T 2>/dev/null | grep -nE "^# configuration file|alias|request_filename|rewrite|log_format"For a config that has alias, rewrite and $request_filename together, the result looks like this (a test config placed in conf.d; … marks unrelated lines left out):
…189:# configuration file /etc/nginx/conf.d/app.conf:193: alias /srv/static/;196: alias /srv/img/$1;197: rewrite ^/img/old/(.*)$ /img/new/$1 break;198: set $target $request_filename;202:# configuration file /etc/nginx/conf.d/logfmt.conf:203:log_format files '$remote_addr $request_filename $status';…How to read it: line 193 is a location with alias only. Lines 196-198 are one location that has alias, rewrite and a set that takes $request_filename. Line 203 is a log format containing $request_filename, which matches the second sentence of the advisory. This grep only narrows the candidates. A hit does not prove you are affected (the advisory also says "conditions beyond their control"), and no hit is not a guarantee of safety.
[4] **Ubuntu package status: 24.04 is fixed in 1.24.0-2ubuntu7.19.** USN-8955-1, published by Ubuntu on 2026-10-26, lists 1.24.0-2ubuntu7.19 as the fixed version for 24.04 LTS (the same for nginx, nginx-core, nginx-extras, nginx-full and nginx-light), and Ubuntu's CVE-2026-15176 page now shows 24.04 noble as "Fixed in 1.24.0-2ubuntu7.19". The same USN lists 26.04 LTS 1.28.3-2ubuntu1.12 and 22.04 LTS 1.18.0-6ubuntu14.22.
Checking again in an ubuntu:24.04 container, the candidate had moved to 7.19:
$ apt-cache policy nginxnginx:… Candidate: 1.24.0-2ubuntu7.19 Version table: 1.24.0-2ubuntu7.19 500… 500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages 1.24.0-2ubuntu7 500…The top changelog entry of the installed 7.19 carries the patch for this CVE:
$ zcat /usr/share/doc/nginx/changelog.Debian.gz | head -n 6nginx (1.24.0-2ubuntu7.19) noble-security; urgency=medium * SECURITY UPDATE: heap overflow in certain configurations - debian/patches/CVE-2026-15176.patch: Avoid post-rewrite URI to path mapping with alias in src/http/ngx_http_core_module.c. - CVE-2026-15176For the upgrade steps, and how to confirm the running nginx is the new binary afterwards (reload does not replace it), see Ubuntu 24.04 nginx USN-8955-1: verify the fix.
[5] There are three ways to fix it.
- Upgrade the Ubuntu package (first, if you run Ubuntu's nginx):
sudo apt update && sudo apt install --only-upgrade nginx nginx-commonto get7.19or later, then restart as described in the post linked above. - Move to an upstream build: nginx.org 1.30.6 (stable) or later, or 1.31.7 (mainline) or later. Warning: this replaces the Ubuntu
nginxpackage with the nginx.org one, and the config layout can differ. For example, the nginx.org package's default config is known to readconf.drather thansites-enabled, so sites can silently drop out (this was not checked against official docs for this post, and the switch itself was not tested). Make the backup below first, and after switching confirm withnginx -Tthat all yourserverblocks are present. nginx.org also released 1.31.8 on 2026-10-21. The 2026-10-14 announcement lists four more security fixes besides this one. - Avoid it in config (when you cannot upgrade right away): the CVE record's workaround is two lines. "Avoid using alias in a location." "Avoid using the $request_filename variable." In practice that means replacing
aliaswithrootand not using$request_filename.
Before changing the config, make a copy you can go back to, and re-run the syntax check and the grep afterwards.
# cp -a /etc/nginx /etc/nginx.bak-cve15176# nginx -t && systemctl reload nginxTo roll back, set the changed directory aside and put the backup back whole, then reload: mv /etc/nginx /etc/nginx.failed && cp -a /etc/nginx.bak-cve15176 /etc/nginx && nginx -t && systemctl reload nginx (this rollback was not tested; copying over the live directory with cp -a would leave any files created after the backup, so replace the directory instead). Switching alias to root changes how the request path is appended to the file path, so a wrong path mapping serves a different file or returns a 404. location /static/ { alias /srv/static/; } becomes location /static/ { root /srv; }; open a few real URLs with curl afterwards. The only thing verified here is that grep stops matching alias and $request_filename.
[6] The check after the change: if the same grep prints nothing on the root version, its exit code is 1.
$ nginx -T 2>/dev/null | grep -nE "alias|request_filename"$ echo "exit=$?"exit=1Where the check can mislead
- Do not read
1.24.0fromnginx -vas "lower than 1.30.6, so vulnerable". Ubuntu backports fixes into the same 1.24.0, so go by the package version (7.19or later). Equally, do not assume "Ubuntu must have fixed it" on7.18or older. - The grep also matches commented lines. Look for a leading
#. - If nginx runs with a
-cconfig other than/etc/nginx/nginx.conf, pass the same-ctonginx -T. This was not tested. - Whether a
$request_filenamethat appears only in a log format, with noalias, is actually affected is not settled by the advisory wording. The second sentence says only that "the same result could be achieved".
Official sources: nginx.org security advisories, CVE-2026-15176 on Ubuntu, USN-8955-1, and the vendor advisory F5 K000162416 (it would not open when tried). For general nginx errors see the 502 post and the install post.
Analyze your Nginx log in the browser ↗ — nothing is uploaded.