Integer Overflow in Git Log and Git Archive

git Updated 02 Oct 2025

Summary

17/01/2023
N/A
Yes i
Critical
9.8

CVE-2022-41903: Git is distributed revision control system. Affects git across 3 version ranges.

< 2.32.5-r0 < 508386c6c5857b4faa2c3e491f422c98cc69ae76 >= 853373155dce195a91e6e41a58c8b8e5c5a94652, <= 2d2fc8ce733f75f497faabab85c273658c9a5f81

Fixed in 2.32.5-r0. 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 Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Git is a distributed revision control system used for tracking changes in source code during software development. It provides functionality for managing commits, branches, and repositories. The git log command displays commit history in various formats using the --format option. Similarly, git archive allows users to create archives of a Git repository. The export-subst gitattribute enables the use of git log formatting in git archive. This vulnerability affects Git versions prior to 2.30.7.

Vulnerability Detail

The vulnerability, identified as CVE-2022-41903, arises from an integer overflow in the pretty.c::format_and_pad_commit() function. This function is responsible for processing padding operators in commit formatting. Due to improper storage of a size_t as an int, an overflow occurs when the value is added as an offset to a memcpy() call. This integer overflow can be triggered directly by a user running a command that invokes the commit formatting machinery, such as git log --format=.... It can also be triggered indirectly through git archive using the export-subst mechanism. Exploiting this vulnerability can lead to arbitrary heap writes and potential code execution.

How To Fix

Minimum fixed version

2.32.5-r0

This is the first release that contains the fix.

sudo apk add --upgrade git

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

Workaround

To disable git archive in untrusted repositories, execute the following command: git config --global daemon.uploadArch false.

Conclusion

In conclusion, the integer overflow vulnerability in Git's git log and git archive functionality can lead to arbitrary heap writes and potential code execution. Users are strongly advised to upgrade their Git installations to a fixed version released on or after January 17, 2023. If upgrading is not possible, disabling git archive in untrusted repositories is recommended. For further assistance with vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for git →

Share this vulnerability

FAQ

Exploiting this vulnerability can result in arbitrary heap writes and potentially lead to arbitrary code execution.

You can use the Vulert Playground at Vulert Scanner to check if your Git installation is affected by this vulnerability. Simply upload your package-lock.json file to the playground without signing up.

Yes, the CVSS score for this vulnerability is 9.8, indicating a critical severity level.

At the time of this report, there are no known public exploits targeting this vulnerability.

If upgrading Git is not feasible, you can disable git archive in untrusted repositories to mitigate the risk associated with this vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for git.

How To Fix

Minimum fixed version

2.32.5-r0

This is the first release that contains the fix.

sudo apk add --upgrade git

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