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

High 8.6 Published Updated

Attackers can achieve arbitrary code execution via heap corruption in libgit2's git_index_add function using crafted inputs.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-24577?

CVE-2024-24577 is a high-severity memory corruption vulnerability in libgit2, published on 6 Feb 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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.

Weakness: CWE-119, CWE-122

Which versions are affected by CVE-2024-24577?

It affects 1 product.

Linux distribution packages (40)
git SUSE:Enterprise Storage 7.1All versions2.35.3-150300.10.42.1
libgit2 SUSE:Enterprise Storage 7.1All versions0.28.4-150200.3.9.1
git SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions2.26.2-150000.59.1
libgit2 SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions0.26.8-150000.3.21.1
libgit2 SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions0.28.4-150200.3.9.1
git SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions2.35.3-150300.10.42.1
libgit2 SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions0.28.4-150200.3.9.1
git SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOSAll versions2.35.3-150300.10.42.1
libgit2 SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOSAll versions1.3.0-150400.3.9.1
git SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSSAll versions2.35.3-150300.10.42.1
libgit2 SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSSAll versions1.3.0-150400.3.9.1
git SUSE:Linux Enterprise Micro 5.5All versions2.35.3-150300.10.42.1
git SUSE:Linux Enterprise Module for Basesystem 15 SP5All versions2.35.3-150300.10.42.1
git SUSE:Linux Enterprise Module for Basesystem 15 SP6All versions2.43.0-150600.3.6.1
git SUSE:Linux Enterprise Module for Development Tools 15 SP5All versions2.35.3-150300.10.42.1
libgit2 SUSE:Linux Enterprise Module for Development Tools 15 SP5All versions1.3.0-150400.3.9.1
git SUSE:Linux Enterprise Module for Development Tools 15 SP6All versions2.43.0-150600.3.6.1
git SUSE:Linux Enterprise Server 12 SP5All versions2.26.2-27.75.1
git SUSE:Linux Enterprise Server 15 SP2-LTSSAll versions2.26.2-150000.59.1
libgit2 SUSE:Linux Enterprise Server 15 SP2-LTSSAll versions0.26.8-150000.3.21.1
libgit2 SUSE:Linux Enterprise Server 15 SP2-LTSSAll versions0.28.4-150200.3.9.1
git SUSE:Linux Enterprise Server 15 SP3-LTSSAll versions2.35.3-150300.10.42.1
libgit2 SUSE:Linux Enterprise Server 15 SP3-LTSSAll versions0.28.4-150200.3.9.1
git SUSE:Linux Enterprise Server 15 SP4-LTSSAll versions2.35.3-150300.10.42.1
libgit2 SUSE:Linux Enterprise Server 15 SP4-LTSSAll versions1.3.0-150400.3.9.1
git SUSE:Linux Enterprise Server for SAP Applications 12 SP5All versions2.26.2-27.75.1
git SUSE:Linux Enterprise Server for SAP Applications 15 SP2All versions2.26.2-150000.59.1
libgit2 SUSE:Linux Enterprise Server for SAP Applications 15 SP2All versions0.26.8-150000.3.21.1
libgit2 SUSE:Linux Enterprise Server for SAP Applications 15 SP2All versions0.28.4-150200.3.9.1
git SUSE:Linux Enterprise Server for SAP Applications 15 SP3All versions2.35.3-150300.10.42.1
libgit2 SUSE:Linux Enterprise Server for SAP Applications 15 SP3All versions0.28.4-150200.3.9.1
git SUSE:Linux Enterprise Server for SAP Applications 15 SP4All versions2.35.3-150300.10.42.1
libgit2 SUSE:Linux Enterprise Server for SAP Applications 15 SP4All versions1.3.0-150400.3.9.1
git SUSE:Linux Enterprise Software Development Kit 12 SP5All versions2.26.2-27.75.1
libgit2 SUSE:Linux Enterprise Software Development Kit 12 SP5All versions0.24.1-11.5.1
git SUSE:Manager Proxy 4.3All versions2.35.3-150300.10.42.1
git SUSE:Manager Server 4.3All versions2.35.3-150300.10.42.1
libgit2 SUSE:Manager Server Module 4.3All versions0.28.4-150200.3.9.1
git openSUSE:Leap 15.5All versions2.35.3-150300.10.42.1
libgit2 openSUSE:Leap 15.5All versions1.3.0-150400.3.9.1

Products include Libgit2 Libgit2.

How do I fix CVE-2024-24577?

Upgrade to a fixed version.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2024-24577 being exploited?

There is no known exploitation of CVE-2024-24577 in the wild and no public exploit code.

Sources

Also known as AZL-34274, BELL-CVE-2024-24577, CLEANSTART-2024-DS47827, DEBIAN-CVE-2024-24577, DLA-3742-1, DSA-5619-1 and 17 more.

Is CVE-2024-24577 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free