CVE-2023-23946 Git's `git apply` overwriting paths outside the working tree

Medium 6.2 Published Updated

Attackers can overwrite files outside the working tree by crafting malicious input to git apply, potentially modifying user data.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2023-23946?

CVE-2023-23946 is a medium-severity path traversal vulnerability in git, published on 14 Feb 2023. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

Git, a revision control system, is vulnerable to path traversal prior to versions 2.39.2, 2.38.4, 2.37.6, 2.36.5, 2.35.7, 2.34.7, 2.33.7, 2.32.6, 2.31.7, and 2.30.8. By feeding a crafted input to `git apply`, a path outside the working tree can be overwritten as the user who is running `git apply`. A fix has been prepared and will appear in v2.39.2, v2.38.4, v2.37.6, v2.36.5, v2.35.7, v2.34.7, v2.33.7, v2.32.6, v2.31.7, and v2.30.8. As a workaround, use `git apply --stat` to inspect a patch before applying; avoid applying one that creates a symbolic link and then creates a file beyond the symbolic link.

Weakness: CWE-22

Which versions are affected by CVE-2023-23946?

It affects 1 product.

Products include Git-Scm Git.

How do I fix CVE-2023-23946?

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-23946 being exploited?

There is no known exploitation of CVE-2023-23946 in the wild and no public exploit code.

Public exploit code: 2 proofs of concept on GitHub.

Sources

Also known as ALPINE-CVE-2023-23946, CLEANSTART-2026-ZB48297, CLSA-2024-1714728645, DEBIAN-CVE-2023-23946, GHSA-r87m-v37r-cwfh, UBUNTU-CVE-2023-23946.

Is CVE-2023-23946 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free