{"id":3184,"date":"2026-11-30T09:34:54","date_gmt":"2026-11-30T09:34:54","guid":{"rendered":"https:\/\/hostry.com\/blog\/?p=3184"},"modified":"2026-11-30T10:08:16","modified_gmt":"2026-11-30T10:08:16","slug":"nginx-security-update-ubuntu-24-04-check","status":"publish","type":"post","link":"https:\/\/hostry.com\/blog\/nginx-security-update-ubuntu-24-04-check\/","title":{"rendered":"nginx Security Update on Ubuntu 24.04: Check You Are Patched"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-cover.webp\" alt=\"nginx security update on Ubuntu 24.04: a patched package on disk while the old nginx process keeps running in memory\" class=\"wp-image-3176\" srcset=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-cover.webp 1200w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-cover-300x169.webp 300w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-cover-1024x576.webp 1024w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-cover-450x253.webp 450w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-cover-768x432.webp 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You installed the nginx security update on Ubuntu 24.04, ran <code>nginx -v<\/code>, and it still prints <code>nginx\/1.24.0 (Ubuntu)<\/code> as before. That string never changes on 24.04; the proof is a package revision of 1.24.0-2ubuntu7.21 or later and a running nginx that no longer uses the old, deleted binary.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The November fixes came in two revisions. 1.24.0-2ubuntu7.20 (<strong><a href=\"https:\/\/ubuntu.com\/security\/notices\/USN-9159-1\" target=\"_blank\" rel=\"noopener\">USN-9159-1, 19 November 2026<\/a><\/strong>) fixed five CVEs, and 7.21 (<strong><a href=\"https:\/\/ubuntu.com\/security\/notices\/USN-9182-1\" target=\"_blank\" rel=\"noopener\">USN-9182-1, 20 November<\/a><\/strong>) added two more, so a server that stopped at 7.20 still misses two. A third check covers CVE-2026-132779 in <code>ssl_early_data<\/code>, which has no Ubuntu fix as of 30 November 2026.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An nginx security update on Ubuntu keeps the version number and changes only a suffix on the package name. A running web server also keeps the old code in memory until it restarts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The outputs below were reproduced with nginx 1.24.0-2ubuntu7 and 1.24.0-2ubuntu7.21 (Ubuntu 24.04.5 packages) in an Ubuntu 24.04 container without systemd; systemd behaviour is described from the unit file. Everything here applies to Ubuntu&#8217;s own packages, not to nginx.org packages, PPAs or source builds.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checklist\">Patch and verify in seven steps<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>Run the script below with <code>sudo sh ~\/nginx-patch-check.sh<\/code>; every nginx package must be 1.24.0-2ubuntu7.21 or later.<\/li><li>If it is older, run <code>sudo apt update<\/code>, then <code>sudo apt-get install --only-upgrade nginx nginx-common libnginx-mod-mail libnginx-mod-stream<\/code>, adding any other <code>libnginx-mod-*<\/code> package the script listed.<\/li><li>Confirm &#8220;fixed in&#8221; for the seven ids Ubuntu fixed on 24.04, and treat any <code>DISABLED<\/code> line as unpatched. CVE-2026-132779 will show &#8220;not in changelog&#8221;.<\/li><li>Back up <code>\/etc\/nginx<\/code>, then run <code>sudo nginx -t<\/code>; read <strong><a href=\"#before-restart\">Before you restart<\/a><\/strong> first.<\/li><li>Restart, do not reload, because reloaded workers fork from the old master and keep its binary: <code>sudo systemctl restart nginx<\/code>.<\/li><li>Run the script again: no <code>STALE<\/code> lines.<\/li><li>Search the active config for <code>ssl_early_data on<\/code> (see <strong><a href=\"#ssl-early-data\">CVE-2026-132779<\/a><\/strong>) and decide whether to turn it off until Ubuntu ships a fix.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"two-minute-check\">Is your nginx patched? The 2-minute check<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">One read-only script checks the installed package revision, the CVE fixes its changelog records, and whether the nginx in memory still uses replaced files. Run it before and after any change.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Save it in your home directory as <span class=\"highlighted\">~\/nginx-patch-check.sh<\/span>. It needs root only to read the memory map of the nginx master, and it writes nothing.<\/p>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>Full file: nginx-patch-check.sh (41 lines)<\/summary>\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh\n# nginx-patch-check.sh - is the Ubuntu nginx package patched, and is the\n# running nginx actually using the patched files?  Read-only. Run as root.\n# Usage: sh nginx-patch-check.sh [CVE-ID ...]\nCL=${CHANGELOG:-\/usr\/share\/doc\/nginx\/changelog.Debian.gz}\n[ $# -eq 0 ] &amp;&amp; set -- CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 \\\n  CVE-2026-113425 CVE-2026-118899 CVE-2026-125283 CVE-2026-123640 CVE-2026-132779\n\necho \"== Installed packages\"\ndpkg-query -W -f='${Package} ${Version}\\n' 'nginx*' 'libnginx-mod-*' 2&gt;\/dev\/null |\n  awk 'NF==2'\necho \"nginx -v: $(nginx -v 2&gt;&amp;1)   (upstream version only, not the patch level)\"\necho \"apt candidate: $(apt-cache policy nginx 2&gt;\/dev\/null | awk '\/Candidate\/{print $2}')\"\n\necho \"== CVE ids in $CL\"\nfor cve in \"$@\"; do\n  zcat -f \"$CL\" | awk -v id=\"$cve\" '\n    \/^nginx \\(\/ { ver=$2; gsub(\/[()]\/,\"\",ver) }\n    \/^  \\* \/    { kind = ($0 ~ \/REGRESSION\/) ? \"DISABLED\" : \"fixed\" }\n    index($0,id) &amp;&amp; !done { print id\": \"kind\" in \"ver; done=1 }\n    END { if (!done) print id\": not in changelog (not fixed, or not affected: check ubuntu.com\/security\/\" id \")\" }'\ndone\n\necho \"== Running nginx\"\npid=$(cat \/run\/nginx.pid 2&gt;\/dev\/null || pgrep -o -x nginx)\nif [ -z \"$pid\" ] || [ ! -e \"\/proc\/$pid\" ]; then\n  echo \"nginx is not running\"; exit 0\nfi\necho \"master pid $pid, started $(ps -o lstart= -p \"$pid\")\"\nif ls -l \"\/proc\/$pid\/exe\" | grep -q '(deleted)'; then\n  echo \"STALE: master runs a deleted \/usr\/sbin\/nginx - restart nginx\"\nelse\n  echo \"binary: current \/usr\/sbin\/nginx\"\nfi\nold=$(awk '\/\\(deleted\\)\/ &amp;&amp; $6 ~ \/^\\\/(usr\\\/)?(s?bin|lib)\/ {print $6}' \"\/proc\/$pid\/maps\" | sort -u)\nif [ -n \"$old\" ]; then\n  echo \"STALE: master still maps deleted files (restart needed):\"\n  echo \"$old\" | sed 's\/^\/  \/'\nelse\n  echo \"libraries\/modules: no deleted files mapped\"\nfi<\/code><\/pre>\n\n<\/details>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo sh ~\/nginx-patch-check.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Output with packages at 1.24.0-2ubuntu7.21 and nginx not restarted after the upgrade:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>== Installed packages\nlibnginx-mod-mail 1.24.0-2ubuntu7.21\nlibnginx-mod-stream 1.24.0-2ubuntu7.21\nnginx 1.24.0-2ubuntu7.21\nnginx-common 1.24.0-2ubuntu7.21\nnginx -v: nginx version: nginx\/1.24.0 (Ubuntu)   (upstream version only, not the patch level)\napt candidate: 1.24.0-2ubuntu7.21\n== CVE ids in \/usr\/share\/doc\/nginx\/changelog.Debian.gz\nCVE-2026-123007: fixed in 1.24.0-2ubuntu7.20\nCVE-2026-123633: fixed in 1.24.0-2ubuntu7.20\nCVE-2026-123634: fixed in 1.24.0-2ubuntu7.20\nCVE-2026-113425: fixed in 1.24.0-2ubuntu7.20\nCVE-2026-118899: fixed in 1.24.0-2ubuntu7.20\nCVE-2026-125283: fixed in 1.24.0-2ubuntu7.21\nCVE-2026-123640: fixed in 1.24.0-2ubuntu7.21\nCVE-2026-132779: not in changelog (not fixed, or not affected: check ubuntu.com\/security\/CVE-2026-132779)\n== Running nginx\nmaster pid 6360, started Mon Nov 30 10:23:52 2026\nSTALE: master runs a deleted \/usr\/sbin\/nginx - restart nginx\nSTALE: master still maps deleted files (restart needed):\n  \/usr\/lib\/nginx\/modules\/ngx_mail_module.so\n  \/usr\/lib\/nginx\/modules\/ngx_stream_module.so\n  \/usr\/sbin\/nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">How to read it:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Every <code>nginx<\/code> and <code>libnginx-mod-*<\/code> line should show 1.24.0-2ubuntu7.21 or later. The mail and stream modules carry their own copy of the fixed code.<\/li><li>Pass: <code>fixed in<\/code> on the seven CVEs Ubuntu fixed on 24.04. <code>DISABLED<\/code> means the newest changelog entry for that id switched the fix off. CVE-2026-132779 is expected to show &#8220;not in changelog&#8221; because Ubuntu has no fix yet; whether it affects you is a separate <strong><a href=\"#ssl-early-data\">check of the active config<\/a><\/strong>.<\/li><li>A <code>STALE<\/code> line means the running nginx does not use the patched files yet. Test and restart: <code>sudo nginx -t &amp;&amp; sudo systemctl restart nginx<\/code>.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">After a restart, the last block reads:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>== Running nginx\nmaster pid 6093, started Mon Nov 30 10:23:32 2026\nbinary: current \/usr\/sbin\/nginx\nlibraries\/modules: no deleted files mapped<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On a server that stopped at 7.20, two November ids come back missing. 7.20 is gone from the archive, so the 7.20 and 7.11 states below come from the installed 7.21 changelog, cut at that entry (replace 7.20 with 7.11 for the second file):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p \/tmp\/simcl\nzcat \/usr\/share\/doc\/nginx\/changelog.Debian.gz | awk 'index($0,\"nginx (1.24.0-2ubuntu7.20)\")==1{p=1} p' | gzip &gt; \/tmp\/simcl\/changelog-7.20.gz<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The CVE part of the script on that file (other sections trimmed):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ CHANGELOG=\/tmp\/simcl\/changelog-7.20.gz dash ~\/nginx-patch-check.sh CVE-2026-125283 CVE-2026-123640 CVE-2026-123007 CVE-2026-42533 CVE-2026-49975\n[...]\n== CVE ids in \/tmp\/simcl\/changelog-7.20.gz\nCVE-2026-125283: not in changelog (not fixed, or not affected: check ubuntu.com\/security\/CVE-2026-125283)\nCVE-2026-123640: not in changelog (not fixed, or not affected: check ubuntu.com\/security\/CVE-2026-123640)\nCVE-2026-123007: fixed in 1.24.0-2ubuntu7.20\nCVE-2026-42533: fixed in 1.24.0-2ubuntu7.18\nCVE-2026-49975: fixed in 1.24.0-2ubuntu7.12\n[...]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Pass other CVE ids as arguments. The script ran in about 1.2 seconds in the lab container.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"nginx-v-version\">Why nginx -v cannot tell you the patch level<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu keeps one upstream nginx version for the life of a release and backports fixes, copying each security patch into that older code. On 24.04 that version is 1.24.0, so <code>nginx -v<\/code> and the <code>Server:<\/code> header print <code>nginx\/1.24.0 (Ubuntu)<\/code> on the release build and on 7.21 alike. The patch level lives in the package revision, the part after the hyphen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the unpatched release build:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ nginx -v\nnginx version: nginx\/1.24.0 (Ubuntu)\n$ apt-cache policy nginx\nnginx:\n  Installed: 1.24.0-2ubuntu7\n  Candidate: 1.24.0-2ubuntu7.21<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For a yes-or-no answer in monitoring, compare against the USN-9182-1 revision:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ dpkg --compare-versions \"$(dpkg-query -W -f='${Version}' nginx)\" ge 1.24.0-2ubuntu7.21 &amp;&amp; echo 'package &gt;= USN-9182-1 fix' || echo 'package older than 7.21'\npackage &gt;= USN-9182-1 fix<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The changelog at <span class=\"highlighted\">\/usr\/share\/doc\/nginx\/changelog.Debian.gz<\/span> describes the installed package and works offline. A quick grep of it has three traps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:14px\"><strong>1. Grep for the exact id<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The unpatched release build already lists 11 CVE ids on 27 lines, from CVE-2019-20372 to CVE-2024-3094 (the xz rebuild). A count of &#8220;CVE&#8221; lines proves nothing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:14px\"><strong>2. An id can appear while its fix is off<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The 24.04 changelog has three SECURITY REGRESSION entries that disable an earlier fix. 7.11 turned off CVE-2026-49975 (back in 7.12); 7.15 and 7.17 turned off CVE-2026-42533 (back in 7.16 and 7.18). On the changelog as it stood at 7.11, the id still matches three times:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ zgrep -c CVE-2026-49975 \/tmp\/simcl\/changelog-7.11.gz\n3\n$ zgrep -n -B3 CVE-2026-49975 \/tmp\/simcl\/changelog-7.11.gz | head -4\n1-nginx (1.24.0-2ubuntu7.11) noble-security; urgency=medium\n2-\n3-  * SECURITY REGRESSION: ABI change breaking external modules (LP: #2155992)\n4:    - debian\/patches\/CVE-2026-49975.patch: disable for now, pending further<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The script reads only the newest entry that mentions an id, so on that file it prints <code>CVE-2026-49975: DISABLED in 1.24.0-2ubuntu7.11<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:14px\"><strong>3. apt changelog previews the candidate<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Verification uses the installed changelog above. <code>apt changelog nginx<\/code> is an optional look before upgrading: with 1.24.0-2ubuntu7 installed it requested the 7.21 changelog from changelogs.ubuntu.com, which needs HTTPS to that host. Offline, take the candidate&#8217;s changelog from the package:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cd \"$(mktemp -d)\" &amp;&amp; apt-get download nginx &amp;&amp; dpkg-deb --fsys-tarfile nginx_*.deb | tar -xO .\/usr\/share\/doc\/nginx\/changelog.Debian.gz | zcat | head -3\nnginx (1.24.0-2ubuntu7.21) noble-security; urgency=medium\n\n  * SECURITY UPDATE: Improper ClientHello validation in ssl_preread<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"cve-table-24-04\">What the November nginx security update on Ubuntu 24.04 fixes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Upstream, nginx 1.30.7 and 1.31.9 came out on 18 November 2026. The &#8220;10 fixes&#8221; in most news is the mainline count; 1.30.7 lists nine, because CVE-2026-120993 exists only in 1.31.4 and later. The <strong><a href=\"https:\/\/nginx.org\/en\/security_advisories.html\" target=\"_blank\" rel=\"noopener\">nginx security advisories page<\/a><\/strong> gives each vulnerable range.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">USN-9159-1 lists eight CVEs, but marks three for 26.04 and 26.10 only. CVE-2026-123640 reached 24.04 a day later in USN-9182-1, with CVE-2026-125283. Statuses are from the Ubuntu CVE tracker, checked 30 November 2026.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>CVE<\/th><th>Area (nginx.org)<\/th><th>Ubuntu priority<\/th><th>24.04 status<\/th><th>Where the code runs on 24.04<\/th><\/tr><\/thead><tbody>\n<tr><td>CVE-2026-123007<\/td><td>HTTP\/2 flow control<\/td><td>High<\/td><td>Fixed in 1.24.0-2ubuntu7.20<\/td><td>Main binary; reachable when a <code>listen<\/code> line has <code>http2<\/code><\/td><\/tr>\n<tr><td>CVE-2026-123633<\/td><td>HTTP\/2 use-after-free<\/td><td>High<\/td><td>Fixed in 7.20<\/td><td>Main binary, same condition<\/td><\/tr>\n<tr><td>CVE-2026-123634<\/td><td>Resolver use-after-free<\/td><td>High<\/td><td>Fixed in 7.20<\/td><td>Main binary; used when <code>resolver<\/code> is set<\/td><\/tr>\n<tr><td>CVE-2026-113425<\/td><td>Mail proxy use-after-free<\/td><td>High<\/td><td>Fixed in 7.20<\/td><td>libnginx-mod-mail, with a <code>mail {}<\/code> block<\/td><\/tr>\n<tr><td>CVE-2026-118899<\/td><td>Request body read loop over TLS 1.3<\/td><td>Medium<\/td><td>Fixed in 7.20<\/td><td>Main binary<\/td><\/tr>\n<tr><td>CVE-2026-125283<\/td><td><code>alias<\/code> with <code>try_files<\/code><\/td><td>Medium<\/td><td>Fixed in 1.24.0-2ubuntu7.21<\/td><td>Main binary<\/td><\/tr>\n<tr><td>CVE-2026-123640<\/td><td>Stream <code>ssl_preread<\/code><\/td><td>Medium<\/td><td>Fixed in 7.21<\/td><td>libnginx-mod-stream, with <code>ssl_preread on<\/code><\/td><\/tr>\n<tr><td>CVE-2026-121810<\/td><td>HTTP\/3<\/td><td>High<\/td><td>Not affected<\/td><td>The 24.04 build has no HTTP\/3 module<\/td><\/tr>\n<tr><td>CVE-2026-120967<\/td><td>Stream SNI and client certificates<\/td><td>Medium<\/td><td>Not affected<\/td><td>Affected code starts at 1.25.5<\/td><\/tr>\n<tr><td>CVE-2026-120993<\/td><td>PROXY protocol v2<\/td><td>Medium<\/td><td>Not affected<\/td><td>Mainline 1.31.4 and later only<\/td><\/tr>\n<tr><td>CVE-2026-132779<\/td><td><code>ssl_early_data<\/code> CPU use<\/td><td>Medium<\/td><td>Needs evaluation, no fix<\/td><td>Main binary, with <code>ssl_early_data on<\/code><\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Install the update whatever the last column says; it only tells you what is exposed until the restart.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The HTTP\/3 row is easy to confirm: this prints nothing on 24.04.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx -V 2&gt;&amp;1 | grep -oE \"http_v3|quic\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Configure flags do not show whether mail or stream code is present. <code>nginx -V<\/code> lists <code>--with-mail_ssl_module<\/code> and <code>--with-stream_ssl_preread_module<\/code> even with neither module installed, because those parts ship as separate dynamic module packages. Check <span class=\"highlighted\">\/etc\/nginx\/modules-enabled\/<\/span> and the active config.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ nginx -T 2&gt;\/dev\/null | grep -nE \"^\\s*(listen .*http2|http2 on|ssl_early_data|ssl_preread|resolver |mail \\{|stream \\{|try_files|alias |load_module)\"\n87:load_module modules\/ngx_mail_module.so;\n90:load_module modules\/ngx_stream_module.so;\n246:\t\ttry_files $uri $uri\/ =404;\n290:    listen 443 ssl http2;\n295:    ssl_early_data on;\n297:        alias \/var\/www\/static\/;\n298:        try_files $uri $uri\/ =404;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Both modules load here although no <code>mail {}<\/code> or <code>stream {}<\/code> block exists; the module packages enable them on install, and nginx-core and nginx-extras pull those in. The fixes for CVE-2026-113425 and CVE-2026-123640 live in their .so files, so the module packages must reach 7.21 too.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"before-restart\">Before you restart: what can break<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A restart can take the site down, so check four things first.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Test the config. In the lab the init script refused to stop nginx when the test failed, and the old process kept answering. Under systemd, <code>systemctl restart<\/code> stops nginx before starting it again. The unit, <code>\/usr\/lib\/systemd\/system\/nginx.service<\/code>, runs <code>nginx -t -q<\/code> only before the start, so with a broken config nginx stays down after the stop. That follows from the unit file; it was not run here.<\/li><li>Know where your upstreams point. nginx resolves hostnames in <code>proxy_pass<\/code> and <code>upstream<\/code> blocks at start. A <strong><a href=\"https:\/\/discourse.ubuntu.com\/t\/ubuntu-24-04-unattended-upgrades-failed-to-restart-nginx\/67909\" target=\"_blank\" rel=\"noopener\">user report on Ubuntu Discourse<\/a><\/strong> (23 September 2025) describes nginx failing its test after an automatic restart because an upstream name did not resolve; a manual restart later worked. Point local apps, such as an <strong><a href=\"https:\/\/hostry.com\/blog\/n8n-reverse-proxy-nginx-caddy\/\">n8n instance behind a reverse proxy<\/a><\/strong>, at 127.0.0.1.<\/li><li>There is no way back to 7.20. The archive holds only the release build 1.24.0-2ubuntu7 and 7.21, so a downgrade drops every November fix. Fix forward and keep a config backup.<\/li><li><code>http2 on;<\/code> from current docs needs nginx 1.25.1 and fails on 1.24 with <code>unknown directive \"http2\"<\/code>; keep <code>listen 443 ssl http2;<\/code>.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tar czf \/root\/nginx-etc-$(date +%F).tar.gz \/etc\/nginx\nsudo nginx -t<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A failed test, and the init script refusing to restart:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ nginx -t; echo rc=$?\n2026\/11\/30 10:22:02 [emerg] 5582#5582: unknown directive \"lab_broken_directive\" in \/etc\/nginx\/conf.d\/lab-broken.conf:1\nnginx: configuration file \/etc\/nginx\/nginx.conf test failed\nrc=1\n$ \/etc\/init.d\/nginx restart; echo rc=$?\n * Restarting nginx nginx\n   ...fail!\nrc=1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If a restart on production feels risky, rehearse it on a <strong><a href=\"https:\/\/hostry.com\/products\/vps\/\">spare KVM VPS<\/a><\/strong> with a copy of <code>\/etc\/nginx<\/code> and the same packages. A Hostry Linux VPS costs from $6 per month, comes with root access and a VNC console, and runs in 18+ locations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"running-process\">Reload or restart nginx after an update?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On Linux a running program keeps the file it started from, even after an update deletes it. nginx can serve from the old binary and modules for days while every package tool reports the new revision. The kernel marks such files &#8220;(deleted)&#8221; in <span class=\"highlighted\">\/proc\/&lt;PID&gt;\/exe<\/span> and <code>\/proc\/&lt;PID&gt;\/maps<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An upgrade has two possible outcomes. The package script may do a binary upgrade itself (see <strong><a href=\"#automatic-updates\">automatic updates<\/a><\/strong>), or it may leave the old process running, as in this transcript right after <code>apt-get install --only-upgrade<\/code>. Either way, verify the running process:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ dpkg -l nginx nginx-common libnginx-mod-mail libnginx-mod-stream | tail -4\nii  libnginx-mod-mail   1.24.0-2ubuntu7.21 amd64        Mail module for Nginx\nii  libnginx-mod-stream 1.24.0-2ubuntu7.21 amd64        Stream module for Nginx\nii  nginx               1.24.0-2ubuntu7.21 amd64        small, powerful, scalable web\/proxy server\nii  nginx-common        1.24.0-2ubuntu7.21 all          small, powerful, scalable web\/proxy server - common files\n$ ls -l \/proc\/2236\/exe\nlrwxrwxrwx 1 root root 0 Nov 30 10:15 \/proc\/2236\/exe -&gt; \/usr\/sbin\/nginx (deleted)\n$ grep modules \/proc\/2236\/maps | awk '{print $6,$7}' | sort -u\n\/usr\/lib\/nginx\/modules\/ngx_mail_module.so (deleted)\n\/usr\/lib\/nginx\/modules\/ngx_stream_module.so (deleted)\n$ curl -sI http:\/\/127.0.0.1\/ | grep Server\nServer: nginx\/1.24.0 (Ubuntu)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On your server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ls -l \/proc\/$(cat \/run\/nginx.pid)\/exe<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:14px\"><strong>A reload is not enough<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>nginx -s reload<\/code>, which is also the unit&#8217;s <code>ExecReload<\/code>, starts new workers forked from the old master. They run the deleted binary and map the old module inodes, while the files on disk have new ones.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ nginx -s reload\n2026\/11\/30 10:19:36 [notice] 3901#3901: signal process started\n$ cat \/run\/nginx.pid\n2236\n$ ls -l \/proc\/3902\/exe\nlrwxrwxrwx 1 www-data www-data 0 Nov 30 10:19 \/proc\/3902\/exe -&gt; \/usr\/sbin\/nginx (deleted)\n$ grep modules \/proc\/3902\/maps | awk '{print $5,$6,$7}' | sort -u\n1631924 \/usr\/lib\/nginx\/modules\/ngx_mail_module.so (deleted)\n1631934 \/usr\/lib\/nginx\/modules\/ngx_stream_module.so (deleted)\n$ ls -i \/usr\/lib\/nginx\/modules\/\n1631428 ngx_mail_module.so\n1631459 ngx_stream_module.so<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For a new worker on your server (not run in the lab): <code>sudo ls -l \/proc\/$(pgrep -n -f 'nginx: worker')\/exe<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:14px\"><strong>Restart to load the patched code<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On a VPS: <code>sudo nginx -t &amp;&amp; sudo systemctl restart nginx<\/code>. In the lab the init script stood in for systemd:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ \/etc\/init.d\/nginx restart   # substitute for systemctl restart nginx\n * Restarting nginx nginx\n   ...done.\n$ ls -l \/proc\/5539\/exe\nlrwxrwxrwx 1 root root 0 Nov 30 10:21 \/proc\/5539\/exe -&gt; \/usr\/sbin\/nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Without systemd, the lab also showed nginx&#8217;s own binary upgrade loading the new code: <code>USR2<\/code> starts a new master from the file on disk, and <code>QUIT<\/code> drains the old one. How systemd tracks the new master PID afterwards was not reproduced, so restart stays the recommendation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo kill -USR2 $(cat \/run\/nginx.pid)\nsudo kill -QUIT $(cat \/run\/nginx.pid.oldbin)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The new master (PID 3938) ran the current binary and modules, and HTTP answered 200 after the old master quit.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"800\" src=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-flow.webp\" alt=\"Decision flow after an nginx security update on Ubuntu 24.04: revision 7.21 or later, no deleted binary in the master process, ssl_early_data off unless needed\" class=\"wp-image-3179\" srcset=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-flow.webp 1200w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-flow-300x200.webp 300w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-flow-1024x683.webp 1024w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-flow-450x300.webp 450w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2026\/11\/nginx-security-update-ubuntu-24-04-check-flow-768x512.webp 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><figcaption>After an nginx package update: check the package revision, then whether the master still runs a deleted binary, then whether ssl_early_data is on.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:14px\"><strong>Library updates leave nginx stale too<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">nginx on 24.04 uses the system OpenSSL (running 3.0.13) and PCRE2. After a libpcre2-8-0 upgrade under a running nginx, the exe link looked clean and the map still held the old library:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ls -l \/proc\/5539\/exe\nlrwxrwxrwx 1 root root 0 Nov 30 10:21 \/proc\/5539\/exe -&gt; \/usr\/sbin\/nginx\n$ grep -E 'libpcre2|libssl' \/proc\/5539\/maps | awk '{print $6,$7}' | sort -u\n\/usr\/lib\/x86_64-linux-gnu\/libpcre2-8.so.0.11.2 (deleted)\n\/usr\/lib\/x86_64-linux-gnu\/libssl.so.3\n$ needrestart -b | grep SVC\nNEEDRESTART-SVC: nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">An OpenSSL update should work the same way (none was pending in the lab), so the script reads the maps too. It filters out <code>\/dev\/zero (deleted)<\/code>, nginx&#8217;s shared memory, which a raw grep always flags.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"automatic-updates\">Automatic updates on 24.04: unattended-upgrades and needrestart<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu 24.04 installs security updates on its own, and both nginx revisions came through the security pocket. Whether the running process switches to the new code depends on the package script and on needrestart, a tool that restarts services still using replaced files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The defaults in <span class=\"highlighted\">\/etc\/apt\/apt.conf.d\/20auto-upgrades<\/span> enable the daily run, and <code>\/etc\/apt\/apt.conf.d\/50unattended-upgrades<\/code> allows the security origin; <code>Automatic-Reboot<\/code> stays commented out (default false):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>APT::Periodic::Update-Package-Lists \"1\";\nAPT::Periodic::Unattended-Upgrade \"1\";\nUnattended-Upgrade::Allowed-Origins {\n\t\"${distro_id}:${distro_codename}\";\n\t\"${distro_id}:${distro_codename}-security\";\n\t\"${distro_id}ESMApps:${distro_codename}-apps-security\";\n\t\"${distro_id}ESM:${distro_codename}-infra-security\";\n};<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A dry run on 1.24.0-2ubuntu7 listed nginx, nginx-common and both module packages. A locally edited <code>sites-available\/default<\/code> did not block it, since 7.21 ships the same version of that file. If this server never got the basics, start with <strong><a href=\"https:\/\/hostry.com\/blog\/secure-new-linux-vps-first-30-minutes\/\">hardening a fresh Ubuntu 24.04 VPS in its first 30 minutes<\/a><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:14px\"><strong>What the package script does with a running nginx<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The 7.21 post-install script asks whether nginx is running. If yes, it does the <code>USR2<\/code> binary upgrade itself; in the lab (init script, no systemd) the master PID changed from 4147 to 4290 without a stop:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Setting up nginx (1.24.0-2ubuntu7.21) ...\n * Upgrading binary nginx       [ OK ]\nProcessing triggers for nginx (1.24.0-2ubuntu7.21) ...\nTriggering nginx reload ...\n * Reloading nginx configuration nginx       [ OK ]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the service manager does not see nginx running, the script leaves the old process alone and prints one line that is easy to miss. On a VPS that can happen when nginx was started by hand outside systemd (from the script logic):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Not attempting to start NGINX, port 80 is already in use.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:14px\"><strong>needrestart then attempts a full restart<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">needrestart&#8217;s APT hook runs after every apt transaction, unattended ones included. <strong><a href=\"https:\/\/ubuntu.com\/server\/docs\/how-to\/software\/automatic-updates\/\" target=\"_blank\" rel=\"noopener\">Ubuntu&#8217;s automatic updates documentation<\/a><\/strong> says that from 24.04 it restarts affected services by default. In the lab the hook found the stale nginx and issued a restart, which the container&#8217;s policy blocked:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Restarting services...\n invoke-rc.d nginx restart<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That is a full restart, with the same config and DNS risks, at whatever hour the timer runs. With a broken config the init script refused, so the old unpatched process kept serving; under systemd the unit stops nginx first. <span class=\"highlighted\">\/etc\/needrestart\/needrestart.conf<\/span> does not exclude nginx. Ubuntu&#8217;s <strong><a href=\"https:\/\/discourse.ubuntu.com\/t\/needrestart-changes-in-ubuntu-24-04-service-restarts\/44671\" target=\"_blank\" rel=\"noopener\">needrestart announcement<\/a><\/strong> shows a drop-in for excluding a service; for nginx: <code>$nrconf{override_rc}{qr(^nginx\\.service$)} = 0;<\/code> in <span class=\"highlighted\">\/etc\/needrestart\/conf.d\/nginx.conf<\/span> (not tested here). We would keep automatic restarts and keep <code>nginx -t<\/code> clean, because an exclusion makes every restart after an nginx, OpenSSL or PCRE2 update your job.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After any automatic run, <code>sudo needrestart -b | grep SVC<\/code> or the script tells you whether nginx was left behind.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"ssl-early-data\">CVE-2026-132779: ssl_early_data has no Ubuntu fix yet<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ssl_early_data<\/code> turns on TLS 1.3 early data (0-RTT), which lets a returning client send its first request with the handshake. With it on, a client might keep a worker busy at full CPU and degrade service. nginx.org fixed it on 23 November 2026:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Security: when using the &#8220;ssl_early_data&#8221; directive a client might cause excessive CPU usage (CVE-2026-132779).<\/p><cite>nginx CHANGES-1.30, nginx 1.30.8, 23 Nov 2026<\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong><a href=\"https:\/\/ubuntu.com\/security\/CVE-2026-132779\" target=\"_blank\" rel=\"noopener\">Ubuntu tracker entry for CVE-2026-132779<\/a><\/strong> lists 24.04 as &#8220;Needs evaluation&#8221; with no fix (last updated 25 November, checked 30 November). 1.24 accepts the directive; a test site with <code>ssl_early_data on;<\/code> passed <code>nginx -t<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check the active config with <code>nginx -T<\/code>; a recursive grep also matches sites that are not enabled. example.com and old.example.com are lab test sites:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ grep -rn ssl_early_data \/etc\/nginx\n\/etc\/nginx\/sites-available\/example.com:7:    ssl_early_data on;\n\/etc\/nginx\/sites-available\/old.example.com:4:    ssl_early_data on;\n$ nginx -T 2&gt;\/dev\/null | grep -E \"^# configuration file|ssl_early_data\" | grep -B1 ssl_early_data\n# configuration file \/etc\/nginx\/sites-enabled\/example.com:\n    ssl_early_data on;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Only example.com is live. If nothing depends on 0-RTT, remove the directive or set <code>ssl_early_data off;<\/code> (the default) in the file <code>nginx -T<\/code> names, editing the copy in <code>sites-available<\/code> because <code>sites-enabled<\/code> holds a symlink, then test the config with <code>sudo nginx -t<\/code> and reload with <code>sudo systemctl reload nginx<\/code>. The cost is one extra round trip when a returning TLS 1.3 client resumes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you keep it, watch for a worker pinned at 100% of a core (not run in the lab); the tracker says the effect lasts until the worker restarts.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>top -b -n1 -c -w 512 | grep '[n]ginx: worker'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">An Ubuntu fix would arrive as a revision above 7.21, and the script should then print <code>fixed in<\/code> for this id.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"recovery\">If the restart fails<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A failed restart under systemd usually leaves nginx stopped and the sites offline. Find the cause, then start it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nginx -t\nsudo journalctl -u nginx -n 30 --no-pager<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><code>nginx -t<\/code> names the file and line. Fix it, or move that file out of <code>sites-enabled<\/code> or <code>conf.d<\/code>, then <code>sudo systemctl start nginx<\/code>.<\/li><li>An upstream &#8220;host not found&#8221; error points to DNS at that moment; start again once the name resolves.<\/li><li>If today&#8217;s edit is the problem, move the broken tree aside and unpack the backup: <code>sudo mv \/etc\/nginx \/etc\/nginx.broken &amp;&amp; sudo tar xzf \/root\/nginx-etc-YYYY-MM-DD.tar.gz -C \/<\/code> (your backup date), then test and start. Unpacking over the old tree only reverts edited files; a file added after the backup stays and keeps failing <code>nginx -t<\/code>.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Then run the script again; it should show no <code>STALE<\/code> lines.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-this-means\">What this means for you<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The smallest first step takes two minutes: run the check script on each server that runs nginx. If it prints a revision below 7.21 or a STALE line, update and restart nginx, not reload it, and the November fixes are then in the process that serves your sites. Re-check the ssl_early_data line when Ubuntu publishes its fix for that last CVE.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>On Ubuntu 24.04 nginx -v prints 1.24.0 before and after the November fixes. One read-only script checks the package revision (1.24.0-2ubuntu7.21 or la&#8230;<\/p>\n","protected":false},"author":6,"featured_media":3177,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"hb_lab_versions":"nginx 1.24.0-2ubuntu7.21, Ubuntu 24.04","hb_offer_kicker":"","hb_offer_title":"","hb_offer_text":"","footnotes":""},"categories":[14,127],"tags":[],"class_list":["post-3184","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-servers","category-security"],"read_time":13,"_links":{"self":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts\/3184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/comments?post=3184"}],"version-history":[{"count":3,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts\/3184\/revisions"}],"predecessor-version":[{"id":3191,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts\/3184\/revisions\/3191"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/media\/3177"}],"wp:attachment":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/media?parent=3184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/categories?post=3184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/tags?post=3184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}