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
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| 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.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 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 | — |
SUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES 15 SP6 | libgit2 | 1.7.2-150600.3.3.1 | SUSE-SU-2024:2584-1 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 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 |
Alpine
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 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)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine v3.19 | libgit2 | 1.7.2-r0 | — |
Amazon Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 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
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Azure Linux 2 (CBL-Mariner) | libgit2 | 1.6.5-1 | — |
Wolfi
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Wolfi rolling | libgit2 | 1.7.2-r0 | — |
Advisories 5
- openSUSE-SU-2024:13675-1 libgit2-1_7-1.7.2-2.1 on GA media SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2024:2584-1 Security update for libgit2 SUSE / openSUSE Security Updates · Feb 4, 2026
- ALAS2023-2024-566 Important: rust security update (Amazon Linux 2023) Amazon Linux Security Center (ALAS) · Mar 21, 2024
- ALAS2-2024-2496 Important: rust security update (Amazon Linux 2) Amazon Linux Security Center (ALAS) · Mar 18, 2024
- ALAS2023-2024-541 Important: libgit2 security update (Amazon Linux 2023) Amazon Linux Security Center (ALAS) · Mar 5, 2024
References
- https://github.com/libgit2/libgit2/security/advisories/GHSA-54mf-x2rh-hq9v
- https://github.com/libgit2/libgit2/commit/add2dabb3c16aa49b33904dcdc07cd915efc12fa
- https://github.com/libgit2/libgit2/releases/tag/v1.6.5
- https://github.com/libgit2/libgit2/releases/tag/v1.7.2
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/S635BGHHZUMRPI7QOXOJ45QHDD5FFZ3S/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4M3P7WIEPXNRLBINQRJFXUSTNKBCHYC7/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7CNDW3PF6NHO7OXNM5GN6WSSGAMA7MZE/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/Z6MXOX7I43OWNN7R6M54XLG6U5RXY244/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZGNHOEE2RBLH7KCJUPUNYG4CDTW4HTBT/