{"id":"CVE-2022-41903","summary":"Integer overflow in `git archive`, `git log --format` leading to RCE in git","details":"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`.","aliases":["GHSA-475x-2q3q-hvwq"],"modified":"2026-04-16T04:34:16.781981603Z","published":"2023-01-17T22:17:16.123Z","related":["ALSA-2023:0610","ALSA-2023:0611","CGA-2vq3-chq9-2r3w","SUSE-SU-2023:0108-1","SUSE-SU-2023:0109-1","SUSE-SU-2023:0110-1","openSUSE-SU-2024:12625-1"],"database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/41xxx/CVE-2022-41903.json","cwe_ids":["CWE-190"],"cna_assigner":"GitHub_M"},"references":[{"type":"WEB","url":"https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_export_subst"},{"type":"WEB","url":"https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-emltltNgttruncltruncmtruncem"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/41xxx/CVE-2022-41903.json"},{"type":"ADVISORY","url":"https://github.com/git/git/security/advisories/GHSA-475x-2q3q-hvwq"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-41903"},{"type":"ADVISORY","url":"https://security.gentoo.org/glsa/202312-15"},{"type":"FIX","url":"https://github.com/git/git/commit/508386c6c5857b4faa2c3e491f422c98cc69ae76"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"0"},{"fixed":"b7b37a33711e64bf580ef3141878b12a36e28833"},{"last_affected":"c48035d29b4e524aed3a32f0403676f0d9128863"}],"database_specific":{"versions":[{"introduced":"0"},{"fixed":"2.30.7"},{"last_affected":"= 2.39.0"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"a5828ae6b52137b913b978e16cd2334482eb4c1f"},{"fixed":"82689d5e5d3f41da2ab1fbf9fbe7aacfd6da74c1"}],"database_specific":{"versions":[{"introduced":"2.31.0"},{"fixed":"2.31.6"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"ebf3c04b262aa27fbb97f8a0156c2347fecafafb"},{"fixed":"d96ea538e8dd0fcf381089a3b09c0a9af3617351"}],"database_specific":{"versions":[{"introduced":"2.32.0"},{"fixed":"2.32.5"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"225bc32a989d7a22fa6addafd4ce7dcd04675dbf"},{"fixed":"7fe9bf55b84d2610a7ac09893b25ef188f145a21"}],"database_specific":{"versions":[{"introduced":"2.33.0"},{"fixed":"2.33.6"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"cd3e606211bb1cf8bc57f7d76bab98cc17a150bc"},{"fixed":"6c9466944c90c236217ec6f9ce5ed6b0e73903f9"}],"database_specific":{"versions":[{"introduced":"2.34.0"},{"fixed":"2.34.6"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"89bece5c8c96f0b962cfc89e63f82d603fd60bed"},{"fixed":"02f498172348f7ba9dceb169305b74c7eca7a38d"}],"database_specific":{"versions":[{"introduced":"2.35.0"},{"fixed":"2.35.6"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e"},{"fixed":"ad949b24f8d6ee4767c07794a2f01ada91b46b74"}],"database_specific":{"versions":[{"introduced":"2.36.0"},{"fixed":"2.36.4"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"e4a4b31577c7419497ac30cebe30d755b97752c5"},{"fixed":"e43ac5f23d3231f6433558931296d555592e978a"}],"database_specific":{"versions":[{"introduced":"2.37.0"},{"fixed":"2.37.5"}]}},{"type":"GIT","repo":"https://github.com/git/git","events":[{"introduced":"3dcec76d9df911ed8321007b1d197c1a206dc164"},{"fixed":"37ed7bf0f13d204ccb6b8e7e2fbcf7b3bf13e25c"}],"database_specific":{"versions":[{"introduced":"2.38.0"},{"fixed":"2.38.3"}]}}],"versions":["v0.99","v0.99.1","v0.99.2","v0.99.3","v0.99.4","v0.99.5","v0.99.6","v0.99.7","v0.99.8","v0.99.8a","v0.99.8b","v0.99.8c","v0.99.8d","v0.99.8e","v0.99.8f","v0.99.8g","v0.99.9a","v0.99.9b","v0.99.9c","v0.99.9d","v0.99.9e","v0.99.9f","v0.99.9g","v0.99.9h","v0.99.9i","v0.99.9j","v0.99.9k","v0.99.9l","v0.99.9m","v0.99.9n","v1.0.0","v1.0rc1","v1.0rc2","v1.0rc3","v1.0rc4","v1.0rc5","v1.0rc6","v1.1.0","v1.2.0","v1.3.0-rc1","v1.4.1","v1.4.1-rc1","v1.4.1-rc2","v1.4.2","v1.4.2-rc1","v1.4.2-rc2","v1.4.2-rc3","v1.4.2-rc4","v1.4.3","v1.4.3-rc1","v1.4.3-rc2","v1.4.3-rc3","v1.4.4","v1.4.4-rc1","v1.4.4-rc2","v1.4.4.1","v1.5.0","v1.5.0-rc0","v1.5.0-rc1","v1.5.0-rc2","v1.5.0-rc3","v1.5.0-rc4","v1.5.1","v1.5.1-rc1","v1.5.1-rc2","v1.5.1-rc3","v1.5.2","v1.5.2-rc0","v1.5.2-rc1","v1.5.2-rc2","v1.5.2-rc3","v1.5.3","v1.5.3-rc0","v1.5.3-rc1","v1.5.3-rc2","v1.5.3-rc3","v1.5.3-rc4","v1.5.3-rc5","v1.5.3-rc6","v1.5.3-rc7","v1.5.3.1","v1.5.4","v1.5.4-rc0","v1.5.4-rc1","v1.5.4-rc2","v1.5.4-rc3","v1.5.4-rc4","v1.5.4-rc5","v1.5.5","v1.5.5-rc0","v1.5.5-rc1","v1.5.5-rc2","v1.5.5-rc3","v1.5.6","v1.5.6-rc0","v1.5.6-rc1","v1.5.6-rc2","v1.5.6-rc3","v1.6.0","v1.6.0-rc0","v1.6.0-rc1","v1.6.0-rc2","v1.6.0-rc3","v1.6.1","v1.6.1-rc1","v1.6.1-rc2","v1.6.1-rc3","v1.6.1-rc4","v1.6.2","v1.6.2-rc0","v1.6.2-rc1","v1.6.2-rc2","v1.6.3","v1.6.3-rc0","v1.6.3-rc1","v1.6.3-rc2","v1.6.3-rc3","v1.6.3-rc4","v1.6.4","v1.6.4-rc0","v1.6.4-rc1","v1.6.4-rc2","v1.6.4-rc3","v1.6.5","v1.6.5-rc0","v1.6.5-rc1","v1.6.5-rc2","v1.6.5-rc3","v1.6.6","v1.6.6-rc0","v1.6.6-rc1","v1.6.6-rc2","v1.6.6-rc3","v1.6.6-rc4","v1.7.0","v1.7.0-rc0","v1.7.0-rc1","v1.7.0-rc2","v1.7.1","v1.7.1-rc0","v1.7.1-rc1","v1.7.1-rc2","v1.7.10","v1.7.10-rc0","v1.7.10-rc1","v1.7.10-rc2","v1.7.10-rc3","v1.7.10-rc4","v1.7.11","v1.7.11-rc0","v1.7.11-rc1","v1.7.11-rc2","v1.7.11-rc3","v1.7.12","v1.7.12-rc0","v1.7.12-rc1","v1.7.12-rc2","v1.7.12-rc3","v1.7.2","v1.7.2-rc0","v1.7.2-rc1","v1.7.2-rc2","v1.7.2-rc3","v1.7.3","v1.7.3-rc0","v1.7.3-rc1","v1.7.3-rc2","v1.7.3.1","v1.7.4","v1.7.4-rc0","v1.7.4-rc1","v1.7.4-rc2","v1.7.4-rc3","v1.7.5","v1.7.5-rc0","v1.7.5-rc1","v1.7.5-rc2","v1.7.5-rc3","v1.7.6","v1.7.6-rc0","v1.7.6-rc1","v1.7.6-rc2","v1.7.6-rc3","v1.7.7","v1.7.7-rc0","v1.7.7-rc1","v1.7.7-rc2","v1.7.7-rc3","v1.7.8","v1.7.8-rc0","v1.7.8-rc1","v1.7.8-rc2","v1.7.8-rc3","v1.7.8-rc4","v1.7.9","v1.7.9-rc0","v1.7.9-rc1","v1.7.9-rc2","v1.8.0","v1.8.0-rc0","v1.8.0-rc1","v1.8.0-rc2","v1.8.0-rc3","v1.8.1","v1.8.1-rc0","v1.8.1-rc1","v1.8.1-rc2","v1.8.1-rc3","v1.8.2","v1.8.2-rc0","v1.8.2-rc1","v1.8.2-rc2","v1.8.2-rc3","v1.8.3","v1.8.3-rc0","v1.8.3-rc1","v1.8.3-rc2","v1.8.3-rc3","v1.8.4","v1.8.4-rc0","v1.8.4-rc1","v1.8.4-rc2","v1.8.4-rc3","v1.8.4-rc4","v1.8.5","v1.8.5-rc0","v1.8.5-rc1","v1.8.5-rc2","v1.8.5-rc3","v1.9-rc0","v1.9-rc1","v1.9-rc2","v1.9.0","v1.9.0-rc3","v2.0.0","v2.0.0-rc0","v2.0.0-rc1","v2.0.0-rc2","v2.0.0-rc3","v2.0.0-rc4","v2.1.0","v2.1.0-rc0","v2.1.0-rc1","v2.1.0-rc2","v2.10.0","v2.10.0-rc0","v2.10.0-rc1","v2.10.0-rc2","v2.11.0","v2.11.0-rc0","v2.11.0-rc1","v2.11.0-rc2","v2.11.0-rc3","v2.12.0","v2.12.0-rc0","v2.12.0-rc1","v2.12.0-rc2","v2.13.0","v2.13.0-rc0","v2.13.0-rc1","v2.13.0-rc2","v2.14.0","v2.14.0-rc0","v2.14.0-rc1","v2.15.0","v2.15.0-rc0","v2.15.0-rc1","v2.15.0-rc2","v2.16.0","v2.16.0-rc0","v2.16.0-rc1","v2.16.0-rc2","v2.17.0","v2.17.0-rc0","v2.17.0-rc1","v2.17.0-rc2","v2.18.0","v2.18.0-rc0","v2.18.0-rc1","v2.18.0-rc2","v2.19.0","v2.19.0-rc0","v2.19.0-rc1","v2.19.0-rc2","v2.2.0","v2.2.0-rc0","v2.2.0-rc1","v2.2.0-rc2","v2.2.0-rc3","v2.20.0","v2.20.0-rc0","v2.20.0-rc1","v2.20.0-rc2","v2.21.0","v2.21.0-rc0","v2.21.0-rc1","v2.21.0-rc2","v2.22.0","v2.22.0-rc0","v2.22.0-rc1","v2.22.0-rc2","v2.22.0-rc3","v2.23.0","v2.23.0-rc0","v2.23.0-rc1","v2.23.0-rc2","v2.24.0","v2.24.0-rc0","v2.24.0-rc1","v2.24.0-rc2","v2.25.0","v2.25.0-rc0","v2.25.0-rc1","v2.25.0-rc2","v2.26.0","v2.26.0-rc0","v2.26.0-rc1","v2.26.0-rc2","v2.27.0","v2.27.0-rc0","v2.27.0-rc1","v2.27.0-rc2","v2.28.0","v2.28.0-rc0","v2.28.0-rc1","v2.28.0-rc2","v2.29.0","v2.29.0-rc0","v2.29.0-rc1","v2.29.0-rc2","v2.3.0","v2.3.0-rc0","v2.3.0-rc1","v2.3.0-rc2","v2.30.0","v2.30.0-rc0","v2.30.0-rc1","v2.30.0-rc2","v2.30.1","v2.30.2","v2.30.3","v2.30.4","v2.30.5","v2.30.6","v2.31.0","v2.31.0-rc0","v2.31.0-rc1","v2.31.0-rc2","v2.31.1","v2.31.2","v2.31.3","v2.31.4","v2.31.5","v2.32.0","v2.32.0-rc0","v2.32.0-rc1","v2.32.0-rc2","v2.32.0-rc3","v2.32.1","v2.32.2","v2.32.3","v2.32.4","v2.33.0","v2.33.0-rc0","v2.33.0-rc1","v2.33.0-rc2","v2.33.1","v2.33.2","v2.33.3","v2.33.4","v2.33.5","v2.34.0","v2.34.0-rc0","v2.34.0-rc1","v2.34.0-rc2","v2.34.1","v2.34.2","v2.34.3","v2.34.4","v2.34.5","v2.35.0","v2.35.0-rc0","v2.35.0-rc1","v2.35.0-rc2","v2.35.1","v2.35.2","v2.35.3","v2.35.4","v2.35.5","v2.36.0","v2.36.0-rc0","v2.36.0-rc1","v2.36.0-rc2","v2.36.1","v2.36.2","v2.36.3","v2.37.0","v2.37.0-rc0","v2.37.0-rc1","v2.37.0-rc2","v2.37.1","v2.37.2","v2.37.3","v2.37.4","v2.38.0","v2.38.0-rc0","v2.38.0-rc1","v2.38.0-rc2","v2.38.1","v2.38.2","v2.39.0","v2.39.0-rc0","v2.39.0-rc1","v2.39.0-rc2","v2.4.0","v2.4.0-rc0","v2.4.0-rc1","v2.4.0-rc2","v2.4.0-rc3","v2.5.0","v2.5.0-rc0","v2.5.0-rc1","v2.5.0-rc2","v2.5.0-rc3","v2.6.0","v2.6.0-rc0","v2.6.0-rc1","v2.6.0-rc2","v2.6.0-rc3","v2.7.0","v2.7.0-rc0","v2.7.0-rc1","v2.7.0-rc2","v2.7.0-rc3","v2.8.0","v2.8.0-rc0","v2.8.0-rc1","v2.8.0-rc2","v2.8.0-rc3","v2.8.0-rc4","v2.9.0","v2.9.0-rc0","v2.9.0-rc1","v2.9.0-rc2"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-41903.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"}]}