Appsecure logo

CVE-2022-41903: Critical Vulnerability in Git

A critical integer overflow vulnerability in Git could lead to arbitrary code execution. Users should upgrade to patched versions immediately to mitigate risks.

CRITICALPublic ExploitCVSS 9.8 · Published January 17, 2023

Not a customer? See how AppSecure simulates real world attacks to protect your infrastructure.

Speak to Experts

CVE-2022-41903 is a critical vulnerability affecting the Git distributed revision control system. This vulnerability allows an integer overflow during the processing of commit formatting, particularly when using the `--format` specifiers in commands like `git log`. The flaw can be exploited directly by users or indirectly through the `git archive` functionality. As a result, this could lead to arbitrary heap writes and, ultimately, arbitrary code execution.

The vulnerability has been assigned a CVSS score of 9.8, categorizing it as critical. The high-impact nature of the vulnerability stems from its ability to affect confidentiality, integrity, and availability. Organizations that utilize Git are at risk of significant consequences if this vulnerability is exploited.

The problem has been patched in versions released on January 17, 2023, and users are strongly encouraged to upgrade to versions 2.30.7 and later. For those unable to upgrade, it is advised to disable the `git archive` feature in untrusted repositories to mitigate the risk.

Organizations should prioritize patching immediately to prevent potential exploitation of this vulnerability.

Vulnerability Details

The official description states that Git's `git log` command can display commits in an arbitrary format using `--format` specifiers. This functionality is also available in `git archive` through the `export-subst` gitattribute. An integer overflow occurs in `pretty.c::format_and_pad_commit()`, where a `size_t` is improperly stored as an `int` before being used as an offset in a `memcpy()` function. This vulnerability can be triggered by commands invoking commit formatting and may also be leveraged through `git archive`.

The CVSS score of 9.8 indicates a critical severity level, highlighting the need for immediate action. The attack vector is network-based, requiring no privileges or user interaction to exploit. The impacts on confidentiality, integrity, and availability are all rated as high.

Technical Analysis

The root cause of this vulnerability is the improper handling of data types during integer operations. Specifically, a `size_t` variable that is intended to hold a large unsigned integer is mistakenly treated as an `int`, which can overflow when subjected to certain operations. This can lead to arbitrary writes in memory, which attackers can exploit to execute arbitrary code.

The attack vector for this vulnerability is network-based, meaning that an attacker can potentially exploit it over the internet. The attack complexity is low, as it does not require any special conditions or extensive preparation. Importantly, there are no privileges required for exploitation and no user interaction is necessary.

The impacts of the vulnerability include high confidentiality, integrity, and availability risks, as an attacker could manipulate the Git environment to execute arbitrary code, leading to severe consequences for affected systems.

Risk & Impact Analysis

Organizations utilizing Git are at a significant risk due to the critical nature of this vulnerability. The potential for arbitrary code execution allows attackers to compromise systems, leading to unauthorized access, data breaches, and significant operational disruptions.

As this vulnerability is not included in the Known Exploited Vulnerabilities (KEV) catalog, there may be a lack of awareness regarding its severity among some organizations. However, the EPSS score, which indicates a 96th percentile risk, underscores the importance of addressing this vulnerability promptly. The urgent nature of this issue cannot be overstated, and organizations should prioritize remediation efforts.

Exploitation Status

Signal

Status

Known Exploit

Yes

Public PoC

Yes

Actively Exploited

No

Ransomware Use

No

Affected Versions

The vulnerability affects all Git versions prior to the patch released on January 17, 2023. Specifically, it includes versions up to 2.30.6 and versions from 2.31.0 to 2.31.5, 2.32.0 to 2.32.4, 2.33.0 to 2.33.5, 2.34.0 to 2.34.5, 2.35.0 to 2.35.5, 2.36.0 to 2.36.3, 2.37.0 to 2.37.4, 2.38.0 to 2.38.2, and 2.39.0.

Mitigation & Remediation

To mitigate the risk of exploitation, organizations should upgrade to the latest version of Git, specifically version 2.30.7 or later. In cases where immediate upgrades are not feasible, it is recommended to disable the `git archive` feature in untrusted repositories. This can be done by running the command `git config --global daemon.uploadArch false` if using `git daemon`.

Organizations should also consider implementing network controls to restrict access to Git services from untrusted networks and continuously monitor for any suspicious activity related to Git operations.

Detection Guidance

Monitoring logs for unusual patterns in Git commands, especially those involving `git log` and `git archive`, can help detect potential exploitation attempts. Behavioral anomalies such as unexpected command executions or unauthorized access to Git repositories should also be investigated.

AppSecure Threat Intelligence Insight

CVE-2022-41903 represents a significant threat to organizations using Git, highlighting the importance of secure coding practices and thorough testing of software components. This vulnerability underscores the potential risks associated with integer overflows, which can lead to severe security issues.

Security teams should prioritize the adoption of comprehensive vulnerability management programs to proactively identify and remediate vulnerabilities. For more insights on vulnerability management, organizations can refer to our vulnerability management program design guidelines.

Additionally, conducting regular penetration testing can aid in identifying vulnerabilities before they can be exploited. For further details on penetration testing practices, consult our guide on penetration testing methodology.

Lastly, organizations should remain vigilant about emerging threats and trends in the cybersecurity landscape. Keeping abreast of security advisories and best practices is crucial for maintaining a robust security posture. For more information on current trends, please refer to our blog on ransomware targeting trends.

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Latest CVEs. Recently published vulnerabilities from the NVD database.

View all vulnerabilities
CVE IDSeverity
CVE-2025-65418HIGH
CVE-2025-65417MEDIUM
CVE-2025-65416MEDIUM
CVE-2025-65415MEDIUM
CVE-2025-61314HIGH

Protect Your Business with Hacker-Focused Approach.