CVEfocus › CVE database › CVE-2024-24577

CVE-2024-24577libgit2 is vulnerable to arbitrary code execution due to heap corruption in…

CVSS 8.6 HighEPSS 2.0% (higher than 82% of CVEs)Published 2024-02-06Updated 2025-05-15Assigner: GitHub_M

libgit2 is a portable C implementation of the Git core methods provided as a linkable library with a solid API, allowing to build Git functionality into your application. Using well-crafted inputs to `git_index_add` can cause heap corruption that could be leveraged for arbitrary code execution. There is an issue in the `has_dir_name` function in `src/libgit2/index.c`, which frees an entry that should not be freed. The freed entry is later used and overwritten with potentially bad actor-controlled data leading to controlled heap corruption. Depending on the application that uses libgit2, this could lead to arbitrary code execution. This issue has been patched in version 1.6.5 and 1.7.2.

CWE-122

What to do

Fixed builds are available from Alpine, Debian, Ubuntu, crates.io: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

17Fixed
2Fix pending
39Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.04libgit2Not affected
vulnerable_code_not_present
Ubuntu 25.10libgit2Not affected
vulnerable_code_not_present
Ubuntu 24.04libgit2Not affected
vulnerable_code_not_present
Ubuntu 22.04libgit2Fixed1.1.0+dfsg.1-4.1ubuntu0.1UBUNTU-CVE-2024-24577
Ubuntu 20.04libgit2Fixed0.28.4+dfsg.1-2ubuntu0.1UBUNTU-CVE-2024-24577
Ubuntu 18.04libgit2Fix pending0.26.0+dfsg.1-1.1ubuntu0.2+esm1 (Ubuntu Pro)UBUNTU-CVE-2024-24577
Ubuntu 16.04libgit2Fix pending0.24.1-2ubuntu0.2+esm2 (Ubuntu Pro)UBUNTU-CVE-2024-24577
Debian 14libgit2Fixed1.7.2+ds-1DEBIAN-CVE-2024-24577
Debian 13libgit2Fixed1.7.2+ds-1DEBIAN-CVE-2024-24577
Debian 12libgit2Fixed1.5.1+ds-1+deb12u1DEBIAN-CVE-2024-24577
Red Hat Enterprise Linux 9cargoNot affected
Red Hat Enterprise Linux 9clippyNot affected
Red Hat Enterprise Linux 9rustNot affected
Red Hat Enterprise Linux 9rust-analysisNot affected
Red Hat Enterprise Linux 9rust-analyzerNot affected
Red Hat Enterprise Linux 9rust-debugger-commonNot affected
Red Hat Enterprise Linux 9rust-docNot affected
Red Hat Enterprise Linux 9rust-gdbNot affected
Red Hat Enterprise Linux 9rust-lldbNot affected
Red Hat Enterprise Linux 9rust-srcNot affected
Red Hat Enterprise Linux 9rust-std-staticNot affected
Red Hat Enterprise Linux 9rust-std-static-wasm32-unknown-unknownNot affected
Red Hat Enterprise Linux 9rust-std-static-wasm32-wasiNot affected
Red Hat Enterprise Linux 9rust-std-static-wasm32-wasip1Not affected
Red Hat Enterprise Linux 9rust-toolsetNot affected
Red Hat Enterprise Linux 9rustfmtNot affected
Red Hat Enterprise Linux 8cargoNot affected
Red Hat Enterprise Linux 8cargo-docNot affected
Red Hat Enterprise Linux 8clippyNot affected
Red Hat Enterprise Linux 8libgit2Not affected
Red Hat Enterprise Linux 8libgit2-develNot affected
Red Hat Enterprise Linux 8rlsNot affected
Red Hat Enterprise Linux 8rustNot affected
Red Hat Enterprise Linux 8rust-analysisNot affected
Red Hat Enterprise Linux 8rust-analyzerNot affected
Red Hat Enterprise Linux 8rust-debugger-commonNot affected
Red Hat Enterprise Linux 8rust-docNot affected
Red Hat Enterprise Linux 8rust-gdbNot affected
Red Hat Enterprise Linux 8rust-lldbNot affected
Red Hat Enterprise Linux 8rust-srcNot affected
Red Hat Enterprise Linux 8rust-std-staticNot affected
Red Hat Enterprise Linux 8rust-std-static-wasm32-unknown-unknownNot affected
Red Hat Enterprise Linux 8rust-std-static-wasm32-wasiNot affected
Red Hat Enterprise Linux 8rust-toolsetNot affected
Red Hat Enterprise Linux 8rustfmtNot affected
Red Hat Enterprise Linux 7libgit2Not affected
Alpine Linux 3.24ezaFixed0.18.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.24libgit2Fixed1.7.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.23ezaFixed0.18.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.23libgit2Fixed1.7.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.22ezaFixed0.18.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.22libgit2Fixed1.7.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.21ezaFixed0.18.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.21libgit2Fixed1.7.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.20ezaFixed0.18.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.20libgit2Fixed1.7.2-r0ALPINE-CVE-2024-24577
Alpine Linux 3.19libgit2Fixed1.7.2-r0ALPINE-CVE-2024-24577
crates.io librarylibgit2-sysFixed0.16.2RUSTSEC-2024-0013

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.