CVE-2023-25652: "git apply --reject" partially-controlled arbitrary file write
A vulnerability was found in Git. This security flaw occurs when 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.
Other sources
CVE-2023-25652 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).
— Red Hat
Git could allow a remote attacker to bypass security restrictions. By feeding specially crafted input to git apply --reject, an attacker could exploit this vulnerability to overwrite a path outside the working tree.
— IBM
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.
GitHub: CVE-2023-25652 "git apply --reject" partially-controlled arbitrary file write
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/gitto a version that resolves this vulnerability.Fixed in 0:1.8.3.1-25.el7_9 - Upgrade
Upgrade
redhat/gitto a version that resolves this vulnerability.Fixed in 0:2.39.3-1.el8_8 - Upgrade
Upgrade
redhat/gitto a version that resolves this vulnerability.Fixed in 0:2.18.4-3.el8_1 - Upgrade
Upgrade
redhat/gitto a version that resolves this vulnerability.Fixed in 0:2.18.4-4.el8_2 - Upgrade
Upgrade
redhat/gitto a version that resolves this vulnerability.Fixed in 0:2.27.0-4.el8_4 - Upgrade
Upgrade
redhat/gitto a version that resolves this vulnerability.Fixed in 0:2.31.1-4.el8_6 - Upgrade
Upgrade
redhat/gitto a version that resolves this vulnerability.Fixed in 0:2.39.3-1.el9_2 - Upgrade
Upgrade
redhat/gitto a version that resolves this vulnerability.Fixed in 0:2.31.1-5.el9_0 - Upgrade
Upgrade
redhat/rh-git227-gitto a version that resolves this vulnerability.Fixed in 0:2.27.0-6.el7 - Upgrade
Upgrade
debian/gitto a version that resolves this vulnerability.Fixed in 1:2.39.5-0+deb12u3Fixed in 1:2.39.5-0+deb12u2Fixed in 1:2.47.3-0+deb13u1Fixed in 1:2.53.0-1Fixed in 1:2.55.0-1 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.30.9 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.31.8 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.32.7 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.33.8 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.34.8 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.35.8 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.36.6 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.37.7 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.38.5 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.39.3 - Upgrade
Upgrade
gitto a version that resolves this vulnerability.Fixed in 2.40.1 - Compensating control
Avoid using git apply with --reject when applying patches from an untrusted source.
- Compensating control
Use git apply --stat to inspect a patch before applying it; avoid applying patches that create a conflict where a link corresponding to the *.rej file exists.
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is CVE-2023-25652?
CVE-2023-25652 refers to a vulnerability in Git that allows an attacker to overwrite a file outside of the working tree with partially controlled contents.
How severe is CVE-2023-25652?
CVE-2023-25652 has a severity rating of high.
Which versions of Git are affected by CVE-2023-25652?
The vulnerability affects Git versions prior 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, and 2.40.1.
How can I fix CVE-2023-25652?
To fix CVE-2023-25652, you should update Git to version 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.
Where can I find more information about CVE-2023-25652?
You can find more information about CVE-2023-25652 at the following references: [Reference 1](https://access.redhat.com/security/cve/CVE-2023-25652), [Reference 2](https://bugzilla.redhat.com/show_bug.cgi/show_bug.cgi?id=2189765), [Reference 3](https://bugzilla.redhat.com/show_bug.cgi/show_bug.cgi?id=2189766).