Vulnerabilities / CVE-2022-41903

critical

CVE-2022-41903

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

Published Modified CWE 190
In the Trivy database since at least 24 Oct 2026, 07:11 UTCWhen it arrived before that build is not recorded.

Severity by source

NVD9.8CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Red Hat9.8CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Trivy's own label is CRITICAL. Rated critical by NVD, CBL-Mariner, Photon OS. Rated lower by Red Hat (high), AlmaLinux (high), Amazon (high), Oracle (high), Rocky Linux (high), Ubuntu (medium).

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

Affected packages and fixed versions

SourcePackageFixed in
CBL-Mariner 1.0git0:2.33.6-1.cm1
CBL-Mariner 2.0git0:2.33.8-2.cm2
Photon OS 3.0git2.35.6-1.ph3
Photon OS 4.0git, git-extras, git-lang2.35.6-1.ph4
Photon OS 5.0git, git-extras, git-lang2.43.7-1.ph5
alma 8git, git-all, git-core and 12 more2.31.1-3.el8_7
alma 9git, git-all, git-core and 12 more2.31.1-3.el9_1
alpine 3.14git2.32.5-r0
alpine 3.15git2.34.6-r0
alpine 3.16git2.36.4-r0
alpine 3.17git2.38.3-r0
alpine 3.18git2.39.1-r0
Show all 227 entries from 52 sources
SourcePackageFixed in
CBL-Mariner 1.0git0:2.33.6-1.cm1
CBL-Mariner 2.0git0:2.33.8-2.cm2
Photon OS 3.0git2.35.6-1.ph3
Photon OS 4.0git2.35.6-1.ph4
Photon OS 4.0git-extras2.35.6-1.ph4
Photon OS 4.0git-lang2.35.6-1.ph4
Photon OS 5.0git2.43.7-1.ph5
Photon OS 5.0git-extras2.43.7-1.ph5
Photon OS 5.0git-lang2.43.7-1.ph5
alma 8git2.31.1-3.el8_7
alma 8git-all2.31.1-3.el8_7
alma 8git-core2.31.1-3.el8_7
alma 8git-core-doc2.31.1-3.el8_7
alma 8git-credential-libsecret2.31.1-3.el8_7
alma 8git-daemon2.31.1-3.el8_7
alma 8git-email2.31.1-3.el8_7
alma 8git-gui2.31.1-3.el8_7
alma 8git-instaweb2.31.1-3.el8_7
alma 8git-subtree2.31.1-3.el8_7
alma 8git-svn2.31.1-3.el8_7
alma 8gitk2.31.1-3.el8_7
alma 8gitweb2.31.1-3.el8_7
alma 8perl-Git2.31.1-3.el8_7
alma 8perl-Git-SVN2.31.1-3.el8_7
alma 9git2.31.1-3.el9_1
alma 9git-all2.31.1-3.el9_1
alma 9git-core2.31.1-3.el9_1
alma 9git-core-doc2.31.1-3.el9_1
alma 9git-credential-libsecret2.31.1-3.el9_1
alma 9git-daemon2.31.1-3.el9_1
alma 9git-email2.31.1-3.el9_1
alma 9git-gui2.31.1-3.el9_1
alma 9git-instaweb2.31.1-3.el9_1
alma 9git-subtree2.31.1-3.el9_1
alma 9git-svn2.31.1-3.el9_1
alma 9gitk2.31.1-3.el9_1
alma 9gitweb2.31.1-3.el9_1
alma 9perl-Git2.31.1-3.el9_1
alma 9perl-Git-SVN2.31.1-3.el9_1
alpine 3.14git2.32.5-r0
alpine 3.15git2.34.6-r0
alpine 3.16git2.36.4-r0
alpine 3.17git2.38.3-r0
alpine 3.18git2.39.1-r0
alpine 3.19git2.39.1-r0
alpine 3.20git2.39.1-r0
alpine 3.21git2.39.1-r0
alpine 3.22git2.39.1-r0
alpine 3.23git2.39.1-r0
alpine 3.24git2.39.1-r0
alpine edgegit2.39.1-r0
amazon linux 1emacs-git2.38.3-1.78.amzn1
amazon linux 1emacs-git-el2.38.3-1.78.amzn1
amazon linux 1git2.38.3-1.78.amzn1
amazon linux 1git-all2.38.3-1.78.amzn1
amazon linux 1git-bzr2.38.3-1.78.amzn1
amazon linux 1git-core2.38.3-1.78.amzn1
amazon linux 1git-core-doc2.38.3-1.78.amzn1
amazon linux 1git-cvs2.38.3-1.78.amzn1
amazon linux 1git-daemon2.38.3-1.78.amzn1
amazon linux 1git-debuginfo2.38.3-1.78.amzn1
amazon linux 1git-email2.38.3-1.78.amzn1
amazon linux 1git-hg2.38.3-1.78.amzn1
amazon linux 1git-instaweb2.38.3-1.78.amzn1
amazon linux 1git-p42.38.3-1.78.amzn1
amazon linux 1git-subtree2.38.3-1.78.amzn1
amazon linux 1git-svn2.38.3-1.78.amzn1
amazon linux 1gitweb2.38.3-1.78.amzn1
amazon linux 1perl-Git2.38.3-1.78.amzn1
amazon linux 1perl-Git-SVN2.38.3-1.78.amzn1
amazon linux 2git2.39.1-1.amzn2.0.1
amazon linux 2git-all2.39.1-1.amzn2.0.1
amazon linux 2git-core2.39.1-1.amzn2.0.1
amazon linux 2git-core-doc2.39.1-1.amzn2.0.1
amazon linux 2git-credential-libsecret2.39.1-1.amzn2.0.1
amazon linux 2git-cvs2.39.1-1.amzn2.0.1
amazon linux 2git-daemon2.39.1-1.amzn2.0.1
amazon linux 2git-debuginfo2.39.1-1.amzn2.0.1
amazon linux 2git-email2.39.1-1.amzn2.0.1
amazon linux 2git-gui2.39.1-1.amzn2.0.1
amazon linux 2git-instaweb2.39.1-1.amzn2.0.1
amazon linux 2git-p42.39.1-1.amzn2.0.1
amazon linux 2git-subtree2.39.1-1.amzn2.0.1
amazon linux 2git-svn2.39.1-1.amzn2.0.1
amazon linux 2gitk2.39.1-1.amzn2.0.1
amazon linux 2gitweb2.39.1-1.amzn2.0.1
amazon linux 2perl-Git2.39.1-1.amzn2.0.1
amazon linux 2perl-Git-SVN2.39.1-1.amzn2.0.1
amazon linux 2023git2.39.1-1.amzn2023.0.2
amazon linux 2023git-all2.39.1-1.amzn2023.0.2
amazon linux 2023git-core2.39.1-1.amzn2023.0.2
amazon linux 2023git-core-debuginfo2.39.1-1.amzn2023.0.2
amazon linux 2023git-core-doc2.39.1-1.amzn2023.0.2
amazon linux 2023git-credential-libsecret2.39.1-1.amzn2023.0.2
amazon linux 2023git-credential-libsecret-debuginfo2.39.1-1.amzn2023.0.2
amazon linux 2023git-cvs2.39.1-1.amzn2023.0.2
amazon linux 2023git-daemon2.39.1-1.amzn2023.0.2
amazon linux 2023git-daemon-debuginfo2.39.1-1.amzn2023.0.2
amazon linux 2023git-debuginfo2.39.1-1.amzn2023.0.2
amazon linux 2023git-debugsource2.39.1-1.amzn2023.0.2
amazon linux 2023git-email2.39.1-1.amzn2023.0.2
amazon linux 2023git-gui2.39.1-1.amzn2023.0.2
amazon linux 2023git-instaweb2.39.1-1.amzn2023.0.2
amazon linux 2023git-p42.39.1-1.amzn2023.0.2
amazon linux 2023git-subtree2.39.1-1.amzn2023.0.2
amazon linux 2023git-svn2.39.1-1.amzn2023.0.2
amazon linux 2023gitk2.39.1-1.amzn2023.0.2
amazon linux 2023gitweb2.39.1-1.amzn2023.0.2
amazon linux 2023perl-Git2.39.1-1.amzn2023.0.2
amazon linux 2023perl-Git-SVN2.39.1-1.amzn2023.0.2
chainguardgit2.39.1-r0
debian 10git1:2.20.1-2+deb10u7
debian 11git1:2.30.2-1+deb11u1
debian 12git1:2.39.1-0.1
debian 13git1:2.39.1-0.1
debian 14git1:2.39.1-0.1
echogit1:2.39.1-0.1
Oracle Linux 7emacs-git1.8.3.1-24.el7_9
Oracle Linux 7emacs-git-el1.8.3.1-24.el7_9
Oracle Linux 7git1.8.3.1-24.el7_9
Oracle Linux 7git-all1.8.3.1-24.el7_9
Oracle Linux 7git-bzr1.8.3.1-24.el7_9
Oracle Linux 7git-cvs1.8.3.1-24.el7_9
Oracle Linux 7git-daemon1.8.3.1-24.el7_9
Oracle Linux 7git-email1.8.3.1-24.el7_9
Oracle Linux 7git-gnome-keyring1.8.3.1-24.el7_9
Oracle Linux 7git-gui1.8.3.1-24.el7_9
Oracle Linux 7git-hg1.8.3.1-24.el7_9
Oracle Linux 7git-instaweb1.8.3.1-24.el7_9
Oracle Linux 7git-p41.8.3.1-24.el7_9
Oracle Linux 7git-svn1.8.3.1-24.el7_9
Oracle Linux 7gitk1.8.3.1-24.el7_9
Oracle Linux 7gitweb1.8.3.1-24.el7_9
Oracle Linux 7perl-Git1.8.3.1-24.el7_9
Oracle Linux 7perl-Git-SVN1.8.3.1-24.el7_9
Oracle Linux 8git2.31.1-3.el8_7
Oracle Linux 8git-all2.31.1-3.el8_7
Oracle Linux 8git-core2.31.1-3.el8_7
Oracle Linux 8git-core-doc2.31.1-3.el8_7
Oracle Linux 8git-credential-libsecret2.31.1-3.el8_7
Oracle Linux 8git-daemon2.31.1-3.el8_7
Oracle Linux 8git-email2.31.1-3.el8_7
Oracle Linux 8git-gui2.31.1-3.el8_7
Oracle Linux 8git-instaweb2.31.1-3.el8_7
Oracle Linux 8git-subtree2.31.1-3.el8_7
Oracle Linux 8git-svn2.31.1-3.el8_7
Oracle Linux 8gitk2.31.1-3.el8_7
Oracle Linux 8gitweb2.31.1-3.el8_7
Oracle Linux 8perl-Git2.31.1-3.el8_7
Oracle Linux 8perl-Git-SVN2.31.1-3.el8_7
Oracle Linux 9git2.31.1-3.el9_1
Oracle Linux 9git-all2.31.1-3.el9_1
Oracle Linux 9git-core2.31.1-3.el9_1
Oracle Linux 9git-core-doc2.31.1-3.el9_1
Oracle Linux 9git-credential-libsecret2.31.1-3.el9_1
Oracle Linux 9git-daemon2.31.1-3.el9_1
Oracle Linux 9git-email2.31.1-3.el9_1
Oracle Linux 9git-gui2.31.1-3.el9_1
Oracle Linux 9git-instaweb2.31.1-3.el9_1
Oracle Linux 9git-subtree2.31.1-3.el9_1
Oracle Linux 9git-svn2.31.1-3.el9_1
Oracle Linux 9gitk2.31.1-3.el9_1
Oracle Linux 9gitweb2.31.1-3.el9_1
Oracle Linux 9perl-Git2.31.1-3.el9_1
Oracle Linux 9perl-Git-SVN2.31.1-3.el9_1
rapidfort ubuntu 20.04git1:2.34.1-1ubuntu1.6
rapidfort ubuntu 20.04rf-git1:2.34.1-1ubuntu1.6
rapidfort ubuntu 22.04git1:2.34.1-1ubuntu1.6
rapidfort ubuntu 22.04rf-git1:2.34.1-1ubuntu1.6
rapidfort ubuntu 24.04git1:2.34.1-1ubuntu1.6
rapidfort ubuntu 24.04rf-git1:2.34.1-1ubuntu1.6
Red Hatemacs-gitno fix listed
Red Hatemacs-git-elno fix listed
Red Hatgitno fix listed
Red Hatgit-allno fix listed
Red Hatgit-cvsno fix listed
Red Hatgit-daemonno fix listed
Red Hatgit-emailno fix listed
Red Hatgit-guino fix listed
Red Hatgit-svnno fix listed
Red Hatgitkno fix listed
Red Hatgitwebno fix listed
Red Hatperl-Gitno fix listed
rocky 8git2.31.1-3.el8_7
rocky 8git-all2.31.1-3.el8_7
rocky 8git-core2.31.1-3.el8_7
rocky 8git-core-doc2.31.1-3.el8_7
rocky 8git-credential-libsecret2.31.1-3.el8_7
rocky 8git-daemon2.31.1-3.el8_7
rocky 8git-email2.31.1-3.el8_7
rocky 8git-gui2.31.1-3.el8_7
rocky 8git-instaweb2.31.1-3.el8_7
rocky 8git-subtree2.31.1-3.el8_7
rocky 8git-svn2.31.1-3.el8_7
rocky 8gitk2.31.1-3.el8_7
rocky 8gitweb2.31.1-3.el8_7
rocky 8perl-Git2.31.1-3.el8_7
rocky 8perl-Git-SVN2.31.1-3.el8_7
rocky 9git2.31.1-3.el9_1
rocky 9git-all2.31.1-3.el9_1
rocky 9git-core2.31.1-3.el9_1
rocky 9git-core-doc2.31.1-3.el9_1
rocky 9git-credential-libsecret2.31.1-3.el9_1
rocky 9git-daemon2.31.1-3.el9_1
rocky 9git-email2.31.1-3.el9_1
rocky 9git-gui2.31.1-3.el9_1
rocky 9git-instaweb2.31.1-3.el9_1
rocky 9git-subtree2.31.1-3.el9_1
rocky 9git-svn2.31.1-3.el9_1
rocky 9gitk2.31.1-3.el9_1
rocky 9gitweb2.31.1-3.el9_1
rocky 9perl-Git2.31.1-3.el9_1
rocky 9perl-Git-SVN2.31.1-3.el9_1
root.io debian 11rootio-git1:2.30.2-1+deb11u1
root.io debian 12rootio-git1:2.39.1-0.1
root.io debian 13rootio-git1:2.39.1-0.1
root.io ubuntu 22.04rootio-git1:2.34.1-1ubuntu1.6
ubuntu 14.04-ESMgit1:1.9.1-1ubuntu0.10+esm1
ubuntu 16.04-ESMgit1:2.7.4-0ubuntu1.10+esm4
ubuntu 18.04git1:2.17.1-1ubuntu0.15
ubuntu 18.04-ESMgit1:2.17.1-1ubuntu0.15
ubuntu 20.04git1:2.25.1-1ubuntu3.8
ubuntu 20.04-ESMgit1:2.25.1-1ubuntu3.8
ubuntu 22.04git1:2.34.1-1ubuntu1.6
ubuntu 22.10git1:2.37.2-1ubuntu1.2
ubuntu 23.04git1:2.39.1-0.1ubuntu1
wolfigit2.39.1-r0

References

All 26 references

Vulnerability data compiled from the Trivy vulnerability database (trivy-db, Aqua Security, Apache License 2.0), which aggregates third-party advisories. CVE records are published by The MITRE Corporation under the CVE Terms of Use; CVE is a trademark of MITRE. This product uses data from the NVD API but is not endorsed or certified by the NVD. Severity, titles and advisory data from the GitHub Advisory Database (CC BY 4.0), Red Hat security data (CC BY 4.0) and the other sources linked on each entry. Entries may be summarised or re-formatted; the linked original is the authoritative record.