Exploit databaseDownload repository ZIP
GH-ef1a4192a9489799de29cad3fb99875c
quaerendir/cve-2026-98432-audit
Sources for CVE-2026-98432
33 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files9
quaerendir/cve-2026-98432-auditRevision c4d75f251846
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
cve-2026-98432-audit.sh
Shell · 40,047 bytes#!/bin/bash
#
# cve-2026-98432-audit.sh
#
# Audit script for CVE-2026-98432
# Linux kernel IPv4 TCP handshake: inet_opt / ireq_opt freed without an RCU
# grace period -> use-after-free in ip_options_build(), reachable from the network
#
# Bug surface:
# tcp_v4_syn_recv_sock() hands ireq->ireq_opt over to the child socket
# (newinet->inet_opt) without copying it. A retransmitted SYN for the same
# request socket, processed on another CPU, builds a SYNACK from those
# options under rcu_read_lock() only. Since 079096f103fa ("tcp/dccp: install
# syn_recv requests into ehash table", 4.4) request sockets run without the
# listener lock, and the child's inet_opt is freed with a plain kfree()
# (CWE-416). A second race exists in request socket migration
# (net.ipv4.tcp_migrate_req=1 or a BPF_SK_REUSEPORT_SELECT_OR_MIGRATE
# program, c905dee62232). Upstream fix e3f33b0a1d89 ("ipv4: free inet_opt and
# ireq_opt after an RCU grace period", Eric Dumazet) switches both frees to
# kfree_rcu(). IPv6 is not affected by the first race; the IPv6 migration
# variant (CALIPSO ipv6_opt) is left to a separate patch.
#
# Trigger conditions on a target host:
# 1) Running kernel lacks the fix.
# 2) A TCP socket is listening and reachable over IPv4 (an AF_INET6 socket
# with IPV6_V6ONLY off also takes IPv4 SYNs), and the attacker can send
# SYNs that carry IP options and win a race across CPUs.
# The CNA scores it 9.8 (AC:L); Red Hat scores it 8.1 (AC:H) for the race.
#
# What this script does (read-only; no PoC execution, ever):
# - Inventories running kernel, distro, package state.
# - Looks for the fix in the running kernel package's changelog.
# - Compares the running kernel against verified upstream stable fixes and
# a per-distro fix matrix.
# - Enumerates TCP listeners in this network namespace (/proc/net/tcp{,6}):
# externally reachable, loopback-only, and possibly dual-stack.
# - Reads net.ipv4.tcp_migrate_req and reports container runtimes, whose
# published ports and private network namespaces this script cannot see.
# - Greps the kernel journal for oops signatures from the exposure window.
# - Computes a risk score and prints a verdict (PATCHED / MITIGATED /
# VULNERABLE / UNKNOWN / NOT_APPLICABLE).
# - Optional --json emits structured output for ingest.
#
# Author handle: Quaerendir
# License: MIT
# Tested intent: RHEL/Rocky/Alma/CentOS Stream, Debian, Ubuntu, Proxmox, Arch, Fedora.
#
# Usage:
# ./cve-2026-98432-audit.sh # text report
# ./cve-2026-98432-audit.sh --json # JSON report on stdout
# ./cve-2026-98432-audit.sh --since 2026-09-01 # change IoC hunt window
# ./cve-2026-98432-audit.sh --no-hunt # skip journal grep
# ./cve-2026-98432-audit.sh --quiet # only verdict + exit code
#
# Exit codes:
# 0 = PATCHED or NOT_APPLICABLE
# 1 = MITIGATED (no reachable IPv4 TCP listener right now, still patch)
# 2 = VULNERABLE (unfixed kernel and at least one reachable listener)
# 3 = UNKNOWN (cannot determine; treat as suspect)
# 4 = ERROR (script could not run; bad env / missing tools)
#
# This script intentionally never loads modules, never runs the PoC, never
# opens a socket, and never modifies sysctl, firewall rules, or any other state.
#
set -u
set -o pipefail
# Pinned PATH for the external commands below. It cannot protect the
# interpreter itself, which is why the shebang is /bin/bash, not env.
PATH=/usr/sbin:/usr/bin:/sbin:/bin
# Test hook: tests/run_tests.sh prepends its mock_bin/ here. Never honoured
# for root, so the pinned PATH above still holds for real audits.
if [ -n "${CVE_2026_98432_TEST_PATH:-}" ] && [ "${EUID:-0}" -ne 0 ]; then
PATH="${CVE_2026_98432_TEST_PATH}:${PATH}"
fi
LC_ALL=C
export PATH LC_ALL
VERSION="1.1.0"
# Snapshot date of the distro fix matrix below, and how many days after it the
# report starts warning that vendors may have shipped fixes since.
MATRIX_DATE="2026-11-16"
MATRIX_STALE_DAYS=14
# Today's date (YYYY-MM-DD). The test hook is ignored for root, like the others.
TODAY="$(date -u +%Y-%m-%d 2>/dev/null || true)"
if [ -n "${CVE_2026_98432_TEST_TODAY:-}" ] && [ "${EUID:-0}" -ne 0 ]; then
TODAY="${CVE_2026_98432_TEST_TODAY}"
fi
# Every file the audit reads lives under $R. Empty on a real host; the tests
# point it at a fixture tree. Like the PATH hook, ignored for root.
R=""
if [ -n "${CVE_2026_98432_TEST_ROOT:-}" ] && [ "${EUID:-0}" -ne 0 ]; then
R="${CVE_2026_98432_TEST_ROOT}"
fi
# ------------------------------------------------------------------ banner
print_banner() {
# Disable colour if not a TTY or NO_COLOR set, per CLICOLOR convention.
local C0="" C1="" C2="" C3=""
if [ -t 1 ] && [ -z "${NO_COLOR:-}" ]; then
C0=$'\033[0m' # reset
C1=$'\033[1;31m' # bright red - title
C2=$'\033[1;33m' # bright yellow - diagram
C3=$'\033[0;36m' # cyan - subtitle
fi
cat <<BANNER
${C1}
+-----------------------------------------------------------+
| CVE-2026-98432 ipv4 inet_opt / ireq_opt use-after-free |
+-----------------------------------------------------------+
${C0}${C3} Linux TCP handshake: SYN-ACK built from freed IP options
${C3} audit script ${VERSION}${C0} by Quaerendir
${C2}
CPU0: tcp_v4_syn_recv_sock() child takes ireq_opt, later kfree()
CPU1: tcp_v4_send_synack() reads the same options <-- freed
${C0}
BANNER
}
# ------------------------------------------------------------------ helpers
say() { [ "$QUIET" -eq 1 ] && return 0; [ "$JSON" -eq 1 ] && return 0; printf '%s\n' "$*"; }
hdr() { say ""; say "== $* =="; }
kv() { say " $1: $2"; }
warn() { say " ! $*"; }
ok() { say " + $*"; }
bad() { say " - $*"; }
have() { command -v "$1" >/dev/null 2>&1; }
# True when stdin has a line matching the extended regex $1. It counts instead
# of using grep -q: under pipefail, grep -q leaving at the first hit kills the
# writer with SIGPIPE and the pipeline then reads as "no match" - every time
# for a kernel changelog, which runs to a megabyte.
has_match() {
local n
n="$(grep -ciE "$1" 2>/dev/null)" || true
[ "${n:-0}" -gt 0 ]
}
# JSON accumulator (flat dict)
declare -A J
jset() { J["$1"]="$2"; }
# Compare two dpkg/rpm-style package versions. Returns 0 if $1 >= $2.
ver_ge() {
if have dpkg; then
dpkg --compare-versions "$1" ge "$2" 2>/dev/null && return 0 || return 1
fi
local smaller
smaller="$(printf '%s\n%s\n' "$1" "$2" | sort -V | head -n1)"
[ "$smaller" = "$2" ]
}
# Days since 1970-01-01 for a YYYY-MM-DD date (proleptic Gregorian, pure bash:
# GNU `date -d` is missing on busybox and BSD). Prints nothing if malformed.
civil_days() {
[[ "$1" =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2})$ ]] || return 1
local y=$((10#${BASH_REMATCH[1]})) m=$((10#${BASH_REMATCH[2]})) d=$((10#${BASH_REMATCH[3]}))
{ [ "$m" -ge 1 ] && [ "$m" -le 12 ] && [ "$d" -ge 1 ] && [ "$d" -le 31 ]; } || return 1
[ "$m" -le 2 ] && y=$((y-1))
local era=$((y / 400)) yoe doy mp
yoe=$((y - era*400))
mp=$(( (m + 9) % 12 ))
doy=$(( (153*mp + 2)/5 + d - 1 ))
echo $(( era*146097 + yoe*365 + yoe/4 - yoe/100 + doy - 719468 ))
}
# Split a kernel release such as 6.12.113+deb13-amd64, 7.3.0-rc6-1-mainline
# or 5.14.0-611.el9.x86_64 into "major minor patch rc" (rc=999 when the
# release is not an -rc). Prints nothing if the string is not a kernel release.
# The rc marker is "rc<N>" not preceded by a letter, which also covers the
# Ubuntu mainline builds (7.3.0-070300rc5-generic) and Fedora rawhide
# (7.3.0-0.rc5.20261001git...fc44); a plain "-rc" test read both as final.
kparse() {
local s="$1" maj min pat rc
if [[ "$s" =~ ^([0-9]+)\.([0-9]+)(\.([0-9]+))? ]]; then
maj="${BASH_REMATCH[1]}"; min="${BASH_REMATCH[2]}"; pat="${BASH_REMATCH[4]:-0}"
else
return 1
fi
rc=999
if [[ "$s" =~ (^|[^a-zA-Z])rc([0-9]+) ]]; then rc="${BASH_REMATCH[2]}"; fi
printf '%d %d %d %d\n' "$maj" "$min" "$pat" "$rc"
}
# Returns 0 if kernel release $1 >= $2 (both in any form kparse accepts).
kernel_ver_ge() {
local pa pb i
local -a a b
pa="$(kparse "$1")" || return 1
pb="$(kparse "$2")" || return 1
read -ra a <<< "$pa"
read -ra b <<< "$pb"
for i in 0 1 2 3; do
[ "${a[i]}" -gt "${b[i]}" ] && return 0
[ "${a[i]}" -lt "${b[i]}" ] && return 1
done
return 0
}
# Proxmox kernels are built on Ubuntu kernel sources and their changelog says
# which ("update sources to Ubuntu-7.0.0-43.43"), usually without naming the
# CVEs that arrived with the update. Prints the newest base the changelog on
# stdin was updated to. "pick relevant commits from Ubuntu-..." is not one.
pve_ubuntu_base() {
grep -iE 'update [a-z ]*to Ubuntu-' 2>/dev/null \
| grep -oE 'Ubuntu-(hwe-[0-9.]+-)?[0-9]+\.[0-9]+\.[0-9]+-[0-9]+\.[0-9]+' \
| sed -E 's/^Ubuntu-(hwe-[0-9.]+-)?//' | sort -V | tail -n1
}
# First fixed Ubuntu "linux" build for the kernel base $1 (7.0.0, 6.8.0, ...).
ubuntu_base_fix() {
case "$1" in
7.3.0) echo "7.3.0-10.10" ;;
7.0.0) echo "7.0.0-43.43" ;;
6.8.0) echo "6.8.0-149.149" ;;
5.15.0) echo "5.15.0-203.213" ;;
esac
}
# Upstream fix status for a vanilla / rolling kernel. Verified against the
# kernel.org stable ChangeLogs on 2026-10-29: the first release in each
# branch that carries "ipv4: free inet_opt and ireq_opt after an RCU grace
# period" (the release before it does not). Mainline: 7.3-rc7 (rc6 lacks it).
# 5.10.272 b3b027ef0cd3 5.15.223 95a8c8fa9f27 6.1.190 89b5b1eb7d63
# 6.6.159 742f73df544e 6.12.113 11a03ce3c4a6 6.18.56 a47406c769f7
# 7.2.10 26d4c36d318c 7.3-rc7 e3f33b0a1d89
# Series with no row (4.x, 5.4, 6.2-6.5, 6.7-6.11, 6.13-6.17, 6.19, 7.0, 7.1)
# are EOL and carry the bug. Sets UP_STATUS / UP_DETAIL.
upstream_status() {
local krel="$1" p maj min pat fix=""
UP_STATUS="UNKNOWN"; UP_DETAIL="cannot parse kernel release ${krel}"
p="$(kparse "$krel")" || return 0
read -r maj min pat _ <<< "$p"
if kernel_ver_ge "$krel" "7.3.0-rc7"; then
UP_STATUS="PATCHED"; UP_DETAIL="${krel} >= 7.3-rc7 (mainline fix)"
return 0
fi
if ! kernel_ver_ge "$krel" "4.4.0"; then
UP_STATUS="NOT_APPLICABLE"; UP_DETAIL="${krel} predates the syn_recv ehash change (4.4)"
return 0
fi
case "${maj}.${min}" in
5.10) fix=272 ;;
5.15) fix=223 ;;
6.1) fix=190 ;;
6.6) fix=159 ;;
6.12) fix=113 ;;
6.18) fix=56 ;;
7.2) fix=10 ;;
esac
if [ -n "$fix" ]; then
if [ "$pat" -ge "$fix" ]; then
UP_STATUS="PATCHED"; UP_DETAIL="${krel} >= ${maj}.${min}.${fix} (stable fix)"
else
UP_STATUS="VULNERABLE"; UP_DETAIL="${krel} < ${maj}.${min}.${fix} (stable fix)"
fi
else
UP_STATUS="VULNERABLE"
UP_DETAIL="${krel}: series ${maj}.${min} got no stable backport (EOL or pre-7.3-rc7 mainline)"
fi
}
# Byte order of this machine's /proc/net/tcp addresses: they are printed as a
# host-order u32, so the first octet is the last hex pair on little-endian.
is_little_endian() {
have od || return 0
[ "$(printf 'I' | od -to2 2>/dev/null | head -n1 | awk '{print substr($2,6,1)}')" = "1" ]
}
# First octet of an 8-hex-digit /proc/net/tcp address.
first_octet_hex() {
if [ "$LITTLE_ENDIAN" -eq 1 ]; then printf '%s' "${1:6:2}"; else printf '%s' "${1:0:2}"; fi
}
# Walk the TCP listeners of this network namespace. State 0A is LISTEN.
# external : IPv4 listener on a non-loopback address (incl. 0.0.0.0), or an
# IPv6 wildcard listener when net.ipv6.bindv6only=0 (dual-stack)
# loopback : IPv4 listener on 127.0.0.0/8 only
# v6_only_possible: IPv6 wildcard listeners that bindv6only=1 may keep off
# IPv4 (an application can still clear IPV6_V6ONLY, so not a block)
# Sets LISTEN_STATE (ok/unreadable) LISTEN_EXT LISTEN_LO LISTEN_V6W and
# LISTEN_EXT_PORTS (sorted, unique).
scan_listeners() {
LISTEN_STATE="unreadable"; LISTEN_EXT=0; LISTEN_LO=0; LISTEN_V6W=0; LISTEN_EXT_PORTS=""
local kind addr a6 port oct ports="" ext_seen=" " lo_seen=" " v6_seen=" " any=0 f
for f in tcp tcp6; do
[ -r "$R/proc/net/$f" ] && any=1
done
[ "$any" -eq 1 ] || return 0
LISTEN_STATE="ok"
while read -r kind addr; do
[ -n "$addr" ] || continue
a6="${addr%%:*}"
port="$((16#${addr##*:}))"
if [ "$kind" = "4" ]; then
oct="$(first_octet_hex "$a6")"
if [ "$oct" = "7F" ] || [ "$oct" = "7f" ]; then
case "$lo_seen" in *" $port "*) ;; *) lo_seen="$lo_seen$port "; LISTEN_LO=$((LISTEN_LO+1)) ;; esac
else
case "$ext_seen" in *" $port "*) ;; *) ext_seen="$ext_seen$port "; LISTEN_EXT=$((LISTEN_EXT+1)); ports="$ports $port" ;; esac
fi
else
# Only the IPv6 wildcard can take IPv4 SYNs without an explicit mapping.
if [ "$a6" = "00000000000000000000000000000000" ]; then
case "$v6_seen" in *" $port "*) ;; *) v6_seen="$v6_seen$port "; LISTEN_V6W=$((LISTEN_V6W+1)) ;; esac
fi
fi
done < <(
{ [ -r "$R/proc/net/tcp" ] && awk 'NR>1 && $4=="0A" {print "4", $2}' "$R/proc/net/tcp"
[ -r "$R/proc/net/tcp6" ] && awk 'NR>1 && $4=="0A" {print "6", $2}' "$R/proc/net/tcp6"
} 2>/dev/null
)
# An IPv6 wildcard listener is dual-stack unless bindv6only=1, and a port
# already counted through its IPv4 twin is not counted twice.
if [ "$BINDV6ONLY" != "1" ]; then
local p
for p in $v6_seen; do
case "$ext_seen" in *" $p "*) ;; *) ext_seen="$ext_seen$p "; LISTEN_EXT=$((LISTEN_EXT+1)); ports="$ports $p" ;; esac
done
fi
LISTEN_EXT_PORTS="$(printf '%s\n' $ports | sort -n | uniq | tr '\n' ' ' | sed 's/ $//')"
}
main() {
# ------------------------------------------------------------------ args
JSON=0
QUIET=0
HUNT=1
BANNER=1
SINCE="2026-09-25" # CVE ID reserved; exploitation may predate the 2026-10-15 publication
UNTIL=""
while [ $# -gt 0 ]; do
local arg="$1"
case "$arg" in
--json) JSON=1; BANNER=0 ;;
--quiet) QUIET=1; BANNER=0 ;;
--no-hunt) HUNT=0 ;;
--no-banner) BANNER=0 ;;
--since=*) SINCE="${arg#--since=}" ;;
--since) shift; SINCE="${1:-$SINCE}" ;;
--until=*) UNTIL="${arg#--until=}" ;;
--until) shift; UNTIL="${1:-$UNTIL}" ;;
--version) printf '%s\n' "cve-2026-98432-audit.sh ${VERSION}"; exit 0 ;;
-h|--help)
sed -n '2,63p' "$0"; exit 0 ;;
-*)
printf 'ERROR: unknown option %s\n' "$arg" >&2
exit 4 ;;
*)
printf 'ERROR: unexpected argument %s\n' "$arg" >&2
exit 4 ;;
esac
shift
done
# Associative arrays and [[ =~ ]] with BASH_REMATCH need bash 4+.
if [ "${BASH_VERSINFO[0]:-0}" -lt 4 ]; then
printf 'ERROR: requires bash >= 4 (found %s)\n' "${BASH_VERSION:-non-bash}" >&2
exit 4
fi
# Sanity-check a minimal tool set. Exit code 4 is documented in the header.
for _tool in uname grep awk sed sort uniq tr sysctl; do
if ! have "$_tool"; then
printf 'ERROR: required tool %s is missing\n' "$_tool" >&2
exit 4
fi
done
[ "$BANNER" -eq 1 ] && print_banner
# ------------------------------------------------------------------ inventory
KREL="$(uname -r 2>/dev/null || echo unknown)"
KVER="$(uname -v 2>/dev/null || echo unknown)"
KMACH="$(uname -m 2>/dev/null || echo unknown)"
HOST="$(uname -n 2>/dev/null || echo unknown)"
jset kernel_release "$KREL"
jset kernel_version "$KVER"
jset arch "$KMACH"
jset hostname "$HOST"
OS_ID=""; OS_VER=""; OS_PRETTY=""
OS_RELEASE_FILE="$R/etc/os-release"
if [ -r "$OS_RELEASE_FILE" ]; then
# Parsed as plain key=value text, not sourced - /etc/os-release is
# shell syntax and sourcing it would execute arbitrary embedded code.
OS_ID="$(sed -n 's/^ID=//p' "$OS_RELEASE_FILE" | head -n1 | tr -d '"'"'"'')"
OS_VER="$(sed -n 's/^VERSION_ID=//p' "$OS_RELEASE_FILE" | head -n1 | tr -d '"'"'"'')"
OS_PRETTY="$(sed -n 's/^PRETTY_NAME=//p' "$OS_RELEASE_FILE" | head -n1 | tr -d '"'"'"'')"
fi
jset distro_id "$OS_ID"
jset distro_version "$OS_VER"
jset distro_pretty "$OS_PRETTY"
IN_CONTAINER=0
if [ -e "$R/.dockerenv" ] || [ -e "$R/run/.containerenv" ]; then
IN_CONTAINER=1
fi
jset in_container "$IN_CONTAINER"
hdr "Host inventory"
kv "host" "$HOST"
kv "kernel release" "$KREL"
kv "kernel build" "$KVER"
kv "arch" "$KMACH"
kv "distro" "${OS_PRETTY:-unknown}"
[ "$IN_CONTAINER" -eq 1 ] && warn "running inside a container: the kernel belongs to the host, audit the host instead"
MODDIR="$R/lib/modules/${KREL}"
HAVE_MODULES_DEP=0
[ -f "$MODDIR/modules.dep" ] && HAVE_MODULES_DEP=1
jset module_tree_present "$HAVE_MODULES_DEP"
# ------------------------------------------------------------------ kernel package
PKG_KERNEL_NAME=""
PKG_KERNEL_VERSION=""
PKG_KIND=""
PKG_LINE=""
if have dpkg; then
# Prefer the package for the running kernel; the newest image is only a
# fallback for variant names that don't embed KREL. Proxmox VE ships its
# kernels as proxmox-kernel-<release>-signed or proxmox-kernel-<release>
# (older: pve-kernel-<release>).
PKG_LINE="$(dpkg -l "linux-image-${KREL}" "linux-image-unsigned-${KREL}" \
"proxmox-kernel-${KREL}-signed" "proxmox-kernel-${KREL}" "pve-kernel-${KREL}" 2>/dev/null \
| awk '/^ii/ {print $2" "$3}' | head -n1 || true)"
if [ -z "$PKG_LINE" ]; then
PKG_LINE="$(dpkg -l 'linux-image-*' 2>/dev/null \
| awk '/^ii/ && $2 ~ /linux-image-(unsigned-)?[0-9]/ {print $2" "$3}' \
| grep -F "${KREL}" | sort -V | tail -n1 || true)"
fi
[ -n "$PKG_LINE" ] && PKG_KIND="deb"
fi
if [ -z "$PKG_LINE" ] && have rpm; then
# RPM-family: the package that owns the running module tree.
if [ "$HAVE_MODULES_DEP" -eq 1 ]; then
PKG_LINE="$(rpm -qf "/lib/modules/${KREL}/modules.dep" --qf '%{NAME} %{VERSION}-%{RELEASE}.%{ARCH}\n' 2>/dev/null | head -n1 || true)"
fi
if [ -z "$PKG_LINE" ]; then
PKG_LINE="$(rpm -qa --qf '%{NAME} %{VERSION}-%{RELEASE}.%{ARCH}\n' kernel kernel-core kernel-default 2>/dev/null \
| grep -F "${KREL%.*}" | sort -V | tail -n1 || true)"
fi
[ -n "$PKG_LINE" ] && PKG_KIND="rpm"
fi
if [ -n "$PKG_LINE" ]; then
PKG_KERNEL_NAME="$(printf '%s' "$PKG_LINE" | awk '{print $1}')"
PKG_KERNEL_VERSION="$(printf '%s' "$PKG_LINE" | awk '{print $2}')"
fi
jset kernel_package_name "$PKG_KERNEL_NAME"
jset kernel_package_version "$PKG_KERNEL_VERSION"
# Look for the fix in the running kernel package's changelog: either the
# CVE ID (Red Hat, Ubuntu, SUSE) or the upstream subject (Debian and Ubuntu
# list stable shortlogs). States: fixed / absent / unreadable.
FIX_RE='CVE-2026-98432|free inet_opt and ireq_opt after an RCU grace period'
CHANGELOG_STATE="unreadable"
CHANGELOG_SRC=""
CHANGELOG_PKG="" # source package named in the changelog header (linux, linux-hwe-6.8, proxmox-kernel-6.8)
CHANGELOG_VER="" # its newest version
if [ "$PKG_KIND" = "deb" ]; then
# linux-modules-$KREL comes first: on Ubuntu the signed linux-image-$KREL
# ships the linux-signed changelog ("Main version: ..."), which names no
# CVE, and the kernel's own changelog is in the modules package. Any
# readable candidate can show the fix; a signing wrapper cannot show that
# it is missing.
for d in "linux-modules-${KREL}" "$PKG_KERNEL_NAME" "linux-image-${KREL}" "linux-image-unsigned-${KREL}"; do
f="$R/usr/share/doc/${d}/changelog.Debian.gz"
[ -r "$f" ] || continue
cl_head="$(zcat "$f" 2>/dev/null | sed -n '1p')"
cl_pkg="${cl_head%% *}"
cl_ver=""
if [[ "$cl_head" =~ \(([^\)]+)\) ]]; then cl_ver="${BASH_REMATCH[1]}"; fi
if zcat "$f" 2>/dev/null | has_match "$FIX_RE"; then
CHANGELOG_STATE="fixed"; CHANGELOG_SRC="$f"
case "$cl_pkg" in linux-signed*) ;; *) CHANGELOG_PKG="$cl_pkg"; CHANGELOG_VER="$cl_ver" ;; esac
break
fi
case "$cl_pkg" in linux-signed*) continue ;; esac
if [ "$CHANGELOG_STATE" = "unreadable" ]; then
CHANGELOG_STATE="absent"; CHANGELOG_SRC="$f"; CHANGELOG_PKG="$cl_pkg"; CHANGELOG_VER="$cl_ver"
fi
done
elif [ "$PKG_KIND" = "rpm" ]; then
CL="$(rpm -q --changelog "${PKG_KERNEL_NAME}-${PKG_KERNEL_VERSION}" 2>/dev/null || true)"
if [ -n "$CL" ]; then
CHANGELOG_SRC="rpm -q --changelog ${PKG_KERNEL_NAME}-${PKG_KERNEL_VERSION}"
if printf '%s\n' "$CL" | has_match "$FIX_RE"; then
CHANGELOG_STATE="fixed"
else
CHANGELOG_STATE="absent"
fi
fi
fi
jset changelog_state "$CHANGELOG_STATE"
jset changelog_source "$CHANGELOG_SRC"
jset changelog_package "$CHANGELOG_PKG"
hdr "Kernel package"
kv "package" "${PKG_KERNEL_NAME:-<not detected>}"
kv "version" "${PKG_KERNEL_VERSION:-<not detected>}"
case "$CHANGELOG_STATE" in
fixed) ok "changelog lists the fix (${CHANGELOG_SRC})" ;;
absent) bad "changelog does not mention the fix (${CHANGELOG_SRC})" ;;
unreadable) say " . no changelog available for the running kernel package" ;;
esac
# ------------------------------------------------------------------ vendor fix heuristic
hdr "Vendor patch status"
#
# Distro fix matrix snapshot, 2026-11-16 (CVE public 2026-10-15). A fix
# found in the changelog always wins; the matrix only decides otherwise.
# A status here clears the verdict only with a concrete threshold. Where
# builds differ per stream or flavour, the changelog decides: VULNERABLE when
# it was readable and lacks the fix, else UNKNOWN.
# Debian: security-tracker.debian.org: bookworm 6.1.190-1 (DLA-4841-1),
# trixie 6.12.113-1 (DSA-6568-1), unstable 7.2.10-1
# Ubuntu: ubuntu.com/security/CVE-2026-98432, source package "linux" only:
# 26.10 7.3.0-10.10, 26.04 7.0.0-43.43, 24.04 6.8.0-149.149,
# 22.04 5.15.0-203.213; 20.04/18.04/16.04 pending; the 14.04 3.13
# kernel is not affected. Flavours and HWE kernels have their own
# version lines, so for them only the changelog can tell.
# Red Hat: RHEL 6/7 not affected; RHEL 8 4.18.0-553.182.1.el8_10
# (RHSA-2026:93414), RHEL 9 5.14.0-687.64.1.el9_8 (RHSA-2026:93412),
# RHEL 10 6.12.0-211.72.1.el10_2 (RHSA-2026:93413); EUS/AUS streams
# carry other builds, so the changelog decides
# Proxmox: its changelog names the Ubuntu kernel it is built on, which is
# compared with the Ubuntu rows above (git.proxmox.com, pve-kernel:
# 7.0.14 builds are on Ubuntu-7.0.0-43.43; neither CVE is named)
#
vendor_status="UNKNOWN"
vendor_detail="no matching rule for distro+release"
UP_STATUS=""; UP_DETAIL=""
upstream_status "$KREL"
changelog_decides() {
# $1 = vendor statement. Unreadable changelog -> UNKNOWN, see above.
if [ "$CHANGELOG_STATE" = "absent" ]; then
vendor_status="VULNERABLE"; vendor_detail="$1; running kernel changelog lacks the fix"
else
vendor_status="UNKNOWN"; vendor_detail="$1; changelog not readable, verify manually"
fi
}
if [ "$IN_CONTAINER" -eq 1 ]; then
vendor_status="UNKNOWN"
vendor_detail="inside a container: package data describes the image, not the host kernel"
elif [ "$CHANGELOG_STATE" = "fixed" ]; then
vendor_status="PATCHED"
vendor_detail="fix listed in ${PKG_KERNEL_NAME} ${PKG_KERNEL_VERSION} changelog"
elif [[ "$KREL" == *microsoft-standard-WSL2* ]]; then
# The WSL2 kernel is Microsoft's own build of upstream stable, whatever the
# distro inside says, and it is updated through Windows (wsl --update).
vendor_status="$UP_STATUS"; vendor_detail="WSL2 kernel (follows upstream stable): $UP_DETAIL"
else
case "${OS_ID,,}" in
debian)
fixed_min=""; series=""
if [[ "$KREL" == *-pve ]] || [[ "$PKG_KERNEL_NAME" == proxmox-kernel-* ]] || [[ "$PKG_KERNEL_NAME" == pve-kernel-* ]]; then
# Proxmox reports ID=debian but its kernel is a separate Ubuntu-based
# series: the Debian matrix does not apply to it. The Ubuntu base
# named in its changelog is compared with Ubuntu's fixed build.
pve_base=""
case "$CHANGELOG_SRC" in
*.gz) pve_base="$(zcat "$CHANGELOG_SRC" 2>/dev/null | pve_ubuntu_base)" ;;
esac
pve_fix="$(ubuntu_base_fix "${pve_base%%-*}")"
if [ -n "$pve_fix" ] && ver_ge "$pve_base" "$pve_fix"; then
vendor_status="PATCHED"
vendor_detail="Proxmox VE kernel ${KREL} is built on Ubuntu-${pve_base} >= fixed ${pve_fix}"
elif [ -n "$pve_fix" ]; then
changelog_decides "Proxmox VE kernel ${KREL}: built on Ubuntu-${pve_base}, older than the fixed ${pve_fix}"
else
changelog_decides "Proxmox VE kernel ${KREL}: not in the Debian matrix${pve_base:+, Ubuntu base ${pve_base} has no fixed Ubuntu build}; check the Proxmox security advisories"
fi
else
case "${OS_VER%%.*}" in
13) fixed_min="6.12.113-1"; series="6.12" ;;
12) fixed_min="6.1.190-1"; series="6.1" ;;
11) vendor_detail="Debian bullseye: not in the security tracker table, check Debian LTS (5.10 needs >= 5.10.272)" ;;
"") fixed_min="7.2.10-1" ;; # testing/sid have no VERSION_ID
*) vendor_detail="unrecognised Debian release: ${OS_VER}" ;;
esac
fi
if [ -n "$fixed_min" ]; then
if [ -z "$PKG_KERNEL_VERSION" ]; then
vendor_detail="Debian: fixed in ${fixed_min}, but the running kernel package was not found"
elif [ -n "$series" ] && [[ "$PKG_KERNEL_VERSION" != "$series".* ]]; then
# A backports (or other-series) kernel: its version is not
# comparable with the stock one, but Debian tracks stable upstream.
vendor_status="$UP_STATUS"
vendor_detail="package ${PKG_KERNEL_VERSION} is not the stock ${series}.x series; upstream: ${UP_DETAIL}"
elif ver_ge "$PKG_KERNEL_VERSION" "$fixed_min"; then
vendor_status="PATCHED"; vendor_detail="installed ${PKG_KERNEL_VERSION} >= fixed ${fixed_min}"
else
vendor_status="VULNERABLE"; vendor_detail="installed ${PKG_KERNEL_VERSION} < fixed ${fixed_min}"
fi
fi
;;
ubuntu)
# Versions of the source package "linux" only (named in the changelog
# header). Ubuntu keeps the last 10 uploads in a package changelog, so
# for "linux" the version still decides once the entry has scrolled out.
ufix=""
case "$OS_VER" in
26.10) ufix="7.3.0-10.10" ;;
26.04) ufix="7.0.0-43.43" ;;
24.04) ufix="6.8.0-149.149" ;;
22.04) ufix="5.15.0-203.213" ;;
esac
if [ -n "$ufix" ] && [ "$CHANGELOG_PKG" = "linux" ] && [ "${CHANGELOG_VER%%-*}" = "${ufix%%-*}" ]; then
if ver_ge "$CHANGELOG_VER" "$ufix"; then
vendor_status="PATCHED"; vendor_detail="linux ${CHANGELOG_VER} >= fixed ${ufix} (Ubuntu ${OS_VER})"
else
vendor_status="VULNERABLE"; vendor_detail="linux ${CHANGELOG_VER} < fixed ${ufix} (Ubuntu ${OS_VER})"
fi
elif [ -n "$ufix" ]; then
changelog_decides "Ubuntu ${OS_VER}, kernel source ${CHANGELOG_PKG:-not identified}: fixed builds differ per flavour, see ubuntu.com/security/CVE-2026-98432"
elif [ "$OS_VER" = "14.04" ]; then
# Left UNKNOWN on purpose: the upstream cross-check below clears the
# stock 3.13 kernel and leaves an lts-xenial 4.4 kernel suspect.
vendor_detail="Ubuntu 14.04: the 3.13 kernel is not affected per Ubuntu"
else
changelog_decides "Ubuntu ${OS_VER}: no fixed kernel released as of ${MATRIX_DATE}"
fi
;;
rhel|centos|rocky|almalinux|ol)
if [[ "$KREL" == *uek* ]]; then
vendor_detail="Oracle UEK kernel: not covered by the Red Hat matrix, check linux.oracle.com"
else
case "${OS_VER%%.*}" in
# Left UNKNOWN on purpose: the upstream cross-check below clears the
# stock 2.6.32 / 3.10 kernels and leaves any other kernel suspect.
6|7) vendor_detail="EL ${OS_VER%%.*}: the stock kernel is not affected per Red Hat" ;;
8) changelog_decides "EL 8: fixed in 4.18.0-553.182.1.el8_10 (RHSA-2026:93414), other builds on EUS/AUS streams" ;;
9) changelog_decides "EL 9: fixed in 5.14.0-687.64.1.el9_8 (RHSA-2026:93412), other builds on EUS streams" ;;
10) changelog_decides "EL 10: fixed in 6.12.0-211.72.1.el10_2 (RHSA-2026:93413), other builds on EUS streams" ;;
*) vendor_detail="unrecognised EL major: ${OS_VER}" ;;
esac
fi
;;
arch|manjaro|endeavouros|fedora)
# These ship upstream stable releases, so the kernel.org table applies.
vendor_status="$UP_STATUS"; vendor_detail="upstream: $UP_DETAIL"
;;
*)
vendor_detail="distro '${OS_ID}' not in matrix; changelog ${CHANGELOG_STATE}"
;;
esac
# Upstream cross-check that holds for any kernel: a 7.3-rc7+ base already
# carries the fix, and a pre-4.4 one never had the bug.
if [ "$UP_STATUS" = "PATCHED" ] && kernel_ver_ge "$KREL" "7.3.0-rc7"; then
vendor_status="PATCHED"; vendor_detail="upstream: $UP_DETAIL"
elif [ "$UP_STATUS" = "NOT_APPLICABLE" ] && [ "$vendor_status" = "UNKNOWN" ]; then
vendor_status="NOT_APPLICABLE"; vendor_detail="$UP_DETAIL"
fi
fi
jset upstream_status "$UP_STATUS"
jset upstream_detail "$UP_DETAIL"
jset vendor_status "$vendor_status"
jset vendor_detail "$vendor_detail"
kv "verdict" "$vendor_status"
kv "detail" "$vendor_detail"
kv "upstream (vanilla/stable kernels only)" "${UP_STATUS}: ${UP_DETAIL}"
# Matrix freshness. Distro rows go out of date as vendors ship fixes, so an
# old copy of this script can call a long-patched kernel "fix in progress".
# The upstream thresholds and the changelog check do not age.
MATRIX_AGE="unknown"; MATRIX_STALE=0
if d0="$(civil_days "$MATRIX_DATE")" && d1="$(civil_days "$TODAY")"; then
MATRIX_AGE=$((d1 - d0))
[ "$MATRIX_AGE" -gt "$MATRIX_STALE_DAYS" ] && MATRIX_STALE=1
fi
jset matrix_date "$MATRIX_DATE"
jset matrix_age_days "$MATRIX_AGE"
jset matrix_stale "$MATRIX_STALE"
if [ "$MATRIX_STALE" -eq 1 ]; then
warn "distro fix matrix is ${MATRIX_AGE} days old (snapshot ${MATRIX_DATE}): vendors may have shipped fixes since; update this script. Changelog and upstream checks are unaffected."
elif [ "$MATRIX_AGE" = "unknown" ]; then
say " . could not date the fix matrix (snapshot ${MATRIX_DATE}); check the date on this host"
else
kv "fix matrix snapshot" "${MATRIX_DATE} (${MATRIX_AGE} days old)"
fi
# ------------------------------------------------------------------ listeners
hdr "TCP listener exposure"
BINDV6ONLY="$(sysctl -n net.ipv6.bindv6only 2>/dev/null || echo unknown)"
MIGRATE_REQ="$(sysctl -n net.ipv4.tcp_migrate_req 2>/dev/null || echo unknown)"
jset bindv6only "$BINDV6ONLY"
jset tcp_migrate_req "$MIGRATE_REQ"
LITTLE_ENDIAN=1
is_little_endian || LITTLE_ENDIAN=0
scan_listeners
jset listeners_scan "$LISTEN_STATE"
jset listeners_external "$LISTEN_EXT"
jset listeners_loopback "$LISTEN_LO"
jset listeners_ipv6_wildcard "$LISTEN_V6W"
jset listener_ports_external "$LISTEN_EXT_PORTS"
PS_OUT="$(ps -eo comm= 2>/dev/null || true)"
CTR_PROCS="$(printf '%s\n' "$PS_OUT" | grep -cE '^(dockerd|containerd|containerd-shim.*|crio|conmon|podman)$' || true)"
jset container_runtime_processes "$CTR_PROCS"
case "$LISTEN_STATE" in
ok)
kv "reachable over IPv4 (not loopback)" "$LISTEN_EXT${LISTEN_EXT_PORTS:+ (ports: ${LISTEN_EXT_PORTS})}"
kv "loopback only" "$LISTEN_LO"
kv "IPv6 wildcard listeners" "$LISTEN_V6W (net.ipv6.bindv6only=${BINDV6ONLY}; dual-stack counted as reachable unless it is 1)"
;;
unreadable)
warn "/proc/net/tcp is not readable: cannot enumerate listeners, assuming exposed"
;;
esac
kv "net.ipv4.tcp_migrate_req" "$MIGRATE_REQ"
if [ "$MIGRATE_REQ" = "1" ]; then
bad "tcp_migrate_req=1: the request-socket migration race is enabled (default is 0)"
fi
if [ "$CTR_PROCS" -gt 0 ]; then
warn "container runtime active: published ports and private network namespaces are not visible from here"
fi
# A listener is the only way to get a request socket, so no reachable listener
# means nothing to race. The network path is any externally reachable listener
# (or one this script cannot see); the local path is a loopback-only listener,
# which any local user can connect to and set IP options on.
NET_PATH=0
LOCAL_PATH=0
if [ "$LISTEN_STATE" != "ok" ] || [ "$LISTEN_EXT" -gt 0 ] || [ "$CTR_PROCS" -gt 0 ]; then
NET_PATH=1
fi
if [ "$LISTEN_LO" -gt 0 ]; then
LOCAL_PATH=1
fi
jset network_path_reachable "$NET_PATH"
jset local_path_reachable "$LOCAL_PATH"
hdr "Entry paths"
if [ "$NET_PATH" -eq 1 ]; then bad "network: an IPv4 TCP listener can receive SYNs from other hosts"; else ok "network: no externally reachable IPv4 TCP listener in this namespace"; fi
if [ "$LOCAL_PATH" -eq 1 ]; then bad "local: loopback-only listener reachable by any local user"; else ok "local: no loopback-only listener"; fi
say " . a local user can also open a listener in a private user+network namespace;"
say " exploitability of that route is not verified, so it is not counted"
# Build time range options once for the IoC hunt.
# Expanded as ${A[@]+"${A[@]}"}: before bash 4.4 a bare "${A[@]}" of an empty
# array is an "unbound variable" under set -u, which silently zeroed the hunt.
JOURNAL_RANGE=()
if [ -n "${UNTIL:-}" ]; then
JOURNAL_RANGE+=("--until" "$UNTIL")
fi
# ------------------------------------------------------------------ behavioural IoC hunt
IOC_HITS=0
if [ "$HUNT" -eq 1 ]; then
if [ -n "${UNTIL:-}" ]; then
hdr "Behavioural IoC hunt (since ${SINCE} until ${UNTIL})"
else
hdr "Behavioural IoC hunt (since ${SINCE})"
fi
if have journalctl; then
# A lost race that hits freed memory can leave a KASAN report or oops
# whose trace names these functions; a clean exploit leaves nothing, so
# zero proves nothing. The functions also appear in unrelated TCP traces,
# so a hit is a lead to read, not proof.
HITS=$(journalctl -k --since "${SINCE}" ${JOURNAL_RANGE[@]+"${JOURNAL_RANGE[@]}"} --no-pager 2>/dev/null \
| grep -ciE '(ip_options_build|tcp_v4_send_synack|inet_csk_route_req|tcp_v4_reqsk_destructor|inet_sock_destruct)' || true)
if [ "$HITS" -gt 0 ]; then
warn "kernel log names ip_options_build / SYN-ACK / inet_sock_destruct paths: $HITS line(s)"
IOC_HITS=$((IOC_HITS+HITS))
else
ok "no handshake-path crash signatures in kernel log window"
fi
else
say " . journalctl not available; skipping journal hunt"
fi
fi
jset ioc_hits "$IOC_HITS"
# ------------------------------------------------------------------ risk scoring
#
# Score model (0..100). Tuned so that:
# - patched -> ~0..10
# - vulnerable, no reachable listener -> 50
# - vulnerable with an externally reachable listener-> 75
# - + container runtime / migration / IoCs -> +5 / +5 / +10 (capped)
#
SCORE=0
case "$vendor_status" in
VULNERABLE) SCORE=$((SCORE+50)) ;;
UNKNOWN) SCORE=$((SCORE+30)) ;;
esac
[ "$NET_PATH" -eq 1 ] && SCORE=$((SCORE+25))
[ "$LOCAL_PATH" -eq 1 ] && [ "$NET_PATH" -eq 0 ] && SCORE=$((SCORE+8))
[ "$CTR_PROCS" -gt 0 ] && SCORE=$((SCORE+5))
[ "$MIGRATE_REQ" = "1" ] && SCORE=$((SCORE+5))
[ "$IOC_HITS" -gt 0 ] && SCORE=$((SCORE+10))
[ $SCORE -gt 100 ] && SCORE=100
jset risk_score "$SCORE"
# Final verdict logic.
final="UNKNOWN"; exit_code=3
case "$vendor_status" in
PATCHED)
final="PATCHED"; exit_code=0 ;;
NOT_APPLICABLE)
final="NOT_APPLICABLE"; exit_code=0 ;;
VULNERABLE)
if [ "$NET_PATH" -eq 0 ] && [ "$LOCAL_PATH" -eq 0 ]; then
# No TCP listener to attack right now. A service restart or a new
# listener re-opens it, so still ship the kernel.
final="MITIGATED"; exit_code=1
else
final="VULNERABLE"; exit_code=2
fi
;;
UNKNOWN)
final="UNKNOWN"; exit_code=3 ;;
esac
jset verdict "$final"
# ------------------------------------------------------------------ output
if [ "$JSON" -eq 1 ]; then
# Emit JSON. Keep it dependency-free; no jq needed. Keys are sorted. The
# type of a field depends on its key, never on its value: the keys below
# are numbers (null when the value is not an integer, e.g. an unreadable
# sysctl), every other field is a string. Guessing from the value made
# "12" a number and "24.04" a string, and a hostname "007" invalid JSON.
json_number_key() {
# shellcheck disable=SC2254 # the patterns are meant to glob
case "$1" in
in_container|module_tree_present|matrix_age_days|matrix_stale|bindv6only|tcp_migrate_req|listeners_external|listeners_loopback|listeners_ipv6_wildcard|container_runtime_processes|*_path_reachable|ioc_hits|risk_score) return 0 ;;
esac
return 1
}
json_escape() {
local s="$1"
s="${s//\\/\\\\}"
s="${s//\"/\\\"}"
s="${s//$'\n'/\\n}"
s="${s//$'\r'/\\r}"
s="${s//$'\t'/\\t}"
printf '%s' "$s"
}
printf '{'
first=1
mapfile -t sorted_keys < <(printf '%s\n' "${!J[@]}" | sort)
for k in "${sorted_keys[@]}"; do
v="${J[$k]}"
if [ $first -eq 1 ]; then first=0; else printf ','; fi
if json_number_key "$k"; then
if [[ "$v" =~ ^-?(0|[1-9][0-9]*)$ ]]; then printf '"%s":%s' "$k" "$v"; else printf '"%s":null' "$k"; fi
else
printf '"%s":"%s"' "$k" "$(json_escape "$v")"
fi
done
printf '}\n'
exit "$exit_code"
fi
if [ "$QUIET" -eq 1 ]; then
printf '%s (%d/100): %s\n' "$final" "$SCORE" "$vendor_detail"
# A second line only when stale, so a parser reading line 1 is unaffected.
[ "$MATRIX_STALE" -eq 1 ] && printf 'NOTE: distro fix matrix is %s days old (snapshot %s); update this script\n' "$MATRIX_AGE" "$MATRIX_DATE"
exit "$exit_code"
fi
hdr "Summary"
kv "verdict" "$final"
kv "risk score" "$SCORE / 100"
kv "vendor" "$vendor_status -> $vendor_detail"
kv "paths" "network=$NET_PATH local=$LOCAL_PATH"
kv "listeners" "scan=$LISTEN_STATE external=$LISTEN_EXT loopback=$LISTEN_LO ipv6_wildcard=$LISTEN_V6W"
kv "sysctl" "tcp_migrate_req=$MIGRATE_REQ bindv6only=$BINDV6ONLY"
kv "containers" "$CTR_PROCS"
kv "ioc hits" "$IOC_HITS"
kv "matrix" "snapshot ${MATRIX_DATE}, ${MATRIX_AGE} days old$( [ "$MATRIX_STALE" -eq 1 ] && echo ' (STALE: update this script)' )"
say ""
case "$final" in
PATCHED)
say "Action: none required. Reboot if you haven't since the kernel update."
;;
NOT_APPLICABLE)
say "Action: no action required. Running kernel predates the vulnerable code."
;;
MITIGATED)
say "Action: ship the vendor kernel and reboot. No IPv4 TCP listener is reachable"
say "right now, but the kernel is still vulnerable and any service start re-opens it."
;;
VULNERABLE)
say "Action: update the kernel and reboot. There is no runtime switch that fixes this;"
say "Red Hat also lists no mitigation. Until then, to lower exposure:"
if [ "$NET_PATH" -eq 1 ]; then
say " - Restrict who can reach the listeners (firewall / security group / VPN) to"
say " trusted sources; the race starts with a SYN from the attacker, so a packet"
say " dropped before the listener never reaches it."
say " - Stop listeners you do not need${LISTEN_EXT_PORTS:+ (now: ${LISTEN_EXT_PORTS})}."
fi
if [ "$LOCAL_PATH" -eq 1 ]; then
say " - Loopback-only services are reachable by every local user; treat shared"
say " machines as exposed."
fi
if [ "$MIGRATE_REQ" = "1" ]; then
say " - Set net.ipv4.tcp_migrate_req=0 (default) unless you rely on it; this closes the"
say " migration race only, not the one in tcp_v4_syn_recv_sock()."
fi
if [ "$CTR_PROCS" -gt 0 ]; then
say " - Containers share this kernel: audit this host, not the images."
fi
;;
UNKNOWN)
say "Action: cross-check the vendor advisory for the exact running kernel package."
say " Treat as VULNERABLE on any host with an internet-facing TCP service until proven otherwise."
;;
esac
exit "$exit_code"
} # end main()
main "$@"