CVE-2026-98432 firewall mitigation for unpatched Linux OS.
CVE-2026-98432-mitigation.sh applies (or removes) a host firewall rule that drops incoming IPv4 TCP packets carrying IPv4 options.
CVE-2026-98432 is a use-after-free flaw in the Linux kernel code that sets up incoming IPv4 TCP connections. A remote attacker can trigger it by sending TCP connection requests that carry IPv4 options to any listening IPv4 TCP port. No credentials or user interaction are needed. The Linux kernel CVE team rates this issue Critical, with a CVSS v3.1 score of 9.8. Operating system vendors rate it between Important and Critical.
Table of Contents:
nft (nftables) or iptables (with the u32 match module)sudo (the script uses sudo only when not run as root)chmod +x CVE-2026-98432-mitigation.sh
./CVE-2026-98432-mitigation.sh # apply the mitigation unless the running kernel is confirmed patched (ignored on Amazon Linux)
./CVE-2026-98432-mitigation.sh --check # only report the kernel patch status, change nothing
./CVE-2026-98432-mitigation.sh --force # apply the mitigation even if the kernel looks patched (ignored on Amazon Linux)
./CVE-2026-98432-mitigation.sh --disable # remove the mitigation (skipped on Amazon Linux)
./CVE-2026-98432-mitigation.sh --help # show usage
--check, --force and --disable are mutually exclusive. Any unknown option prints the usage text and exits with status 1.
uname -r and takes the major.minor part. The script continues only if that is 4.4 or later (compared with sort -V), matching the AWS bulletin's "4.4 and later". Kernels older than 4.4 exit with status 0 and no changes.--force, because patched kernels are available and updating the kernel is the right solution. If the kernel is not confirmed patched, the script prints the AWS bulletin link and exits 0.patched: the script prints that no mitigation is needed and exits 0 (unless --force is given).not-patched or unknown: the mitigation is applied. The check is fail-closed, so the firewall rule is added unless the kernel is positively confirmed patched. This covers distros that have not released a fix yet.command -v to detect what is installed. nft is preferred; iptables is used only if nft is missing. Only one tool is used, so the rule is never applied twice./etc/cve-2026-98432.nft.inet cve_2026_98432 table, if any (so re-runs are idempotent).nft -c -f, then loads with nft -f.include "/etc/cve-2026-98432.nft" to /etc/nftables.conf if not already there./etc/nftables.conf and runs systemctl enable nftables.service so the rule survives a reboot.iptables -C whether the rule exists; if not, inserts it at position 1 of INPUT.INPUT with -n -v --line-numbers.IPT_ARGS array, and reused for check, insert, delete and verification.ACTION: line saying which tool added it (rule ADDED using nft or rule ADDED using iptables). If the rule is not found it prints ACTION: rule was NOT added. to stderr. Exit status is 0 on success, 1 otherwise.The distribution is read from ID and ID_LIKE in /etc/os-release.
| Distribution | Method |
|---|---|
Amazon Linux 2023, RHEL family (amzn, rhel, fedora, centos) with dnf | dnf -q updateinfo list --installed --cves CVE-2026-98432. The kernel package line must match the running kernel exactly. On Amazon Linux, if nothing matches, the query is repeated with --releasever=latest. |
Same family without dnf (for example Amazon Linux 2) | Search rpm -q --changelog of the package owning /boot/vmlinuz-$(uname -r) for the CVE. |
| Debian, Ubuntu | Search /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz (or changelog.gz) for the CVE. |
| Anything else | Status unknown, so the mitigation is applied. |
With dnf, the command lists installed packages covered by an advisory for the CVE, for example:
ALAS2023-2026-3335 Important/Sec. kernel6.12-1:6.12.113-138.209.amzn2023.x86_64
ALAS2023-2026-3335 Important/Sec. kernel6.12-devel-1:6.12.113-138.209.amzn2023.x86_64
The script keeps only the kernel/kernelX.Y package whose version-release.arch equals uname -r. The -headers, -devel and -tools packages and other installed kernels are ignored. If there is no output apart from the metadata line, the status is not-patched. If dnf itself fails (for example no repository metadata), the status is unknown.
Amazon Linux 2023 and pinned releases. The repository metadata follows the release the instance is pinned to ($releasever). A kernel installed with dnf update --advisory ... --releasever=<newer release> is not linked to its advisory by a plain dnf updateinfo afterwards, because --releasever is not saved and the older metadata does not contain the advisory. On Amazon Linux, when the first query finds no advisory for the running kernel, the script repeats it with --releasever=latest. The flag applies to that single dnf run only; nothing is written to /etc/dnf/vars. If the second query matches, the status is patched and the detail says it was found only with --releasever=latest. The second query needs access to the Amazon Linux repositories; if it fails and the first query found nothing, the status is unknown rather than not-patched.
On Amazon Linux (ID=amzn), any status other than patched (not-patched or unknown) prints an extra line pointing to the AWS bulletin, in both normal and --check runs:
Please update the Kernel version, see https://aws.amazon.com/security/security-bulletins/2026-160-aws/
The line is not printed when the kernel is patched, or on other distributions. On Amazon Linux the script then stops without touching the firewall (see Apply).
Statuses: