CVE-2023-25652 "git apply --reject" partially-controlled arbitrary file write
Attackers can overwrite files outside the working tree via crafted patches when using git apply with the --reject flag.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-25652?
CVE-2023-25652 is a high-severity path traversal vulnerability in Fedoraproject Fedora, published on 25 Apr 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Weakness: CWE-22
Which versions are affected by CVE-2023-25652?
It affects 2 products.
Products include Fedoraproject Fedora, Git-Scm Git.
How do I fix CVE-2023-25652?
Upgrade to a fixed version.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2023-25652 being exploited?
There is no known exploitation of CVE-2023-25652 in the wild and no public exploit code.
Other vulnerabilities in Fedoraproject Fedora
Sources
Also known as ALPINE-CVE-2023-25652, CLEANSTART-2026-CG61867, DEBIAN-CVE-2023-25652, GHSA-2hvf-7c8p-28fx, UBUNTU-CVE-2023-25652.