CVE-2021-20294
📋 TL;DR
A stack buffer overflow vulnerability in binutils readelf 2.35 allows attackers to execute arbitrary code by tricking users into processing malicious files. This affects systems where readelf is used to analyze untrusted binary files. The vulnerability impacts confidentiality, integrity, and availability through potential remote code execution.
💻 Affected Systems
- binutils
- readelf
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution with the privileges of the user running readelf, potentially leading to full system compromise if run with elevated privileges.
Likely Case
Local privilege escalation or denial of service when processing crafted files from untrusted sources.
If Mitigated
Limited impact if readelf is not used on untrusted files or runs with minimal privileges.
🎯 Exploit Status
Exploitation requires user interaction to process malicious files. Public proof-of-concept exists in bug reports.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: binutils 2.36 or later
Vendor Advisory: https://sourceware.org/bugzilla/show_bug.cgi?id=26929
Restart Required: No
Instructions:
1. Update binutils package using system package manager. 2. For Linux: 'sudo apt update && sudo apt upgrade binutils' (Debian/Ubuntu) or 'sudo yum update binutils' (RHEL/CentOS). 3. Verify update with 'readelf --version'.
🔧 Temporary Workarounds
Restrict readelf usage
linuxLimit readelf execution to trusted users and environments
chmod 750 /usr/bin/readelf
setfacl -m u:trusteduser:rx /usr/bin/readelf
Sandbox execution
linuxRun readelf in restricted environments when processing untrusted files
firejail --net=none readelf [file]
bubblewrap --ro-bind / / --dev /dev --proc /proc readelf [file]
🧯 If You Can't Patch
- Implement strict file validation policies - only allow readelf on verified, trusted files
- Run readelf with minimal privileges using SELinux/AppArmor or unprivileged user accounts
🔍 How to Verify
Check if Vulnerable:
Check binutils version: 'readelf --version | head -1' and compare to vulnerable version 2.35
Check Version:
readelf --version | head -1
Verify Fix Applied:
Verify updated version: 'readelf --version | head -1' should show 2.36 or later
📡 Detection & Monitoring
Log Indicators:
- Abnormal process crashes of readelf
- Unexpected file processing by readelf in audit logs
Network Indicators:
- Unusual file downloads followed by readelf execution
SIEM Query:
process.name='readelf' AND (event.action='crashed' OR file.path CONTAINS '.tmp' OR file.path CONTAINS 'download')
🔗 References
- https://bugzilla.redhat.com/show_bug.cgi?id=1943533
- https://lists.apache.org/thread.html/r58af02e294bd07f487e2c64ffc0a29b837db5600e33b6e698b9d696b%40%3Cissues.bookkeeper.apache.org%3E
- https://lists.apache.org/thread.html/rf4c02775860db415b4955778a131c2795223f61cb8c6a450893651e4%40%3Cissues.bookkeeper.apache.org%3E
- https://security.gentoo.org/glsa/202208-30
- https://sourceware.org/bugzilla/show_bug.cgi?id=26929
- https://sourceware.org/git/?p=binutils-gdb.git%3Ba=patch%3Bh=372dd157272e0674d13372655cc60eaca9c06926
- https://bugzilla.redhat.com/show_bug.cgi?id=1943533
- https://lists.apache.org/thread.html/r58af02e294bd07f487e2c64ffc0a29b837db5600e33b6e698b9d696b%40%3Cissues.bookkeeper.apache.org%3E
- https://lists.apache.org/thread.html/rf4c02775860db415b4955778a131c2795223f61cb8c6a450893651e4%40%3Cissues.bookkeeper.apache.org%3E
- https://security.gentoo.org/glsa/202208-30
- https://sourceware.org/bugzilla/show_bug.cgi?id=26929
- https://sourceware.org/git/?p=binutils-gdb.git%3Ba=patch%3Bh=372dd157272e0674d13372655cc60eaca9c06926