
Provides safe detection and kernel patch scripts for CVE-2026-31431, a Linux kernel privilege escalation via algif_aead. Includes read-only checks, module blacklisting, and kernel-only upgrades.
Linux kernel local privilege escalation via
algif_aead(AF_ALG) CVSS 7.8 HIGH | Public disclosure: April 2026
Run as a normal user:
curl -fsSL https://raw.githubusercontent.com/Mrhudson69/cve-2026-31431/main/check_cve_2026_31431.sh -o check.sh && bash check.sh
This script:
algif_aead AEAD bind path is reachableRun as root:
curl -fsSL https://raw.githubusercontent.com/Mrhudson69/cve-2026-31431/main/patch_cve_2026_31431.sh -o patch.sh && sudo bash patch.sh
Run as root if you want to remove Elastic Agent from the server:
curl -fsSL https://raw.githubusercontent.com/Mrhudson69/cve-2026-31431/main/uninstall_elastic_agent.sh -o uninstall-elastic.sh && sudo bash uninstall-elastic.sh
This script:
elastic-agent uninstall non-interactivelyIf you are inside:
wg-easy containerYou CANNOT patch the host kernel from inside the container.
The script detects containers automatically and exits safely.
You must run the patch script on:
NOT inside the container.
A flaw in the Linux kernel algif_aead crypto interface allows an unprivileged local user to corrupt page cache contents through AF_ALG operations.
Under vulnerable kernel configurations, this may allow:
The issue affects Linux kernel versions where the vulnerable AEAD optimization logic exists and is reachable.
| OS | Versions |
|---|---|
| Ubuntu | 20.04 / 22.04 / 24.04 |
| Debian | 11 / 12 / 13 |
| Proxmox VE | 6.x / 7.x / 8.x / 9.x |
| Generic Linux | Any distro using vulnerable kernels |
check_cve_2026_31431.shSafe read-only detection script.
| Check | Description |
|---|---|
| Kernel Version | Checks vulnerable kernel range |
| Patch Presence | Attempts to identify patched kernel |
| algif_aead Status | Checks module load / blacklist state |
| AF_ALG Socket | Tests algif_aead AEAD bind reachability |
Python os.splice | Checks pure-Python exploit feasibility |
| Setuid Exposure | Detects common setuid targets |
| Mitigations | Checks AppArmor / SELinux / seccomp |
The detection script:
patch_cve_2026_31431.shSafe kernel-only mitigation + upgrade script.
Designed for:
uninstall_elastic_agent.shSafe helper script to uninstall Elastic Agent from a Linux server.
Designed for:
/opt/Elastic/AgentCreates:
/etc/modprobe.d/cve-2026-31431-disable-algif-aead.conf
Contents:
blacklist algif_aead
install algif_aead /bin/false
Then attempts:
rmmod algif_aead
This blocks automatic loading of the vulnerable module.
The script also refreshes initramfs when update-initramfs is available so the blacklist survives reboot reliably.
Before upgrading anything, the script performs:
apt-get -s install --only-upgrade ...
If ANY non-kernel packages would be upgraded:
the script ABORTS automatically.
This prevents accidental application upgrades.
The script upgrades only:
No application/runtime packages are upgraded.
If the system reboots, the patch script now installs a temporary one-shot systemd service that re-runs the verification phase automatically on the next boot.
This lets a single script run cover:
Safest option first:
sudo bash patch.sh --dry-run
This:
Recommended before production deployment.
sudo bash patch.sh --no-reboot
sudo bash patch.sh --reboot-now
With --reboot-now, the script installs the reboot-resume hook before scheduling the restart.
sudo reboot
If you use --no-reboot or reboot later manually, the post-reboot verification still resumes automatically on the next boot.
The script is designed to avoid touching:
However:
--dry-run firstPatch logs:
/var/log/cve_2026_31431_kernel_patch.log
Check running kernel:
uname -r
Run detection again:
bash check.sh
Verify module blacklist:
cat /etc/modprobe.d/cve-2026-31431-disable-algif-aead.conf
These scripts are provided for defensive security and system administration purposes only.
No exploit code is included.
Always:
Use at your own risk.
MIT License
NVD CVE Entry https://nvd.nist.gov/vuln/detail/CVE-2026-31431
Linux Kernel Fix Commit https://git.kernel.org/linus/a664bf3d603dc3bdcf9ae47cc21e0daec706d7a5
Ubuntu Security Notices https://ubuntu.com/security
Debian Security Tracker https://security-tracker.debian.org/