Skip to content

nginx: detectors for CVE-2026-123007, CVE-2026-123633 (HTTP/2) and CVE-2026-123634 (resolver) - #8

Merged
kurt-r2c merged 4 commits into
mainfrom
jr/nginx-http2-detectors
Nov 18, 2026
Merged

kurt-r2c merged 4 commits into
mainfrom
jr/nginx-http2-detectors

Conversation

@semgrep-jamie

@semgrep-jamie semgrep-jamie commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Host and fleet detectors for three nginx worker memory-corruption bugs fixed together in nginx 1.30.7 / 1.31.9 on 2026-11-18 (nginx.org advisories, Wiz write-up for the HTTP/2 pair):

CVE Feature Affected Fixed
CVE-2026-123007 (HTTP/2 flow-control window overflow) HTTP/2 1.9.5–1.31.8 1.30.7+, 1.31.9+
CVE-2026-123633 (HTTP/2 use-after-free) HTTP/2 1.19.7–1.31.8 1.30.7+, 1.31.9+
CVE-2026-123634 (resolver use-after-free in subrequests) resolver 0.6.18–1.31.8 1.30.7+, 1.31.9+

CVE-2026-123634 is not in the Wiz post; it was added in the second commit. Turning HTTP/2 off does not mitigate it, so without it a host could pass the check after applying the HTTP/2 workaround while still exposed.

Same contract as CVE-2026-114938/: per-instance blocks with [!] / OK / [?] / n/a, last line impacted / not impacted / unknown, exit 0/1/2/3. The result line names the CVEs that apply (=> [!] impacted: CVE-2026-123634).

What counts as impacted (per CVE: version, backport and its feature check must all be [!])

  • version: from nginx -V.
    • Open-source ranges are taken from nginx.org.
    • NGINX Plus: R-series and PLS.37 tracks, with fix versions from the NGINX Plus release notes.
      • PLS.37.0.7.1 / 37.2.0.1 fix CVE-2026-123633 only.
      • PLS.37.0.8.1 LTS / 37.3.0.1 CR fix all three.
    • OpenResty is judged on its nginx core. Other forks are [?].
  • backport: Debian/Ubuntu/RHEL-family packages keep the upstream version when they patch, so the script greps the package changelog (dpkg or rpm) for each CVE ID separately.
    • nginx.org packages, NGINX Plus, and binaries no package owns are judged on version alone.
    • Alpine vendor packages are [?].
    • A master still running a binary that was replaced on disk is reported "restart nginx".
  • http/2 (CVE-2026-123007, CVE-2026-123633): built with --with-http_v2_module, and the config enables it (listen ... http2, or http2 on; set in or inherited by a server).
  • resolver (CVE-2026-123634): a resolver directive anywhere in http{} (http/server/location/upstream). Stream/mail resolvers don't count. Subrequests (auth_request, SSI, mirror, slice, njs, Lua...) are assumed rather than detected.
  • Configs are parsed directly: includes, globs, symlinks inside container roots, comments, quotes, *_by_lua_block. nginx -T is not run, so no writes, TLS keys or DNS are needed.

Coverage

  • Running masters (with their -c / -p).
  • Masters in containers via nsenter and /proc/PID/root, labelled with the container hostname (the pod name in k8s).
  • Installed binaries, and binaries passed with -n.
  • Linux and macOS, bash 3.2+.

Files

  • linux/detect-nginx-http2.sh: host detector. The name predates CVE-2026-123634; happy to rename the folder/script if reviewers prefer.
  • linux/ssh-nginx-http2.sh, linux/k8s-nginx-http2.yaml: fleet wrappers adapted from the JDK ones. The DaemonSet is privileged by design, as before.
  • linux/tests/: harness and fake nginx.
  • .github/workflows/nginx-http2-linux.yml:
    • shellcheck.
    • Full suite on ubuntu-latest and ubuntu-22.04, with images pinned by digest.
    • Logic tests on macOS bash 3.2.

Tests (run locally: macOS arm64 plus Colima/Docker aarch64)

  • 74 decision-logic checks with a fake nginx. They cover version and Plus boundaries for all three CVEs, forks, the build flag, and HTTP/2 and resolver config-parsing edge cases. They pass on bash 3.2 and 5.
  • 19 real-nginx checks inside containers:
    • nginx.org Debian and Alpine images (1.30.6), and OpenResty 1.31.8.1.
    • The Debian 13, Ubuntu 24.04 and AlmaLinux 9 packages.
    • Stock configs come back not impacted.
    • Enabling HTTP/2 makes them impacted by the HTTP/2 pair; adding a resolver with HTTP/2 off makes them impacted by CVE-2026-123634 only.
    • Simulated vendor backports of all three CVEs and of one.
    • A replaced-but-not-restarted binary, a master started with -c, and a non-root run.
  • 2 DaemonSet-style checks: a privileged --pid=host scan finds every container's nginx through nsenter.
  • Expected verdicts for distro packages come from an independent read of each changelog, so the suite stays green once vendors ship fixes.

Not yet verified

  • No real NGINX Plus host. The nginx-plus-r37.0.N version-string format is inferred from F5's install docs, and unrecognised Plus strings report [?].
  • Fixed-version images (1.30.7 / 1.31.9) weren't on Docker Hub yet, so that path is covered by the fake binary only.
  • No live k8s cluster, no real SSH fleet, no x86_64 run locally. CI covers x86_64.

🤖 Generated with Claude Code

Host detector (bash 3.2+) for the two nginx HTTP/2 worker memory-corruption
bugs fixed in nginx 1.30.7 / 1.31.9 on 2026-11-18. An nginx is impacted
when its version is affected, no distro backport is recorded in the
package changelog, and its config turns HTTP/2 on. The config is parsed
directly (includes, globs, symlinks, Lua blocks); nginx -T is not run.

Covers running masters (including containers via nsenter), installed
binaries, NGINX Plus PLS.37 / R-series, and OpenResty and other forks
(reported unknown). Adds SSH and Kubernetes DaemonSet fleet wrappers, a
test harness (fake nginx plus real nginx.org, OpenResty, Debian, Ubuntu
and AlmaLinux builds in Docker), and a CI workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
labels:
app: nginxh2
spec:
hostPID: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium severity issue identified in your code:

The privileged DaemonSet shares each node’s process namespace through hostPID: true, exposing host processes to a compromised detect container. An attacker could inspect or attach to node processes and use their credentials to escalate to node or Kubernetes access.

More details about this

spec.hostPID: true places every nginxh2 pod in the node's process-ID namespace. Because the container is also privileged: true, a compromise of the detect container can access and interact with host processes rather than being limited to processes in the container.

A plausible attack is:

  1. An attacker gains code execution in the detect container, for example through a vulnerability in the downloaded detect-nginx-http2.sh workflow or the debian:stable-slim runtime.
  2. They inspect /proc and use the host PIDs exposed by hostPID to identify node services, such as the container runtime, kubelet, or an application holding cloud or Kubernetes credentials.
  3. They use the container's privileged context and tools such as nsenter (installed by the command in args) to enter a host process's namespaces, or attach with ptrace where permitted.
  4. From that host context, they can read process memory or credentials, execute commands as a host process, and potentially obtain node-level access or Kubernetes credentials for workloads scheduled on the node.

This setting is especially risky in a DaemonSet because the privileged, host-process-visible container is deployed across every Linux node selected by nodeSelector, and tolerations allows it onto tainted nodes as well.

To resolve this comment:

✨ Commit fix suggestion
  1. Remove hostPID: true from the pod template:
    spec.template.spec.hostPID

  2. Update detect-nginx-http2.sh so it does not inspect host processes or rely on nsenter to access the host PID namespace. Use a Kubernetes API, node-level metrics source, or another least-privilege data source instead.

  3. Keep the pod in its own PID namespace and verify that no container requires hostPID before applying the manifest.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by hostpid-pod.

You can view more details about this finding in the Semgrep AppSec Platform.

- name: detect
image: debian:stable-slim
securityContext:
privileged: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium severity issue identified in your code:

The detect container runs privileged on every eligible Linux node and also shares the host PID namespace. An attacker who can execute commands in it may enter host namespaces, access node credentials and workload data, or take over the node.

More details about this

nginxh2 is a DaemonSet that schedules the detect container on Linux nodes, and its securityContext.privileged: true grants that container broad host-level capabilities. Combined with hostPID: true, a process running in the container can see and interact with host processes and use tools such as nsenter (installed by the startup command) to enter the node's namespaces.

A plausible attack would be:

  1. An attacker gains the ability to run a command in the detect container, for example through a compromised workload or Kubernetes credential:
    kubectl -n nginxh2 exec -it <nginxh2-pod> -c detect -- /bin/sh
  2. Inside the container, they target the host's PID 1 process and enter its namespaces:
    nsenter -t 1 -m -u -i -n -p -- /bin/sh
  3. From that shell, they can inspect or interfere with node processes and networking. Because privileged: true also provides powerful capabilities such as CAP_SYS_ADMIN, they can identify a host disk with lsblk, mount it, and read or alter node data such as kubelet credentials, container runtime state, and other workloads' secrets.

This is especially high impact because the DaemonSet's tolerations allow it to run broadly across nodes, so compromising one detect container can become a path to the underlying Kubernetes node and its workloads.

To resolve this comment:

✨ Commit fix suggestion
  1. Remove privileged: true from the container securityContext, or remove the securityContext block if it has no other settings.
  2. Add a restrictive security context for the container:
    allowPrivilegeEscalation: false, readOnlyRootFilesystem: true, and capabilities: { drop: ["ALL"] }.
  3. Remove hostPID: true from the pod if the detection script does not need to inspect host processes. Avoiding host namespaces prevents the container from accessing the node’s process namespace.
  4. Update detect-nginx-http2.sh to use Kubernetes APIs or node-exported data instead of nsenter and host namespace access.
  5. Alternatively, if host inspection is required, replace the script with a narrowly scoped node agent that uses only the specific Linux capabilities it needs, rather than enabling privileged; do not grant SYS_ADMIN or mount host filesystems unless the agent’s operation requires them and the access is explicitly reviewed.
💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by privileged-container.

You can view more details about this finding in the Semgrep AppSec Platform.

nginx 1.30.7 / 1.31.9 also fixed CVE-2026-123634, a use-after-free when
the "resolver" directive is used and the same name is resolved in
subrequests (vulnerable 0.6.18-1.31.8). Turning HTTP/2 off does not
mitigate it, so a host the detector called "not impacted" after that
mitigation could still be exposed.

The detector now evaluates each CVE separately: version range, changelog
backport per CVE ID, and the feature the bug is in (http/2 for
CVE-2026-123007/123633, a resolver anywhere in http{} for
CVE-2026-123634). The result line names the CVEs that apply. NGINX Plus
fixes it in PLS.37.0.8.1 LTS / PLS.37.3.0.1 CR. README remediation now
says HTTP/2-off covers only the HTTP/2 pair.

Tests: 74 decision-logic checks (bash 3.2 and 5) and 21 real-nginx and
container-scan checks, including a resolver-only nginx.org container that
is impacted with HTTP/2 off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@semgrep-jamie semgrep-jamie changed the title nginx HTTP/2: detectors for CVE-2026-123007 and CVE-2026-123633 nginx: detectors for CVE-2026-123007, CVE-2026-123633 (HTTP/2) and CVE-2026-123634 (resolver) Nov 18, 2026
semgrep-jamie and others added 2 commits November 18, 2026 10:55
sudo -n exits 1 when the target needs a password ("sudo: a password is
required"), and so does sudo when bash is missing. The wrapper read that
exit code as the detector's "impacted" verdict, so hosts where the
detector never ran showed up as impacted.

Accept exit 0/1/2 only when the detector's last line (its verdict) agrees
with it; otherwise report the host as an error, naming sudo when stderr
shows it, and print a hint when sudo needs a password. Adds wrapper tests
with stub ssh and sudo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

3 participants