CVE-2024-42381
📋 TL;DR
This vulnerability in Homebrew allows attackers to execute arbitrary code by crafting malicious ELF files with custom .interp sections. The exploit occurs during the binary relocation phase before package execution, affecting users who install packages from untrusted sources. All Homebrew users on vulnerable versions are at risk.
💻 Affected Systems
- Homebrew (brew)
⚠️ 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 with attacker gaining code execution at the privilege level of the Homebrew user, potentially leading to lateral movement, data theft, or persistence.
Likely Case
Local privilege escalation or execution of malicious code when installing packages from untrusted repositories or sources.
If Mitigated
No impact if using Homebrew 4.2.20+ or only installing from trusted sources with proper verification.
🎯 Exploit Status
Exploitation requires user to install a malicious package. The vulnerability was discovered during a security audit and proof-of-concept exists.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 4.2.20
Vendor Advisory: https://brew.sh/2024/07/30/homebrew-security-audit/
Restart Required: No
Instructions:
1. Update Homebrew: brew update
2. Upgrade Homebrew: brew upgrade
3. Verify version: brew --version should show 4.2.20 or higher
🔧 Temporary Workarounds
Avoid untrusted packages
allOnly install packages from official Homebrew repositories and verified sources
Manual verification
allManually verify package integrity and source before installation
brew audit <package>
brew info <package>
🧯 If You Can't Patch
- Restrict Homebrew usage to trusted administrators only
- Implement network controls to prevent downloading packages from untrusted sources
🔍 How to Verify
Check if Vulnerable:
Check Homebrew version: brew --version. If version is below 4.2.20, system is vulnerable.
Check Version:
brew --version
Verify Fix Applied:
Run brew --version and confirm version is 4.2.20 or higher. Test by installing a known safe package.
📡 Detection & Monitoring
Log Indicators:
- Unusual package installation activity
- Failed package verification attempts
- Execution of unexpected binaries during brew operations
Network Indicators:
- Downloads from non-standard Homebrew repositories
- Unusual network connections during package installation
SIEM Query:
process.name:brew AND (process.args:*install* OR process.args:*update*) AND NOT (process.args:*--version*)
🔗 References
- https://blog.trailofbits.com/2024/07/30/our-audit-of-homebrew/
- https://brew.sh/2024/07/30/homebrew-security-audit/
- https://github.com/Homebrew/brew/commit/916b37388d3851a8a93a8e9b4adc38873680ead7
- https://github.com/Homebrew/brew/pull/17136
- https://github.com/Homebrew/brew/releases/tag/4.2.20
- https://github.com/Homebrew/brew/tree/237d1e783f7ee261beaba7d3f6bde22da7148b0a
- https://github.com/trailofbits/publications/blob/master/reviews/2023-08-28-homebrew-securityreview.pdf