BLOG ESPECIALIZADO NO MUNDO LINUX.
Blog de Linux com vídeo aulas, notícias do mundo Linux e do Software Livre.
Páginas
▼
segunda-feira, 4 de maio de 2026
The “Copy Fail” Vulnerability (CVE‑2026‑31431)
Protect SUSE Linux systems from CVE-2026-31431 (Copy Fail LPE) with detection commands, automation scripts, and temporary mitigations. Includes a Raspberry Pi lab for safe practice. Stay secure long after the patch lands.
The vulnerability, nicknamed “Copy Fail,” allows any unprivileged local user to gain root access by writing only four bytes to the page cache of any readable file. The flaw affects all major Linux distributions and has been present in the kernel since 2017.
Although the patch is now available, this guide provides reusable, evergreen advice that you can apply today and for years to come—no matter when you read this.
How to Check if You Are Vulnerable (SUSE Linux)
Run the following commands to determine whether your SUSE system is exposed to CVE‑2026‑31431.
Quick Kernel Version Check
bash
uname-r
The fixed kernel for openSUSE Leap 15.5 is 5.14.21‑150500.13.130.1 or later. If your version is older, you are vulnerable.
If the module is loaded or built into the kernel, the system remains vulnerable. The default SUSE kernel often includes algif_aead as a built‑in module, making the modprobe workaround ineffective.
Automated Checker Script (for any Linux distribution)
git clone https://github.com/ForensicFoundry/cve-2026-31431-check.git
cd cve-2026-31431-check
chmod +x cve-2026-31431-check
sudo ./cve-2026-31431-check
The script reports whether algif_aead is loaded, built in, or blacklisted and whether the system has rebooted after applying the latest kernel update.
Automation Script to Apply the Fix
Warning: Always test updates in a staging environment before deploying to production. The following script applies the official SUSE kernel patch, then reboots the system.
Save this script as apply-copy-fail-fix.sh and run it with root privileges:
bash
#!/bin/bash# apply-copy-fail-fix.sh – Updates SUSE Linux kernel to fix CVE-2026-31431# Compatible with: openSUSE Leap 15.5, SUSE Linux Enterprise Micro 5.5set-eecho"=== CVE-2026-31431 (Copy Fail) Fix for SUSE Linux ==="# Ensure we are rootif["$EUID"-ne0];thenecho"Error: Please run as root (sudo)."exit1fi# Detect product and apply the correct patch commandifgrep-q"openSUSE Leap 15.5" /etc/os-release;thenecho"Detected: openSUSE Leap 15.5"zypper --non-interactive patch SUSE-2026-1676=1elifgrep-q"SUSE Linux Enterprise Micro 5.5" /etc/os-release;thenecho"Detected: SUSE Linux Enterprise Micro 5.5"zypper --non-interactive patch SUSE-SLE-Micro-5.5-2026-1676=1elseecho"Warning: Unrecognized SUSE version. Attempting generic zypper patch."zypper --non-interactive patch
fiecho"Kernel update installed. Rebooting in 10 seconds..."sleep10reboot
After the reboot, re‑run the checker script from Section 1 to confirm that the vulnerability is gone.
Build Your Own Security Lab with a Raspberry Pi Kit
The best way to understand and test kernel vulnerabilities is to build a dedicated lab. A Raspberry Pi kit,provides an affordable, isolated environment where you can safely:
Important: On many SUSE systems algif_aead is built into the kernel, so this method will have no effect. Always verify with lsmod | grep algif_aead after running the commands.
Compatibility note: This blacklist does not affect dm‑crypt/LUKS, kTLS, IPsec, SSH, or standard OpenSSL/GnuTLS builds. Only applications that directly use AF_ALG for AEAD ciphers (e.g., OpenSSL with the afalg engine) are impacted.
Option C: Least Privilege via AppArmor / seccomp (for advanced users)
If you cannot modify the kernel command line, use mandatory access controls to block unprivileged creation of AF_ALG sockets. This is a fine‑grained approach, but do not enable AppArmor or SELinux from scratch just for this – they require careful tuning. Instead, adapt existing profiles or use seccomp filters to deny the socket call for untrusted processes.
Conclusion
CVE‑2026‑31431 (Copy Fail) is a persistent, high‑risk local privilege escalation that affects almost every Linux system built since 2017. While the official patch exists, security is an ongoing process, not a one‑time event.
What you should do today:
1. Check your SUSE systems with the commands in Section 1.
2. Apply the official update using the automation script in Section 2.
3. If immediate patching is impossible, deploy one of the temporary mitigations from Section 3.
4. Set up a Raspberry Pi lab to practice these skills safely.
Bookmark this guide – it will remain accurate and useful for years, regardless of when the next kernel update drops.
Nenhum comentário:
Postar um comentário