Skip to content

fix: patch nginx HIGH CVEs in the base image - #262

Open
bohdankanarskyi-runpod wants to merge 6 commits into
developfrom
fix/base-nginx-cves
Open

bohdankanarskyi-runpod wants to merge 6 commits into
developfrom
fix/base-nginx-cves

Conversation

@bohdankanarskyi-runpod

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Verdict: ready to merge

Findings: none still open.

Fixed since last review

  • official-templates/base/Dockerfile:199 (minor): if the first deb failed to download or failed its checksum, the loop still went on to dpkg -i. Fixed: each iteration now ends in || exit 1, in both the nginx loop and the apt loop.
  • official-templates/base/Dockerfile:193 (major, outdated thread): pinned security.ubuntu.com/ubuntu/pool URLs return 404 once Ubuntu ships the next update. Fixed: every pinned deb now comes from Launchpad +files/, which keeps superseded builds, and curl uses --retry 5.

What I checked: all four nginx/nginx-common debs (24.04 1.24.0-2ubuntu7.21, 26.04 1.28.3-2ubuntu1.14) download from Launchpad with HTTP 200 and match the pinned sha256. The runpodctl v3.1.1 tarball matches RUNPODCTL_SHA256. The nginx debs need nothing beyond what the base layer already installs (libssl3t64, libpcre2-8-0, nginx-common (=), and iproute2 on 24.04). /etc/nginx/nginx.conf is copied after this layer, so dpkg -i replaces unmodified conffiles and does not stop to prompt.

Risk to current users: low

  • runpod/base and its children, rocm, and nvidia-pytorch (which also builds from base/Dockerfile) get a patched nginx in the same upstream series (1.24 on 24.04, 1.28 on 26.04). The proxy config doesn't change, and nothing reads or writes /workspace.
  • On 26.04 images, /usr/bin/pebble is removed. Nothing in the image calls it. A user script that called pebble directly would now fail, which is unlikely.
  • autoresearch moves runpodctl from v3.0.1 to v3.1.1. Users who drive pods with runpodctl from their own agents get the newer CLI. It is a minor-version bump, so no flags should be removed.
  • nvidia-pytorch moves mistune from 3.3.3 to 3.3.4 (patch release).
  • No README or changelog update needed.

Release: fix: = patch for base, pytorch, pytorch-cluster, ray-cluster, autoresearch, filebrowser (all via depends_on: [base]), plus rocm and nvidia-pytorch (their paths include official-templates/base/**). The title is correct.

Test on a live pod: none needed beyond CI. If you want to be thorough, run nginx -v and curl -I localhost:<proxied port> on a CUDA 24.04 runpod/base pod to confirm the proxy starts with the upgraded nginx.

Comment on lines +194 to +196
echo "${p#*:} /tmp/${deb}" | sha256sum -c - && \
debs="${debs} /tmp/${deb}"; \
done && \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] If the first deb fails to download or fails its checksum, the build keeps going. The loop runs curl && sha256sum -c && debs=...; done, so a failure in the first iteration (nginx_*.deb) only stops that && chain. The loop's exit status comes from the last iteration, so done && still goes on to dpkg -i, now with just nginx-common. Here is the shell behaviour on its own:

$ bash -c 'for p in a b; do [ $p = b ] && echo ok $p; done && echo LOOP_OK'
ok b
LOOP_OK

What happens next depends on how dpkg treats an upgraded nginx-common while the installed nginx needs nginx-common (= old). If dpkg exits 0, the image ships the vulnerable nginx binary and the build passes. The dpkg-query line only prints versions and does not check them. The pinned hashes match what is published today (I checked all four), so this only matters when the mirror misbehaves or a deb is tampered with. Still, a failed checksum should always fail the build. The apt block above has the same pattern.

Suggested change
echo "${p#*:} /tmp/${deb}" | sha256sum -c - && \
debs="${debs} /tmp/${deb}"; \
done && \
echo "${p#*:} /tmp/${deb}" | sha256sum -c - && \
debs="${debs} /tmp/${deb}" || exit 1; \
done && \

Comment thread official-templates/base/Dockerfile Outdated
for p in "nginx_${ver}_amd64.deb:${sha_nginx}" "nginx-common_${ver}_all.deb:${sha_common}"; do \
deb="${p%%:*}" && \
curl -fsSL --proto '=https' --tlsv1.2 -o "/tmp/${deb}" \
"https://security.ubuntu.com/ubuntu/pool/main/n/nginx/${deb}" && \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[major] This URL stops working as soon as Ubuntu publishes the next nginx security update. After that, every base build on a CUDA parent fails with a 404 whenever the layer cache misses.

security.ubuntu.com/ubuntu/pool keeps only the current build of each source. I checked today:

nginx_1.24.0-2ubuntu7.21_amd64.deb  200
nginx_1.24.0-2ubuntu7.20_amd64.deb  404   # published only a few days ago, already gone
nginx_1.24.0-2ubuntu7.19_amd64.deb  404

The CUDA parents pin apt to a stale snapshot, which is why this block exists. So on those parents cur stays below ver, and the download runs on every uncached build. Once 7.22 ships, curl -f gets a 404. If the open loop-exit issue above is fixed, that 404 fails the build. If it is not fixed, the build quietly ships only nginx-common. Either way, every family in the release is blocked until someone re-pins. nginx gets security updates often (7.20 → 7.21 within days), so this will happen soon. The apt, brotli and ca-certificates blocks have the same exposure.

The Launchpad librarian keeps superseded builds permanently, and the sha256 still pins the content:

https://launchpad.net/ubuntu/+archive/primary/+files/nginx_1.24.0-2ubuntu7.20_amd64.deb -> 200 (launchpadlibrarian.net)
Suggested change
"https://security.ubuntu.com/ubuntu/pool/main/n/nginx/${deb}" && \
curl -fsSL --proto '=https' --tlsv1.2 -o "/tmp/${deb}" \
"https://launchpad.net/ubuntu/+archive/primary/+files/${deb}" && \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant