CVE-2025-48384 — Git Link Following Vulnerability

CVE-2025-48384

Git — Pre-Auth RCE via Carriage Return in Submodule Path (Linux/macOS)

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

Actively Exploited. This vulnerability has been added to CISA's Known Exploited Vulnerabilities (KEV) Catalog on August 25, 2025 with a federal remediation deadline of September 15, 2025. In-the-wild exploitation uses Python-based malware delivered via malicious Git post-checkout hooks.

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:

  1. Attacker creates a repository with a .gitmodules file where a submodule path has a trailing carriage return: path = subdir/foo^M
  2. Victim runs git clone --recursive <malicious-repo>
  3. Git validates the submodule path from .gitmodules (it passes safety checks as subdir/foo\r)
  4. Git writes the path unquoted into .git/modules/foo/config
  5. On the next read, the CR is stripped — the effective path becomes subdir/foo
  6. The attacker pre-places a symlink at subdir/foo pointing to .git/hooks/
  7. Git checks out the submodule's content into what it thinks is subdir/foo but is actually .git/hooks/ via the symlink
  8. The submodule contains an executable post-checkout script
  9. Git automatically runs post-checkoutarbitrary 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

CISA BOD 22-01 deadline: September 15, 2025. Federal agencies are required to apply mitigations by this date.
  1. Upgrade Git to a patched version for your active branch (see Affected Versions table above). Run git --version to 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.
  2. Avoid --recursive or --recurse-submodules on repositories from untrusted or unknown sources until patched. Instead, clone without the flag, manually inspect .gitmodules for unusual path values (control characters, unexpected symlinks), and then run git submodule update --init only after inspection.
  3. 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.
  4. Review GitHub Desktop and other GUI clients — these may clone recursively by default. Check for updates from the respective vendors.
  5. Monitor for hook file creation in .git/hooks/ directories on developer workstations, particularly unexpected script files appearing after a clone operation.

Key Details

PropertyValue
CVE ID CVE-2025-48384
Vendor / Product Git — Git
NVD Published2025-07-08
NVD Last Modified2025-11-06
CVSS 3.1 Score8
CVSS 3.1 VectorCVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H
SeverityHIGH
CWE CWE-59 find similar ↗
CISA KEV Added2025-08-25
CISA KEV Deadline2025-09-15
Known Ransomware Use No

CVSS 3.1 Breakdown

Attack Vector
Network
Attack Complexity
High
Privileges Required
Low
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

Required Action

CISA BOD 22-01 Deadline: 2025-09-15. Apply mitigations per vendor instructions, follow applicable BOD 22-01 guidance for cloud services, or discontinue use of the product if mitigations are unavailable.

Timeline

DateEvent
2025-07-08CVE published — coordinated disclosure of 7 Git CVEs; patched versions released simultaneously
2025-07-08Public PoC exploits appeared on GitHub within hours of the coordinated disclosure
2025-08-25Added to CISA Known Exploited Vulnerabilities catalog — active in-the-wild exploitation confirmed
2025-09-15CISA BOD 22-01 remediation deadline for federal agencies