VDB

CVE-2022-41903

CVE-2022-41903 PUBLISHED CVSS 9.8 CRITICAL

Integer overflow in `git archive`, `git log --format` leading to RCE in git

Reported by github_m · Published January 17, 2023

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

Fixed versions

Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.

PackageEcosystemFixed in
git-p4Amazon Linux2.39.1-1.amzn2.0.1
gitAlpine2.39.1-r0, 2.38.3-r0, 2.36.4-r0, 2.34.6-r0, 2.32.5-r0
git-core-docAmazon Linux2.39.1-1.amzn2.0.1
git-svnAmazon Linux2.39.1-1.amzn2023.0.2, 2.39.1-1.amzn2.0.1
git-emailAmazon Linux2.39.1-1.amzn2.0.1
gitWolfi2.39.1-r0

Risk scores

CVSS 3.1
9.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Affected products

VendorProductVersions
gitgit< 2.30.7, >= 2.31.0, < 2.31.6, >= 2.32.0, < 2.32.5
amazon:2git-p40
alpinegit0, 0, 0
amazon:2git-core-doc0
amazon:2023git-svn0
amazon:2git-email0
amazon:2git-svn0
wolfigit0
gitgit0, 2.39.0, 2.34.0
amazon:2023perl-Git0
chainguardgit0
amazon:2023perl-Git-SVN0
amazon:2023gitweb0
amazon:2023git-subtree0
amazon:2perl-Git-SVN0
amazon:2git-credential-libsecret0
amazon:2023git-core-doc0
amazon:2git-gui0
amazon:2git-cvs0
amazon:2023git-p40

…and 20 more

Timeline

  • Jan 17, 2023 CVE Published
  • Jan 18, 2023 EPSS Score (30 in total, the first dated here)
  • Mar 10, 2025 CVE Updated
  • Mar 17, 2026 Security Advisory (35 in total, the first dated here)
  • Jun 15, 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-41903
vulnetix vdb fixes CVE-2022-41903

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-41903/fixes/registry"

The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart

Look up in the Resolve Platform →
$ Lookup Community · 50/day Open Lookup ›