Vulnerability record · CVE-2023-25652 · published 25 April 2023
CVE-2023-25652: Git apply --reject path traversal allows file overwrite outside working tree
Git Scm · Git
Git before the fixed releases mishandles specially crafted input to `git apply --reject`, allowing a path outside the working tree to be overwritten with partially controlled contents taken from the rejected hunks of a patch. Because the overwritten content is only partially controlled, the flaw is primarily an integrity and denial-of-service risk to files the Git process can write. It matters because applying patches from untrusted sources is common in review and CI workflows.
Description
Git is a revision control system. Prior to versions 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, and 2.40.1, by feeding specially crafted input to `git apply --reject`, a path outside the working tree can be overwritten with partially controlled contents (corresponding to the rejected hunk(s) from the given patch). A fix is available in versions 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, and 2.40.1. As a workaround, avoid using `git apply` with `--reject` when applying patches from an untrusted source. Use `git apply --stat` to inspect a patch before applying; avoid applying one that create a conflict where a link corresponding to the `*.rej` file exists.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Automated analysis
high priorityCVSS 7.5 with a high EPSS percentile and a straightforward path traversal in a widely deployed tool, though exploitation requires applying an untrusted patch.
What it is
Git before the fixed releases mishandles specially crafted input to `git apply --reject`, allowing a path outside the working tree to be overwritten with partially controlled contents taken from the rejected hunks of a patch. Because the overwritten content is only partially controlled, the flaw is primarily an integrity and denial-of-service risk to files the Git process can write. It matters because applying patches from untrusted sources is common in review and CI workflows.
Impact
An attacker who supplies a malicious patch can overwrite files outside the repository working tree with partially controlled data, corrupting or replacing content the Git user can write. There is no confidentiality impact per the CVSS vector; the gain is integrity tampering and potential disruption.
Attack surface
Reached by feeding a crafted patch to `git apply --reject`, typically when a user or automated pipeline applies a patch from an untrusted source. The CVSS vector is network, no privileges, no user interaction, but in practice exploitation requires the victim to run the command against attacker-supplied input.
Exploitation
Not listed in CISA KEV and no public exploit or ransomware association is recorded in this data. EPSS is high at roughly 0.519 (98.9th percentile), indicating elevated predicted exploitation likelihood, and references include patch and vendor advisory links.
What to do
- Upgrade Git to 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, or 2.40.1 (or later).
- Update distribution packages (Fedora, Debian LTS, Gentoo) to the fixed builds referenced in the advisories.
- Avoid `git apply --reject` on patches from untrusted sources; inspect patches with `git apply --stat` first.
- Do not apply patches that create a conflict where a `*.rej` link already exists.
- Run patch application in a sandbox or low-privilege account with a restricted working directory.
Detection
- Monitor for `git apply` invocations using `--reject` in CI and developer shell history or process telemetry.
- Alert on writes to paths outside expected repository roots during patch application, especially `*.rej`-related paths.
- Watch for unexpected modification of files outside the working tree by the Git process user.
- Review patch sources and repositories for crafted patches that intentionally produce rejected hunks.
This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.
Affected products
2 vulnerable configurations from NVD's CPE data, grouped by vendor and product.
References
Track CVE-2023-25652 inside VULONE
Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.
Related vulnerabilities
Same products first, then exploited flaws of the same weakness class.
Source: NIST National Vulnerability Database (record CVE-2023-25652), CISA KEV, FIRST EPSS (scores of 2026-09-26). This page is refreshed as NVD updates the record.