Overview
This post provides a comprehensive analysis of the critical CVE-2025-59046 vulnerability. This vulnerability lies within the `interactive-git-checkout` npm package, a command-line tool that facilitates git branch checkouts by prompting users for the branch name. Systems running versions up to and including 1.1.4 of this tool are susceptible to a command injection vulnerability. This flaw can lead to system compromise or data leakage, making it a matter of grave concern for DevOps teams and system administrators who use this tool in their environment.
Vulnerability Summary
CVE ID: CVE-2025-59046
Severity: Critical (CVSS score 9.8)
Attack Vector: Network
Privileges Required: None
User Interaction: Required
Impact: System compromise or data leakage
Affected Products
Product | Affected Versions
interactive-git-checkout npm package | Up to and including version 1.1.4
How the Exploit Works
The vulnerability lies in the lack of input validation or sanitization for the branch name that the `interactive-git-checkout` tool passes to the `git checkout` command. This is done using the Node.js child process module’s `exec()` function. An attacker who can convince a user to checkout a maliciously named branch can inject arbitrary commands, leading to potential system compromise or data leakage.
Conceptual Example Code
Consider the scenario where an attacker creates a branch with a maliciously crafted name. The user, unaware of the underlying exploit, checks out this branch using the `interactive-git-checkout` tool. A conceptual example of the command may look like this:
$ git branch '; rm -rf / #'
$ npm install -g interactive-git-checkout
$ interactive-git-checkout
The user is now prompted for the branch name. If the user inputs ‘; rm -rf / #’, it could lead to the deletion of all files in the system.
Mitigation
Mitigation measures involve applying the vendor patch or using a Web Application Firewall (WAF) or Intrusion Detection System (IDS) as a temporary solution. The software fix for the vulnerability is in commit 8dd832dd302af287a61611f4f85e157cd1c6bb41. Users are advised to update their `interactive-git-checkout` npm package to the latest version as soon as possible.
