CVE-2022-43171: Lief :MachO::BinaryParser::parse_dyldinfo_generic_bind Vulnerability

HIGH
Advisory Identifier: GHSA-jvp9-phwp-p738
CVSS 6.5
CWE-122 CWE-787
Published
Advisory Summary

CVE-2022-43171 is a HIGH (CVSS 6.5) :macho::binaryparser::parse_dyldinfo_generic_bind vulnerability (CWE-122: Heap-based Buffer Overflow) affecting Lief libraries in the PyPI ecosystem. The issue involves :macho::binaryparser::parse_dyldinfo_generic_bind. Remediation is available by upgrading affected packages to version 0.12.3.

CVE-2022-43171 at a Glance

CVE Identifier CVE-2022-43171
GHSA Identifier GHSA-jvp9-phwp-p738
Severity HIGH
CVSS v3.1 Base Score 6.5
CWE Classification CWE-122: Heap-based Buffer Overflow
Affected Product Lief
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2022-43171

To remediate this vulnerability, upgrade all affected Lief dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

lief fixed: 0.12.3
pip install lief>=0.12.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show lief

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2022-43171, inspect your installed packages using pip:

pip show lief

Analyze the terminal output to locate any version of Lief in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.12.3), your application is affected.

Note: The pip show lief command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-122: Heap-based Buffer Overflow, where a heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc(). In Lief, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A heap buffer overflow in the LIEF::MachO::BinaryParser::parse_dyldinfo_generic_bind function of LIEF prior to version 0.12.3 allows attackers to cause a Denial of Service (DoS) via a crafted MachO file.

CVE-2022-43171 Affected Lief Versions

1 component(s)
Fixed Versions:
0.12.3
Product / Package Ecosystem Affected Versions Fixed Version
lief
PyPI
< 0.12.3
0.12.3

References

Frequently Asked Questions

What is CVE-2022-43171?
CVE-2022-43171 is a security vulnerability in Lief involving :MachO::BinaryParser::parse_dyldinfo_generic_bind under CWE-122: Heap-based Buffer Overflow.
Which Lief versions are affected?
Affected versions include releases prior to 0.12.3 across affected packages: lief.
What version fixes CVE-2022-43171?
Upgrading to 0.12.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is lief affected?
Yes, lief is affected in releases prior to 0.12.3. Upgrade your dependency to 0.12.3 or later.
What is the CVSS score of CVE-2022-43171?
CVE-2022-43171 has a CVSS v3.1 base score of 6.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-43171?
CVE-2022-43171 is classified under CWE-122: Heap-based Buffer Overflow (A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().).
How can I check PyPI dependencies for CVE-2022-43171?
Run the dependency tree command: 'pip show lief'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jvp9-phwp-p738",
  "modified" : "2025-04-29T18:33:53Z",
  "published" : "2022-11-18T00:30:18Z",
  "aliases" : [ "CVE-2022-43171" ],
  "summary" : "LIEF heap buffer overflow in the LIEF::MachO::BinaryParser::parse_dyldinfo_generic_bind",
  "details" : "A heap buffer overflow in the LIEF::MachO::BinaryParser::parse_dyldinfo_generic_bind function of LIEF prior to version 0.12.3 allows attackers to cause a Denial of Service (DoS) via a crafted MachO file.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "lief"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.12.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-43171"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lief-project/LIEF/issues/782"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lief-project/LIEF"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/lief/PYSEC-2022-43140.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-122", "CWE-787" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-21T22:14:08Z",
    "nvd_published_at" : "2022-11-17T23:15:00Z"
  }
}