What is Git?
Git is the world's most widely used distributed version control system, created by Linus Torvalds in 2005. It is the foundation of virtually every modern software development workflow: developers clone repositories, manage branches, and collaborate via hosting platforms like GitHub, GitLab, and Bitbucket. Git ships pre-installed on macOS, is bundled with development tools like Xcode and Visual Studio, and is a near-universal dependency of CI/CD pipelines and developer workstations.
Because git clone is a routine, low-friction operation — often the first step when evaluating open-source projects or onboarding to a new repository — it represents an unusually attractive attack surface. A vulnerability triggered by cloning a malicious repository can compromise developer machines at the moment of discovery, before any additional code is run.
Overview
CVE-2025-48384 is a link following (CWE-59) vulnerability in Git's configuration file handling. A read/write inconsistency in how Git processes carriage return (\r) characters allows an attacker to craft a malicious repository where a submodule path is written to .git/config as one value but read back as a different one. By placing a symlink at the altered path, the attacker can redirect Git's file writes into .git/hooks/, causing Git to automatically execute attacker-supplied hook scripts — achieving remote code execution at the moment of git clone --recursive.
The vulnerability affects Linux and macOS only. Windows filesystems reject filenames containing carriage return characters, blocking the exploit chain at the OS level.
Affected Versions
| Git Version | Last Vulnerable | Patched |
|---|---|---|
| 2.43.x | 2.43.6 | 2.43.7 |
| 2.44.x | 2.44.3 | 2.44.4 |
| 2.45.x | 2.45.3 | 2.45.4 |
| 2.46.x | 2.46.3 | 2.46.4 |
| 2.47.x | 2.47.2 | 2.47.3 |
| 2.48.x | 2.48.1 | 2.48.2 |
| 2.49.x | 2.49.0 | 2.49.1 |
| 2.50.x | 2.50.0 | 2.50.1 |
All Git releases on UNIX-like systems prior to these patched versions are vulnerable. Products bundling Git — including Apple Xcode and various Linux distribution packages — required separate updates from their respective vendors.
Technical Details
The root cause is a write/read semantic mismatch in config.c, Git's configuration file handler.
The write side (write_pair()): When writing a key-value pair to a config file, Git checks whether the value needs to be quoted — for example, values containing ; or # are wrapped in double quotes to prevent misinterpretation. However, the pre-patch code did not include carriage return (\r) in the set of characters requiring quoting. A submodule path containing a trailing \r was written literally into .git/config, with no escaping.
The read side (config parser): When reading a config file line, Git strips trailing CR/LF characters before returning the value. A stored path of subdir/foo\r is returned as subdir/foo — a different string entirely.
The exploit chain:
- Attacker creates a repository with a
.gitmodulesfile where a submodulepathhas a trailing carriage return:path = subdir/foo^M - Victim runs
git clone --recursive <malicious-repo> - Git validates the submodule path from
.gitmodules(it passes safety checks assubdir/foo\r) - Git writes the path unquoted into
.git/modules/foo/config - On the next read, the CR is stripped — the effective path becomes
subdir/foo - The attacker pre-places a symlink at
subdir/foopointing to.git/hooks/ - Git checks out the submodule's content into what it thinks is
subdir/foobut is actually.git/hooks/via the symlink - The submodule contains an executable
post-checkoutscript - Git automatically runs
post-checkout— arbitrary code executes under the victim's account
A secondary exploitation path uses the same file-write primitive to overwrite .git/config itself, silently redirecting the repository's remote origin to an attacker-controlled server and enabling source code exfiltration disguised as normal Git activity.
The one-line fix adds '\r' to the quoting check in write_pair():
if (value[i] == ';' || value[i] == '#' || value[i] == '\r')
quote = "\"";
This ensures carriage return characters are preserved through write-read cycles as escaped sequences inside quoted strings, breaking the exploit chain. The patch commit is 05e9cd64ee in the Git repository.
Relationship to CVE-2024-32002: This vulnerability uses the same conceptual attack (submodule confusion → hook execution) as CVE-2024-32002, which exploited filesystem case-sensitivity differences. CVE-2025-48384 is a distinct variant using CR-stripping instead of case folding, discovered through the same line of audit work.
Discovery
David Leadbeater (dgl) discovered this vulnerability during a security audit of Git sponsored by G-Research Open Source. The same audit produced six additional CVEs disclosed on the same day (CVE-2025-48385, CVE-2025-48386, CVE-2025-27613, CVE-2025-27614, CVE-2025-46334, CVE-2025-46835). Leadbeater published a detailed technical write-up titled "Breaking Git with a carriage return and cloning RCE" at dgl.cx. The patch was written by Justin Tobler and committed by Taylor Blau.
Exploitation Context
Active in-the-wild exploitation was confirmed by CISA on August 25, 2025 — approximately seven weeks after the July 8 public disclosure.
Attack method: Attackers use social engineering to lure developers into cloning malicious repositories. Observed indicators of compromise include post-checkout hook scripts named hooks/vm.tf and hooks/mongodb.hook.js, suggesting infrastructure-themed and database-themed lure repositories targeting developers working with Terraform or MongoDB. The first-stage payload is Python-based, delivered via hook execution, and includes anti-forensic techniques (TAR archive extraction to /tmp followed by archive deletion).
PoC availability: Multiple public proof-of-concept exploits appeared on GitHub within hours of the July 8 disclosure, dramatically lowering the barrier to exploitation. Independent validation by security researchers confirmed working exploitation against unpatched systems.
Primary targets: Developer workstations running macOS or Linux, and CI/CD pipeline agents — systems where git clone operations against external repositories are routine. GitHub Desktop is specifically exposed because it enables recursive cloning by default.
No specific named threat actor or APT group had been publicly attributed as of the available reporting.
Remediation
- Upgrade Git to a patched version for your active branch (see Affected Versions table above). Run
git --versionto check your current version. On macOS, upgrade via your package manager or by updating Xcode Command Line Tools:xcode-select --install. On Linux, use your distribution's package manager. - Avoid
--recursiveor--recurse-submoduleson repositories from untrusted or unknown sources until patched. Instead, clone without the flag, manually inspect.gitmodulesfor unusual path values (control characters, unexpected symlinks), and then rungit submodule update --initonly after inspection. - Audit CI/CD pipeline runners — any agent that clones external repositories with recursive submodule initialization is exposed. Verify the Git version on all pipeline agents and update before re-enabling recursive clones.
- Review GitHub Desktop and other GUI clients — these may clone recursively by default. Check for updates from the respective vendors.
- Monitor for hook file creation in
.git/hooks/directories on developer workstations, particularly unexpected script files appearing after a clone operation.
Key Details
| Property | Value |
|---|---|
| CVE ID | CVE-2025-48384 |
| Vendor / Product | Git — Git |
| NVD Published | 2025-07-08 |
| NVD Last Modified | 2025-11-06 |
| CVSS 3.1 Score | 8 |
| CVSS 3.1 Vector | CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H |
| Severity | HIGH |
| CWE | CWE-59 find similar ↗ |
| CISA KEV Added | 2025-08-25 |
| CISA KEV Deadline | 2025-09-15 |
| Known Ransomware Use | No |
CVSS 3.1 Breakdown
Required Action
Timeline
| Date | Event |
|---|---|
| 2025-07-08 | CVE published — coordinated disclosure of 7 Git CVEs; patched versions released simultaneously |
| 2025-07-08 | Public PoC exploits appeared on GitHub within hours of the coordinated disclosure |
| 2025-08-25 | Added to CISA Known Exploited Vulnerabilities catalog — active in-the-wild exploitation confirmed |
| 2025-09-15 | CISA BOD 22-01 remediation deadline for federal agencies |
References
| Resource | Type |
|---|---|
| NVD — CVE-2025-48384 | Vulnerability Database |
| CISA KEV Catalog Entry | US Government |
| GitHub Security Advisory GHSA-vwqx-4fm8-6qc9 | Vendor Advisory |
| Microsoft MSRC — CVE-2025-48384 | Vendor Advisory |
| Red Hat Security Advisory RHSA-2025:13933 | Vendor Advisory |
| PoC Available for High-Severity Git CLI Arbitrary File Write — Arctic Wolf | Security Research |
| CWE-59 — Improper Link Resolution Before File Access (Link Following) | Weakness Classification |