Heap-buffer-overflow in libgit2

libgit2 Updated 02 Oct 2025

Summary

12/01/2021
MEDIUM
Yes i
Medium
Not published

OSV-2018-3: Heap-buffer-overflow in git__strntol64. Affects libgit2 versions >= a1d5fd0630c6f7e3ac23bc9e13ba33901dfddba4, < 52f859fd534e3c16c2c03b9a2375f00a50f3996e. Fixed in 52f859fd534e3c16c2c03b9a2375f00a50f3996e. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

libgit2 is an open-source library that provides a low-level API for interacting with Git repositories. It is widely used in various software applications to perform Git operations programmatically. This vulnerability in libgit2 is a heap-buffer-overflow issue that can lead to a crash or potentially allow an attacker to execute arbitrary code.

Vulnerability Detail

The vulnerability occurs in the git__strntol64 function of libgit2. It is triggered when parsing a Git signature, and it results in a heap-buffer-overflow read of 1 byte. This can be exploited by an attacker to read sensitive information from the heap or cause a denial-of-service condition. The vulnerability was reported through the OSS-Fuzz project and has a medium severity rating.

How To Fix

Minimum fixed version

52f859fd534e3c16c2c03b9a2375f00a50f3996e

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no specific workaround mentioned for this vulnerability. However, as a general best practice, it is recommended to keep software dependencies up to date and follow secure coding practices to minimize the risk of exploitation.

Conclusion

The heap-buffer-overflow vulnerability in libgit2 can pose a risk to applications that utilize the library for Git operations. It is crucial to update to a fixed version of libgit2 and follow secure coding practices to mitigate the risk. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for libgit2 →

Share this vulnerability

FAQ

libgit2 is an open-source library that provides a low-level API for interacting with Git repositories. It allows developers to perform Git operations programmatically.

A heap-buffer-overflow is a type of memory vulnerability where a program writes or reads data beyond the bounds of a heap-allocated buffer. This can lead to crashes, information leaks, or even code execution.

An attacker can exploit this vulnerability by crafting a malicious Git signature that triggers the heap-buffer-overflow. This can potentially allow them to read sensitive information from the heap or cause a denial-of-service condition.

This vulnerability has a medium severity rating. While it can lead to crashes or potential code execution, it requires a specific set of conditions to be met for exploitation.

To protect your application, it is recommended to update libgit2 to a version that includes the fix. Additionally, following secure coding practices and keeping software dependencies up to date can help minimize the risk of exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for libgit2.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

52f859fd534e3c16c2c03b9a2375f00a50f3996e

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback