CVE-2024-54661
📋 TL;DR
This vulnerability in socat's readline.sh script allows local privilege escalation through insecure temporary file handling. Attackers can exploit symlink attacks on the /tmp/$USER/stderr2 file to write arbitrary content with elevated privileges. This affects all socat installations before version 1.8.0.2 where the readline.sh script is used.
💻 Affected Systems
- socat
⚠️ Manual Verification Required
This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.
Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).
🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.
- Review the CVE details at NVD
- Check vendor security advisories for your specific version
- Test if the vulnerability is exploitable in your environment
- Consider updating to the latest version as a precaution
⚠️ Risk & Real-World Impact
Worst Case
Full system compromise through root privilege escalation, allowing attackers to execute arbitrary code as root, install persistent backdoors, or access sensitive system files.
Likely Case
Local privilege escalation allowing attackers to gain root access on systems where socat is installed and the vulnerable script is accessible.
If Mitigated
Limited impact if proper file permissions and SELinux/apparmor policies prevent unauthorized access to /tmp directories.
🎯 Exploit Status
Exploitation requires local access to the system and knowledge of the vulnerability. Attackers need to create symlinks at predictable temporary file locations.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 1.8.0.2
Vendor Advisory: http://www.dest-unreach.org/socat/contrib/socat-secadv9.html
Restart Required: No
Instructions:
1. Download socat 1.8.0.2 or later from official sources. 2. Compile and install following standard build procedures. 3. Verify installation with 'socat -V' to confirm version 1.8.0.2 or higher.
🔧 Temporary Workarounds
Remove vulnerable script
allRemove or restrict permissions on the vulnerable readline.sh script
chmod 000 /path/to/socat/readline.sh
rm /path/to/socat/readline.sh
Secure temporary directory
allSet secure permissions on /tmp directories to prevent symlink attacks
chmod 1777 /tmp
chmod 1777 /tmp/$USER
🧯 If You Can't Patch
- Implement strict file permissions on /tmp directories using chmod 1777
- Use SELinux or AppArmor to restrict socat's access to temporary files
🔍 How to Verify
Check if Vulnerable:
Check socat version with 'socat -V' and verify if below 1.8.0.2. Also check if readline.sh exists in socat installation directory.
Check Version:
socat -V | grep -o 'version [0-9.]*'
Verify Fix Applied:
Run 'socat -V' and confirm version is 1.8.0.2 or higher. Verify readline.sh has been updated or removed.
📡 Detection & Monitoring
Log Indicators:
- Failed attempts to access /tmp/$USER/stderr2
- Unusual socat process activity with elevated privileges
- Symlink creation in /tmp directories
Network Indicators:
- Local privilege escalation attempts typically don't generate network traffic
SIEM Query:
process_name:socat AND (file_path:/tmp/*/stderr2 OR privilege_escalation:true)