CVE-2025-59046
Description
The npm package interactive-git-checkout is an interactive command-line tool that allows users to checkout a git branch while it prompts for the branch name on the command-line. It is available as an npm package and can be installed via npm install -g interactive-git-checkout. Versions up to and including 1.1.4 of the interactive-git-checkout tool are vulnerable to a command injection vulnerability because the software passes the branch name to the git checkout command using the Node.js child process module's exec() function without proper input validation or sanitization. Commit 8dd832dd302af287a61611f4f85e157cd1c6bb41 fixes the issue.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
interactive-git-checkoutnpm | <= 1.1.4 | — |
Affected products
1Patches
18dd832dd302afix: avoid command injection vulnerabilities
3 files changed · +9 −9
src/checkout.js+3 −3 modified@@ -1,10 +1,10 @@ -const { exec: execCb } = require('child_process'); +const { execFile: execFileCb } = require('child_process'); const { promisify } = require('util'); -const exec = promisify(execCb); +const execFile = promisify(execFileCb); module.exports = async (targetBranch) => { - const { stdout, stderr } = await exec(`git checkout ${targetBranch}`); + const { stdout, stderr } = await execFile('git', ['checkout', targetBranch]); process.stderr.write(stderr); process.stdout.write(stdout); };
src/checkoutToNew.js+3 −3 modified@@ -1,10 +1,10 @@ -const { exec: execCb } = require('child_process'); +const { execFile: execFileCb } = require('child_process'); const { promisify } = require('util'); -const exec = promisify(execCb); +const execFile = promisify(execFileCb); module.exports = async (newBranchName) => { - const { stdout, stderr } = await exec(`git checkout -b ${newBranchName}`); + const { stdout, stderr } = await execFile('git', ['checkout', '-b', newBranchName]); process.stderr.write(stderr); process.stdout.write(stdout); };
src/getBranches.js+3 −3 modified@@ -1,11 +1,11 @@ #!/usr/bin/env node -const { exec: execCb } = require('child_process'); +const { execFile: execFileCb } = require('child_process'); const { promisify } = require('util'); -const exec = promisify(execCb); +const execFile = promisify(execFileCb); module.exports = async () => { - const { stdout, stderr } = await exec('git branch', { encoding: 'utf8' }); + const { stdout, stderr } = await execFile('git', ['branch'], { encoding: 'utf8' }); if (stderr !== '') { throw new Error(`Error while running "git branch": ${stderr}`); }
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
4News mentions
0No linked articles in our index yet.