Skip to content
OpenAdvisories
High · 7.5 CVE-2024-24575 EUVD-2024-21980

libgit2 is vulnerable to a denial of service attack in `git_revparse_single`

Published Feb 6, 2024 · Updated Feb 13, 2025 · Assigned by GitHub_M

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_revparse_single` can cause the function to enter an infinite loop, potentially causing a Denial of Service attack in the calling application. The revparse function in `src/libgit2/revparse.c` uses a loop to parse the user-provided spec string. There is an edge-case during parsing that allows a bad actor to force the loop conditions to access arbitrary memory. Potentially, this could also leak memory if the extracted rev spec is reflected back to the attacker. As such, libgit2 versions before 1.4.0 are not affected. Users should upgrade to version 1.6.5 or 1.7.2.

Affected products

VendorProductAffectedFixed
libgit2 libgit2 >= 1.4.0, < 1.6.5, >= 1.7.0, < 1.7.2 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 libgit2 1.7.2+ds-1 —
Debian 13 libgit2 1.7.2+ds-1 —
Debian 12 libgit2 1.5.1+ds-1+deb12u1 —
ReleasePackageFixed inAdvisory
SLES 15 SP6 libgit2 1.7.2-150600.3.3.1 SUSE-SU-2024:2584-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed libgit2 1.7.2-2.1 openSUSE-SU-2024:13675-1
openSUSE Leap 15.6 libgit2 1.7.2-150600.3.3.1 SUSE-SU-2024:2584-1
ReleasePackageFixed inAdvisory
Alpine v3.24 libgit2 1.7.2-r0 —
Alpine v3.23 libgit2 1.7.2-r0 —
Alpine v3.22 libgit2 1.7.2-r0 —
Alpine v3.21 libgit2 1.7.2-r0 —
Alpine v3.20 libgit2 1.7.2-r0 —
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 libgit2 1.7.2-r0 —

Amazon Linux

ReleasePackageFixed inAdvisory
Amazon Linux 2023 libgit2 +1 1.6.4-115.amzn2023.0.2 ALAS2023-2024-541
Amazon Linux 2023 rust +13 1.68.2-1.amzn2023.0.5 ALAS2023-2024-566
Amazon Linux 2 rust +11 1.68.2-1.amzn2.0.6 ALAS2-2024-2496

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 2 (CBL-Mariner) libgit2 1.6.5-1 —

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling libgit2 1.7.2-r0 —

Advisories 5

References