
Shell scanner for CVE-2026-31431 "Copy Fail" — a local privilege escalation via Linux kernel page cache corruption (algif_aead/AF_ALG). Checks kernel version, patch status, module state, setuid exposure and mitigations. Supports Debian 11–13 and Ubuntu 20.04–25.10. CI/CD-ready (exit codes + JSON output).
Shell-based scanner for CVE-2026-31431 "Copy Fail", a local privilege escalation vulnerability in the Linux kernel's cryptographic subsystem (algif_aead / AF_ALG interface). An unprivileged local user can write 4 bytes into the in-memory page cache of a setuid binary (e.g. /usr/bin/su) and obtain a root shell — without touching the on-disk file.
a664bf3d603d| Distribution | Release | Patched version |
|---|---|---|
| Debian | 11 Bullseye | 5.10.251-3 |
| Debian | 12 Bookworm | 6.1.170-1 |
| Debian | 13 Trixie | 6.12.85-1 |
| Debian | Sid / Forky | 6.19.14-1 |
| Ubuntu | 20.04 LTS Focal (GA) | 5.4.0-220.240 |
| Ubuntu | 20.04 LTS Focal (HWE) | 5.15.0-135.145~20.04.1 |
| Ubuntu | 22.04 LTS Jammy (GA) | 5.15.0-135.145 |
| Ubuntu | 22.04 LTS Jammy (HWE) | 6.8.0-61.63~22.04.1 |
| Ubuntu | 24.04 LTS Noble | 6.8.0-61.63 |
| Ubuntu | 24.10 Oracular | 6.11.0-27.27 |
| Ubuntu | 25.04 Plucky | 6.14.0-15.15 |
| Ubuntu | 25.10 Questing | mainline fix (≥ 6.15) |
| Generic | any | mainline range check (4.14 – 6.14 vulnerable) |
Ubuntu derivatives based on the above releases (Pop!_OS, Linux Mint, Elementary OS, etc.) are also detected via ID_LIKE in /etc/os-release.
# Basic scan
bash cve-2026-31431-detect.sh
# No colour output (log files, CI)
bash cve-2026-31431-detect.sh --no-colour
# JSON output (machine-readable, for pipelines)
bash cve-2026-31431-detect.sh --json
# Quiet mode — only print the summary
bash cve-2026-31431-detect.sh --quiet
# Combine flags
bash cve-2026-31431-detect.sh --json --quiet
No root required. No packages to install beyond a standard shell (bash ≥ 4.3) and optionally python3 for the live AF_ALG socket test.
| Code | Meaning |
|---|---|
0 | No vulnerable conditions found |
1 | One or more vulnerable conditions found |
2 | Script error / could not complete checks |
Designed for use in DevSecOps pipelines — pipe the JSON output to your SIEM, ticketing system, or compliance dashboard.
The script prints results in two languages:
Both sections are printed to stdout after the per-check results.
=== Kernel Version ===
[INFO] Distro flavour : ubuntu (id=ubuntu, codename=jammy, version=22.04)
[INFO] Kernel release : 5.15.0-135-generic
[OK] Kernel version
Reason : Ubuntu jammy: kernel 5.15.0-135.145 >= patched version 5.15.0-135.145
...
✅ PROTECTED — SYSTEM IS NOT VULNERABLE
❌ VULNERABLE — IMMEDIATE ACTION REQUIRED
✗ Kernel version
✗ Patch presence
✗ algif_aead module
✗ AF_ALG socket
✗ Setuid binaries
sudo apt update && sudo apt full-upgrade && sudo reboot
# After reboot: uname -v → must show >= 6.1.170-1 (Bookworm)
sudo apt update && sudo apt full-upgrade && sudo reboot
# After reboot: cat /proc/version_signature
Only effective when CONFIG_CRYPTO_USER_API_AEAD=m (built as module). Has no effect if the option is compiled in (=y).
echo 'install algif_aead /bin/false' | sudo tee /etc/modprobe.d/disable-algif-aead.conf
sudo rmmod algif_aead 2>/dev/null || true
This does not affect SSH, dm-crypt/LUKS, OpenSSL, GnuTLS, NSS, web servers, or disk encryption.
MIT
| # | Check | Method |
|---|
| 1 | Kernel version | uname -r / uname -v / dpkg / /proc/version_signature |
| 2 | Patch presence | Debian build version, Ubuntu pkg version, commit prefix in /proc/version |
| 3 | algif_aead module | /proc/modules, modprobe.d blacklist, .ko on disk |
| 4 | AF_ALG socket | Live socket(AF_ALG, …) attempt via Python 3 |
| 5 | Setuid binaries | Common setuid-root binaries as write targets |
| 6 | Mitigations | AppArmor, SELinux, seccomp status |
| 7 | Kernel config | CONFIG_CRYPTO_AUTHENC, CONFIG_CRYPTO_USER_API_AEAD |
| 8 | User namespaces | unprivileged_userns_clone, max_user_namespaces |
| 9 | Transparent hugepages | THP setting and effect on exploitation |
| 10 | Environment | Docker / Kubernetes / WSL detection, root warning |