# CVE-2022-41903: Integer overflow in \`git archive\`, \`git log --format\` leading to RCE in git

- Priority: **Prioritise**
- Reason: Severe, CVSS 9.8 (CVE.org); no exploitation reported by the 5 checked sources; EPSS 44% (FIRST, 04-12-2026)
- Next step: Check applicability: affected before 2.30.7, 2.31.6, 2.32.5, 2.33.6, 2.34.6, 2.35.6, 2.36.4, 2.37.5, 2.38.3 (CNA); fix release not confirmed
- Status: published
- Published: 2023-01-17 · Modified: 2025-03-10
- Aliases: ALPINE-CVE-2022-41903, UBUNTU-CVE-2022-41903, DEBIAN-CVE-2022-41903, CGA-mvxp-rpg7-65xg, CGA-wh8v-26rh-7874
- Record: https://cvemate.com/vulnerability/CVE-2022-41903 · JSON: https://cvemate.com/vulnerability/CVE-2022-41903/json

## Description

```text
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`.
```

## Signals

- CVSS: 9.8 critical (v3.1, CVE.org) CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- EPSS: 44.268%, percentile 98.788%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected

- alpine git (Alpine Linux): ≥ 2.31.0, \< 2.32.5-r0 \| ≥ 2.31.0, \< 2.34.6-r0 \| ≥ 2.31.0, \< 2.36.4-r0 \| ≥ 2.31.0, \< 2.38.3-r0 \| ≥ 2.31.0, \< 2.39.1-r0 \| ≥ 2.32.0, \< 2.32.5-r0 \| ≥ 2.34.0, \< 2.34.6-r0 \| ≥ 2.36.0, \< 2.36.4-r0 \| ≥ 2.38.0, \< 2.38.3-r0 \| ≥ 2.38.0, \< 2.39.1-r0
- chainguard git (Chainguard): \< 2.39.1-r0
- wolfi git (Wolfi): \< 2.39.1-r0
- debian git (Debian): \< 1:2.39.1-0.1
- ubuntu git (Ubuntu): \< 1:1.9.1-1ubuntu0.10+esm1 \| \< 1:2.7.4-0ubuntu1.10+esm4 \| \< 1:2.17.1-1ubuntu0.15 \| \< 1:2.25.1-1ubuntu3.8 \| \< 1:2.34.1-1ubuntu1.6
- git-scm git: ≤ 2.30.6 \| ≥ 2.31.0, ≤ 2.31.5 \| ≥ 2.32.0, ≤ 2.32.4 \| ≥ 2.33.0, ≤ 2.33.5 \| ≥ 2.34.0, ≤ 2.34.5 \| ≥ 2.35.0, ≤ 2.35.5 \| ≥ 2.36.0, ≤ 2.36.3 \| ≥ 2.37.0, ≤ 2.37.4 \| ≥ 2.38.0, ≤ 2.38.2 \| 2.39.0
- git git: \< 2.30.7 \| ≥ 2.31.0, \< 2.31.6 \| ≥ 2.32.0, \< 2.32.5 \| ≥ 2.33.0, \< 2.33.6 \| ≥ 2.34.0, \< 2.34.6 \| ≥ 2.35.0, \< 2.35.6 \| ≥ 2.36.0, \< 2.36.4 \| ≥ 2.37.0, \< 2.37.5 \| ≥ 2.38.0, \< 2.38.3 \| = 2.39.0

## References

- <https://github.com/git/git/security/advisories/GHSA-475x-2q3q-hvwq>
- <https://github.com/git/git/commit/508386c6c5857b4faa2c3e491f422c98cc69ae76>
- <https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_export_subst>
- <https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-emltltNgttruncltruncmtruncem>
- <https://security.gentoo.org/glsa/202312-15>
- <https://security.alpinelinux.org/vuln/CVE-2022-41903>
- <https://ubuntu.com/security/CVE-2022-41903>
- <https://ubuntu.com/security/notices/USN-5810-1>
- <https://ubuntu.com/security/notices/USN-5810-2>
- <https://ubuntu.com/security/notices/USN-5810-3>
- <https://ubuntu.com/security/notices/USN-5810-4>
- <https://www.cve.org/CVERecord?id=CVE-2022-41903>
- <https://security-tracker.debian.org/tracker/CVE-2022-41903>
- <https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/41xxx/CVE-2022-41903.json>
- <https://nvd.nist.gov/vuln/detail/CVE-2022-41903>

---

Data as of 2026-12-05T03:08:45.685Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
