Learn to fix OpenSSL NULL pointer & heap overflow vulnerabilities (CVE-2026-28387 to 31790) on Ubuntu, Rocky, SUSE. Includes check scripts, iptables mitigation, and a hands-on Docker lab for 2026 & beyond.
In April 2026, SUSE released a patch for six OpenSSL 3 flaws—including a heap buffer overflow (CVE-2026-31789) and multiple NULL pointer dereferences that crash services (CVE-2026-28388, CVE-2026-28389). One bug even affects DANE (DNS-based authentication) causing potential use-after-free.
But vulnerabilities like these resurface every year. This guide gives you reusable commands to check, fix, or block any OpenSSL 3 issue—today or in 2028.
1. How to check if you are vulnerable (actual commands)
openssl version -a | head -1 # If output shows "3.0.x" or "3.1.x" without the specific patch – vulnerable dpkg -l | grep openssl
rpm -q openssl # Compare with your distro’s security tracker. Example: openssl-3.0.7-30.el9_5 is fixed dnf updateinfo list | grep openssl
zypper info openssl-3 | grep Version # Vulnerable if lower than 3.2.3-150700.5.31.1 (from the April 2026 advisory) zypper patch-check
# Try to trigger a safe NULL deref (won't crash but shows flaw) echo "Test" | openssl cms -encrypt -recip /dev/null 2>&1 | grep "NULL"
2. Automation script to apply the fix (bash)
#!/bin/bash # Works on Ubuntu, Rocky, SUSE - OpenSSL 3 patch automation set -e OS_ID=$(grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') case $OS_ID in ubuntu|debian) apt update && apt upgrade -y openssl libssl3 ;; rhel|rocky|almalinux) dnf update -y openssl ;; suse|opensuse-leap) zypper --non-interactive update openssl-3 ;; *) echo "Unsupported OS. Update manually." exit 1 ;; esac echo "OpenSSL updated. Restart services using SSL (nginx, apache, sshd)." systemctl restart nginx sshd 2>/dev/null || true openssl version
3. Alternative mitigation if you can’t update now
# Rate-limit or drop malformed CMS traffic to port 443 iptables -A INPUT -p tcp --dport 443 -m string --string "CMS" --algo bm -j DROP iptables -A INPUT -p tcp --dport 25 -m string --string "CRL" --algo bm -j DROP
# Create /etc/apparmor.d/usr.bin.openssl profile openssl /usr/bin/openssl { capability net_raw, /usr/lib/*/libcrypto.so.3 mr, deny /tmp/* rw, # Blocks overflow writes to temp } apparmor_parser -r /etc/apparmor.d/usr.bin.openssl

Nenhum comentário:
Postar um comentário