CVE-2022-38495
Description
LIEF commit 365a16a was discovered to contain a heap-buffer overflow via the function print_binary at /c/macho_reader.c.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
LIEF commit 365a16a contains a heap-buffer overflow in the Mach-O reader's print_binary function via crafted input.
Vulnerability
Description
CVE-2022-38495 describes a heap-buffer overflow vulnerability in LIEF, a cross-platform library for parsing and manipulating executable file formats. The flaw resides in the print_binary function within /c/macho_reader.c, specifically located at line 39. The issue was discovered in commit 365a16a and is triggered when processing a specially crafted Mach-O file. The root cause involves insufficient bounds checking on load command data, potentially leading to an out-of-bounds read [1][2].
Exploitation
Scenario
An attacker can exploit this vulnerability by providing a malicious Mach-O file to LIEF's tools or API. The proof-of-concept provided in the issue report [2] shows that parsing a crafted poc file with the macho_reader example triggers the overflow. No authentication is required, and the attack surface is any application using LIEF to parse untrusted Mach-O binaries. The overflow is a read of size 1 one byte past a heap-allocated region, as shown in the AddressSanitizer output [2].
Impact
The heap-buffer overflow can cause a denial of service by crashing the application (as observed in the ASAN report) and potentially enabling arbitrary code execution if exploited further. The vulnerable code reads memory beyond an allocated buffer, which could leak sensitive information or be leveraged for more severe attacks, depending on memory layout and mitigations [2][3].
Mitigation
Status
The LIEF project has addressed this vulnerability in commit 0033b6312fd311b2e45e379c04a83d77c1e58578 [4]. The fix includes multiple changes: proper handling of fat->size() before use, resetting load_command->size_ to 0 when reading raw data fails, and adding size checks in ThreadCommand::pc() to prevent out-of-bounds access. Users are advised to update to a version containing this fix. There is no evidence that this CVE is listed in the Known Exploited Vulnerabilities (KEV) catalog [3].
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
liefPyPI | <= 0.12.1 | — |
Affected products
2- LIEF/LIEFdescription
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
5- github.com/advisories/GHSA-42vg-2q93-fj6jghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-38495ghsaADVISORY
- github.com/lief-project/LIEF/commit/0033b6312fd311b2e45e379c04a83d77c1e58578ghsaWEB
- github.com/lief-project/LIEF/issues/767ghsax_refsource_MISCWEB
- github.com/pypa/advisory-database/tree/main/vulns/lief/PYSEC-2022-276.yamlghsaWEB
News mentions
0No linked articles in our index yet.