Repository navigation
nginx: cover CVE-2026-121810 (HTTP/3) and CVE-2026-113425 (mail proxy), add Ansible and kubectl exec wrappers - #10
diptendukar wants to merge 2 commits into
Conversation
The detector checked three of the five nginx CVEs fixed in 1.30.7 and 1.31.9. A host with HTTP/2 off and no resolver, but with a QUIC listener or a mail proxy, came back "not impacted" while still exposed. This adds the other two, in the same shape as the existing checks: - version: CVE-2026-121810 from 1.25.0, CVE-2026-113425 from 0.5.33. NGINX Plus fixes both in 37.0.8 / 37.3.0, with CVE-2026-123007 and CVE-2026-123634 (release notes for PLS.37.0.8.1 and PLS.37.3.0.1). - http/3: built with --with-http_v3_module, and a listen directive with the quic parameter in an http server{}. - mail: built with --with-mail (or --with-mail=dynamic), and a server{} in mail{}. The backport check needs no change: it already looks for each CVE that applies. Two existing fixtures contain a mail server and now report the mail CVE; their expectations are updated. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…pers - ansible-nginx-http2.yml runs the detector on every host in an inventory and collects the verdicts, like the JDK playbook. A verdict counts only when the detector's last line agrees with the exit code, as in the SSH wrapper. - k8s-exec-nginx-http2.sh runs the detector inside every running container with kubectl exec, for clusters that forbid the privileged DaemonSet. - The test harness gains a section that drives the SSH and kubectl exec wrappers through stand-ins for ssh and kubectl. It needs no Docker and runs under bash 3.2. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
| printf '=== %s/%s/%s (node %s) ===\nunknown: no bash in this container; use the DaemonSet (k8s-nginx-http2.yaml)\n' "$ns" "$pod" "$ctr" "$node" | ||
| unk=$((unk + 1)) | ||
| fi | ||
| IFS=$NL |
There was a problem hiding this comment.
🟡 Medium severity issue identified in your code:
Global IFS=$NL makes unquoted $LIST parsing depend on newline data, allowing injected records to control the kubectl exec target fields. An attacker who can influence LIST may redirect the detector to a chosen container and expose its output.
More details about this
IFS=$NL changes the shell’s global field-splitting rules before for line in $LIST. Because $LIST is expanded unquoted, every newline in its contents becomes a new line; each resulting line is then split by set -- $line after IFS is changed to a space. This makes the parsing of LIST depend on mutable global shell state and lets unexpected data create or reshape ns, pod, ctr, and node values used by kubectl exec.
A plausible attack is:
- An attacker causes the command that populates
LISTto include a newline in its output, followed byattacker-ns attacker-pod attacker-ctr attacker-node. - With
IFS=$NL,for line in $LISTtreats that injected text as a separate record. IFS=' 'andset -- $lineassign the attacker-controlled fields tons,pod,ctr, andnode.- The script then runs
kubectl exec -n "$ns" "$pod" -c "$ctr", causing the detector to access the attacker-selected container and potentially disclose its command output throughoutand the printed report. If the selected container is privileged or holds sensitive service-account permissions, the detector’s execution occurs in that security context.
To resolve this comment:
✨ Commit fix suggestion
- Remove the global
IFS=$NLassignments, including the finalIFS=' 'assignment. - Replace
for line in $LIST; dowith a line-oriented read loop:while IFS= read -r line; do. - Skip empty lines if
LISTcan contain them by adding[ -n "$line" ] || continue. - Replace
IFS=' 'followed byset -- $linewith a localreadassignment:IFS=' ' read -r ns pod ctr node <<< "$line". - Read the list without an unquoted expansion by closing the loop with
done < <(printf '%s' "$LIST"). TheIFSassignment applies only to the individualreadcommand, so later variable expansions retain normal shell behavior.
💬 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 ifs-tampering.
You can view more details about this finding in the Semgrep AppSec Platform.
|
Superseded by #11: same content, opened from my work account with signed commits. |
Extends the nginx detector merged in #8 from three CVEs to all five that nginx fixed in 1.30.7 and 1.31.9, and adds the two fleet wrappers the directory was missing. This replaces #9.
What it covered before
So a host with HTTP/2 off and no
resolver, but with a QUIC listener or a mail proxy, came backnot impactedwith exit 0 while still exposed. Fleet wrappers: SSH and the Kubernetes DaemonSet.What it covers now
All five. The two new checks follow the shape of the existing ones (version, backport, then the feature the bug is in):
--with-http_v3_module, and alistendirective with thequicparameter in an httpserver {}--with-mail(or--with-mail=dynamic), and aserver {}inmail {}Fleet wrappers: SSH, the Kubernetes DaemonSet, and now Ansible and
kubectl exec.What was added
Detector (
linux/detect-nginx-http2.sh)from_basenow starts at 0.5.33, the oldest of the five.quiclistener in an http server, and a server inmail {}.http/3andmail, withnot builtwhen the module is missing.New wrappers
linux/ansible-nginx-http2.yml: runs the detector on every host in an inventory and collects the verdicts, adapted from the JDK playbook. A verdict counts only when the detector's last line agrees with the exit code, as in the SSH wrapper.linux/k8s-exec-nginx-http2.sh: runs the detector inside every running container withkubectl exec, for clusters that forbid the privileged DaemonSet. It prints one line per container that is not impacted and the full output for the rest.Existing wrappers
ssh-nginx-http2.shandk8s-nginx-http2.yamlonly run the detector and read its verdict, so they cover all five with no logic change. Their header text and the SSH roll-up title now name five CVEs.Tests
--with-mail_ssl_modulealone does not count as the mail module).kubectl execwrappers through stand-ins forsshandkubectl. It needs no Docker.Docs: the directory README (tables, feature checks, output, remediation for the two CVEs, the new wrappers, sources), the root README row, and the workflow name. The workflow's shellcheck step also checks the new script.
Sample output
A real run inside the nginx.org Alpine image (nginx 1.30.6) with HTTP/2 off, no
resolver, a QUIC listener and an IMAP proxy. nginx accepted this config.Exit code 1. On main, the same kind of host ends in
=> OKandnot impacted, exit 0.Design notes
worker_connectionscan run out, matching how it treats the HTTP/2 use-after-free and nginx's own advisory wording.auth_http, and the same release fixed several mail code paths under this CVE.Tested
Run locally on Ubuntu 22.04 under WSL (x86_64, Docker):
--pid=hostscan.bash:3.2image): 106 pass.shellcheck -S warningis clean on all five scripts.Not verified
k8s-exec-nginx-http2.shwas tested against a stand-inkubectl, not a live cluster.🤖 Generated with Claude Code