{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2022-41903","id":"CVE-2022-41903","title":"Integer overflow in `git archive`, `git log --format` leading to RCE in git","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 off","descriptionLong":"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`.","published":"2023-01-17T22:17:16.123Z","updated":"2026-10-28T02:31:06.526550327Z","reserved":"2022-09-30T16:38:28.931Z","status":"Modified","rejected":false,"assigner":"GitHub_M","metric":{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"GitHub_M"},"metrics":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"GitHub_M"},{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"github.com"},{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"NVD"},{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","rating":"critical","source":"OSV"}],"rating":"critical","products":["git"],"affectedProducts":[{"vendor":"git","product":"git","defaultStatus":null,"versions":[{"version":"< 2.30.7","status":"affected"},{"version":">= 2.31.0, < 2.31.6","status":"affected"},{"version":">= 2.32.0, < 2.32.5","status":"affected"},{"version":">= 2.33.0, < 2.33.6","status":"affected"},{"version":">= 2.34.0, < 2.34.6","status":"affected"},{"version":">= 2.35.0, < 2.35.6","status":"affected"},{"version":">= 2.36.0, < 2.36.4","status":"affected"},{"version":">= 2.37.0, < 2.37.5","status":"affected"},{"version":">= 2.38.0, < 2.38.3","status":"affected"},{"version":"= 2.39.0","status":"affected"}],"platforms":[]}],"packages":[],"cwes":["CWE-190"],"aliases":["GHSA-475x-2q3q-hvwq"],"references":[{"url":"https://github.com/git/git/security/advisories/GHSA-475x-2q3q-hvwq","tags":["x_refsource_CONFIRM","x_transferred","Third Party Advisory","advisory"]},{"url":"https://github.com/git/git/commit/508386c6c5857b4faa2c3e491f422c98cc69ae76","tags":["x_refsource_MISC","x_transferred","Patch","Release Notes","Third Party Advisory","fix"]},{"url":"https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_export_subst","tags":["x_refsource_MISC","x_transferred","Vendor Advisory","web"]},{"url":"https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-emltltNgttruncltruncmtruncem","tags":["x_refsource_MISC","x_transferred","Vendor Advisory","web"]},{"url":"https://security.gentoo.org/glsa/202312-15","tags":["x_transferred","advisory"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/41xxx/CVE-2022-41903.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-41903","tags":["advisory"]}],"patchReferenced":true,"fixAvailable":true,"exploitReferenced":false,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":{"exploitation":"none","automatable":"yes","technicalImpact":"total"},"epss":0.44268,"epssPercentile":0.98785,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2022-41903","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-41903","ok":true,"note":"Modified"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2022-41903","ok":true,"note":"0 packages"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2022-41903","ok":true,"note":"scored 2026-11-19"}],"aiTitle":false,"tech":[],"critical":["EPSS 44% with CVSS 9.8"],"attention":null}