Critical severity · published Jan 17, 2023
CVE-2022-41903
Git is distributed revision control system
9.8
CVSS
44.3%
EPSS
No
On KEV
Description
Git is distributed revision control system. `git log` can display commits in an arbitrary format using its `--format` specifiers. This functionality is also exposed to `git archive` via the `export-subst` gitattribute. When processing the padding operators, there is a integer overflow in `pretty.c::format_and_pad_commit()` where a `size_t` is stored improperly as an `int`, and then added as an offset to a `memcpy()`. This overflow can be triggered directly by a user running a command which invokes the commit formatting machinery (e.g., `git log --format=...`). It may also be triggered indirectly through git archive via the export-subst mechanism, which expands format specifiers inside of files within the repository during a git archive. This integer overflow can result in arbitrary heap writes, which may result in arbitrary 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. Users who are unable to upgrade should disable `git archive` in untrusted repositories. If you expose git archive via `git daemon`, disable it by running `git config --global daemon.uploadArch false`.
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Confidentiality
High
Integrity
High
Availability
High
Scope
Unchanged
Exploitation
Is it being used?
Exploit prediction (EPSS)44.3% · higher than 99% of CVEs
Exploited in the wildNo evidence yet
CISA KEVNot listed
Ransomware campaign useNot known
Affected products
Which versions
GI
Git · Git-scm
through 2.30.6; 2.31.0 through 2.31.5; 2.32.0 through 2.32.4; 2.33.0 through 2.33.5; 2.34.0 through 2.34.5; 2.35.0 through 2.35.5; +4 more · source: NVD
References
NVD
https://nvd.nist.gov/vuln/detail/CVE-2022-41903
CVE.org
https://www.cve.org/CVERecord?id=CVE-2022-41903
Vendor Advisory
https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_export_subst
Vendor Advisory
https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-emltltNgttruncltruncmtruncem
Patch
https://github.com/git/git/commit/508386c6c5857b4faa2c3e491f422c98cc69ae76
Third Party Advisory
https://github.com/git/git/security/advisories/GHSA-475x-2q3q-hvwq
security.gentoo.org
https://security.gentoo.org/glsa/202312-15
More from Git
8.0
CVE-2025-48384
Git allows arbitrary code execution through broken config quoting
9.8
CVE-2022-23521
Git is distributed revision control system
9.8
CVE-2014-9390
Git before 1.8.5.6, 1.9.x before 1.9.5, 2.0.x before 2.0.5, 2.1.x before 2.1.4, and 2.2.x before 2.2.1 on Windows and OS X; Mercurial before 3.2.3 on Windows and OS X; Apple Xcode…
9.8
CVE-2019-1353
An issue was found in Git before v2.24.1, v2.23.1, v2.22.2, v2.21.1, v2.20.2, v2.19.3, v2.18.2, v2.17.3, v2.16.6, v2.15.4, and v2.14.6
9.8
CVE-2018-19486
Git before 2.19.2 on Linux and UNIX executes commands from the current working directory (as if '.' were at the end of $PATH) in certain cases involving the run_command() API and…
