# CVE-2024-42381: os/linux/elf.rb in Homebrew brew before 4.2.20 uses ldd to load ELF files obtained from untrusted sources, which allows…

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.3
- **CVSS:** 8.3 (v3.1, CNA) `CVSS:3.1/AC:H/AV:N/A:H/C:H/I:H/PR:N/S:C/UI:R`
- **CVSS metrics:** Attack complexity: High; Attack vector: Network; Availability impact: High; Confidentiality impact: High; Integrity impact: High; Privileges required: None; Scope: Changed (impact reaches other components); User interaction: Required
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 1.18% (percentile 68, 2026-11-26)
- **CWE:** CWE-830
- **Published:** 2024-07-31T00:00:00.000Z
- **Modified:** 2026-06-17T07:49:21.777Z

## Who should check

- Anyone running n/a (versions: see the vendor advisory)
- Anyone running homebrew brew \< 4.2.20

## Description

os/linux/elf.rb in Homebrew brew before 4.2.20 uses ldd to load ELF files obtained from untrusted sources, which allows attackers to achieve code execution via an ELF file with a custom .interp section. NOTE: this code execution would occur during an un-sandboxed binary relocation phase, which occurs before a user would expect execution of downloaded package content. (237d1e783f7ee261beaba7d3f6bde22da7148b0a was the tested vulnerable version.)

## Affected and fixed versions

- n/a: see vendor advisory (nvd)
- homebrew brew: \< 4.2.20 (nvd)

## Mitigation

- Upgrade brew to 4.2.20 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-42381. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-42381.md
Affected: n/a; homebrew brew < 4.2.20
Fixed in: homebrew brew 4.2.20

Steps:
1. Search this machine and project for n/a, homebrew brew: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-42381 being exploited?

There is no confirmed exploitation: CVE-2024-42381 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.18% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-42381?

High: CVSS 8.3 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work. The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2024-42381?

n/a; homebrew brew \< 4.2.20.

### Is there a fix for CVE-2024-42381?

Yes. Fixed in homebrew brew 4.2.20. Upgrade brew to 4.2.20 or later.

### How do I check if I'm affected by CVE-2024-42381?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://github.com/Homebrew/brew/commit/916b37388d3851a8a93a8e9b4adc38873680ead7>
- patch: <https://github.com/Homebrew/brew/pull/17136>
- other: <https://github.com/Homebrew/brew/tree/237d1e783f7ee261beaba7d3f6bde22da7148b0a>
- other: <https://github.com/trailofbits/publications/blob/master/reviews/2023-08-28-homebrew-securityreview.pdf>
- other: <https://blog.trailofbits.com/2024/07/30/our-audit-of-homebrew/>
- other: <https://brew.sh/2024/07/30/homebrew-security-audit/>
- other: <https://github.com/Homebrew/brew/releases/tag/4.2.20>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-42381>

HTML: <https://flawdb.com/CVE-2024-42381> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-42381>
