CVE-2022-41903Integer overflow in `git archive`, `git log --format` leading to RCE in git
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`.
What to do
Fixed builds are available from AlmaLinux, Alpine, Debian, Red Hat, Rocky Linux, Ubuntu: see the table below for the fixed version per release.
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 22.04 | git | Fixed | 1:2.34.1-1ubuntu1.6 | UBUNTU-CVE-2022-41903 |
| Ubuntu 20.04 | git | Fixed | 1:2.25.1-1ubuntu3.8 | UBUNTU-CVE-2022-41903 |
| Ubuntu 18.04 | git | Fixed | 1:2.17.1-1ubuntu0.15 | UBUNTU-CVE-2022-41903 |
| Ubuntu 16.04 | git | Fix pending | 1:2.7.4-0ubuntu1.10+esm4 (Ubuntu Pro) | UBUNTU-CVE-2022-41903 |
| Ubuntu 14.04 | git | Fix pending | 1:1.9.1-1ubuntu0.10+esm1 (Ubuntu Pro) | UBUNTU-CVE-2022-41903 |
| Debian 14 | git | Fixed | 1:2.39.1-0.1 | DEBIAN-CVE-2022-41903 |
| Debian 13 | git | Fixed | 1:2.39.1-0.1 | DEBIAN-CVE-2022-41903 |
| Debian 12 | git | Fixed | 1:2.39.1-0.1 | DEBIAN-CVE-2022-41903 |
| Red Hat Enterprise Linux 9 | git | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-all | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-core | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-core-doc | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-credential-libsecret | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-daemon | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-email | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-gui | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-instaweb | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-subtree | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | git-svn | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | gitk | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | gitweb | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | perl-Git | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 9 | perl-Git-SVN | Fixed | 0:2.31.1-3.el9_1 | RHSA-2023:0611 |
| Red Hat Enterprise Linux 8 | git | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-all | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-core | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-core-doc | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-credential-libsecret | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-daemon | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-email | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-gui | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-instaweb | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-subtree | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | git-svn | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | gitk | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | gitweb | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | perl-Git | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 8 | perl-Git-SVN | Fixed | 0:2.31.1-3.el8_7 | RHSA-2023:0610 |
| Red Hat Enterprise Linux 7 | emacs-git | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | emacs-git-el | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-all | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-bzr | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-cvs | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-daemon | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-email | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-gnome-keyring | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-gui | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-hg | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-instaweb | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-p4 | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | git-svn | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | gitk | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | gitweb | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | perl-Git | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 7 | perl-Git-SVN | Fixed | 0:1.8.3.1-24.el7_9 | RHSA-2023:0978 |
| Red Hat Enterprise Linux 6 | emacs-git | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | emacs-git-el | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-all | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-cvs | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-daemon | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-email | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-gui | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | git-svn | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | gitk | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | gitweb | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | perl-Git | Will not fix Out of support scope | ||
| AlmaLinux 9 | git | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-all | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-core | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-core-doc | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-credential-libsecret | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-daemon | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-email | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-gui | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-instaweb | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-subtree | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | git-svn | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | gitk | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | gitweb | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | perl-Git | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 9 | perl-Git-SVN | Fixed | 2.31.1-3.el9_1 | ALSA-2023:0611 |
| AlmaLinux 8 | git | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-all | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-core | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-core-doc | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-credential-libsecret | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-daemon | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-email | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-gui | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-instaweb | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-subtree | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | git-svn | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | gitk | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | gitweb | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | perl-Git | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| AlmaLinux 8 | perl-Git-SVN | Fixed | 2.31.1-3.el8_7 | ALSA-2023:0610 |
| Rocky Linux 9 | git | Fixed | 0:2.31.1-3.el9_1 | RLSA-2023:0611 |
| Rocky Linux 8 | git | Fixed | 0:2.31.1-3.el8_7 | RLSA-2023:0610 |
| Alpine Linux 3.24 | git | Fixed | 2.39.1-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.23 | git | Fixed | 2.39.1-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.22 | git | Fixed | 2.39.1-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.21 | git | Fixed | 2.39.1-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.20 | git | Fixed | 2.39.1-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.19 | git | Fixed | 2.39.1-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.18 | git | Fixed | 2.39.1-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.17 | git | Fixed | 2.38.3-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.16 | git | Fixed | 2.36.4-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.15 | git | Fixed | 2.34.6-r0 | ALPINE-CVE-2022-41903 |
| Alpine Linux 3.14 | git | Fixed | 2.32.5-r0 | ALPINE-CVE-2022-41903 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- git: affected: < 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
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
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.