CVE-2022-23521
gitattributes parsing integer overflow in git
Reported by github_m · Published January 17, 2023
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.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| git-svn | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1 |
| perl-Git | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1 |
| git-cvs | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1 |
| git-instaweb | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1 |
| git-core | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1 |
| gitweb | Amazon Linux | 2.39.1-1.amzn2023.0.2 |
| git-subtree | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1 |
| git | Chainguard | 2.39.1-r0 |
| git-core-doc | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1 |
| git-gui | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1 |
| git-email | Amazon Linux | 2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1 |
| perl-Git-SVN | Amazon Linux | 2.39.1-1.amzn2.0.1 |
6 more packages have a fixed version. See every fix in Lookup.
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| git | git | < 2.30.7, >= 2.31.0, < 2.31.6, >= 2.32.0, < 2.32.5 |
| amazon:2023 | git-svn | 0 |
| amazon:2 | perl-Git | 0 |
| amazon:2 | git-cvs | 0 |
| amazon:2 | git-instaweb | 0 |
| amazon:2 | git-core | 0 |
| amazon:2023 | gitweb | 0 |
| amazon:2 | git-subtree | 0 |
| chainguard | git | 0 |
| amazon:2 | git-core-doc | 0 |
| amazon:2 | git-gui | 0 |
| amazon:2 | git-email | 0 |
| amazon:2 | perl-Git-SVN | 0 |
| amazon:2023 | git-cvs | 0 |
| amazon:2 | gitk | 0 |
| amazon:2023 | git-core | 0 |
| amazon:2 | git | 0 |
| amazon:2023 | git-subtree | 0 |
| amazon:2 | git-credential-libsecret | 0 |
| amazon:2 | git-p4 | 0 |
…and 19 more
Timeline
- Jan 17, 2023 CVE Published
- Jan 18, 2023 EPSS Score (30 in total, the first dated here)
- Feb 13, 2025 CVE Updated
- Mar 10, 2026 Security Advisory (36 in total, the first dated here)
- Jul 5, 2026 Coalition ESS Score
- Aug 11, 2026 Distribution Patch (33 in total, the first dated here)
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2022-23521
vulnetix vdb fixes CVE-2022-23521
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2022-23521/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart
References
- https://github.com/git/git/security/advisories/GHSA-c738-c5qq-xg89 x_refsource_CONFIRM
- https://github.com/git/git/commit/508386c6c5857b4faa2c3e491f422c98cc69ae76 x_refsource_MISC