CVE-2022-38307: Lief LIEF Contains Segmentation Violation Vulnerability

MODERATE
Advisory Identifier: GHSA-x2xx-jw5m-5j86
CVSS 5.5
CWE-476
Published
Advisory Summary

CVE-2022-38307 is a MODERATE (CVSS 5.5) lief contains segmentation violation vulnerability (CWE-476: NULL Pointer Dereference) affecting Lief libraries in the PyPI ecosystem. The issue involves lief contains segmentation violation. Remediation is available by upgrading affected packages to version 0.12.1.

CVE-2022-38307 at a Glance

CVE Identifier CVE-2022-38307
GHSA Identifier GHSA-x2xx-jw5m-5j86
Severity MODERATE
CVSS v3.1 Base Score 5.5
CWE Classification CWE-476: NULL Pointer Dereference
Affected Product Lief
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.5

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

Attack Vector Local (AV:L)
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-38307

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.1
pip install lief>=0.12.1
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-38307, 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.1), 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-476: NULL Pointer Dereference, where the product dereferences a pointer that it expects to be valid but is null. 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

LIEF commit 5d1d643 was discovered to contain a segmentation violation via the function `LIEF::MachO::SegmentCommand::file_offset()` at `/MachO/SegmentCommand.cpp`. Commit 7acf0bc4224081d4f425fcc8b2e361b95291d878 contains a patch.

CVE-2022-38307 Affected Lief Versions

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

References

Frequently Asked Questions

What is CVE-2022-38307?
CVE-2022-38307 is a security vulnerability in Lief involving LIEF contains segmentation violation under CWE-476: NULL Pointer Dereference.
Which Lief versions are affected?
Affected versions include releases prior to 0.12.1 across affected packages: lief.
What version fixes CVE-2022-38307?
Upgrading to 0.12.1 (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.1. Upgrade your dependency to 0.12.1 or later.
What is the CVSS score of CVE-2022-38307?
CVE-2022-38307 has a CVSS v3.1 base score of 5.5 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-38307?
CVE-2022-38307 is classified under CWE-476: NULL Pointer Dereference (The product dereferences a pointer that it expects to be valid but is NULL.).
How can I check PyPI dependencies for CVE-2022-38307?
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-x2xx-jw5m-5j86",
  "modified" : "2022-09-20T22:06:28Z",
  "published" : "2022-09-14T00:00:42Z",
  "aliases" : [ "CVE-2022-38307" ],
  "summary" : "LIEF contains segmentation violation",
  "details" : "LIEF commit 5d1d643 was discovered to contain a segmentation violation via the function `LIEF::MachO::SegmentCommand::file_offset()` at `/MachO/SegmentCommand.cpp`. Commit 7acf0bc4224081d4f425fcc8b2e361b95291d878 contains a patch.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "lief"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.12.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-38307"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lief-project/LIEF/issues/764"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lief-project/LIEF/commit/7acf0bc4224081d4f425fcc8b2e361b95291d878"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/lief/PYSEC-2022-275.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-476" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-20T22:06:28Z",
    "nvd_published_at" : "2022-09-13T21:15:00Z"
  }
}