Arbitrary Command Injection in @npmcli/git

@npmcli/git Updated 02 Oct 2025

Summary

05/08/2021
MODERATE
Yes i
Moderate
Not published

GHSA-hxwm-x553-x359: Arbitrary Command Injection due to Improper Command Sanitization. Affects @npmcli/git versions < 2.0.8. Fixed in 2.0.8. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The @npmcli/git package is a component of the npm CLI tool used for executing Git commands. It allows users to interact with Git repositories and perform various operations. However, versions prior to 2.0.8 are vulnerable to arbitrary command injection due to improper argument sanitization. This vulnerability can be exploited when user-controlled input is passed as arguments to Git commands, potentially leading to the execution of arbitrary shell commands.

Vulnerability Detail

The vulnerability in @npmcli/git versions <2.0.8 arises from the lack of proper sanitization of user-controlled input when executing Git commands. By passing unsanitized input to a shell command, an attacker can inject arbitrary commands. For example, an attacker could include additional commands after a Git URL, such as 'git+https://github.com/npm/git; echo hello world', which would result in the execution of the 'echo hello world' command. This vulnerability has been addressed in version 2.0.8 by no longer running Git commands through an intermediate shell.

How To Fix

Minimum fixed version

2.0.8

This is the first release that contains the fix.

npm install @npmcli/git@2.0.8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is crucial to update to the patched version as soon as possible.

Conclusion

The vulnerability in @npmcli/git versions prior to 2.0.8 allows for arbitrary command injection, which can be exploited by passing unsanitized user input as arguments to Git commands. It is crucial to update to version 2.0.8 or later to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for @npmcli/git →

Share this vulnerability

FAQ

The impact of this vulnerability is arbitrary command injection, allowing an attacker to execute arbitrary shell commands.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your package-lock.json file and Vulert will alert you in real-time for any open-source vulnerabilities, including this one.

Yes, this vulnerability has been patched in version 2.0.8 of the @npmcli/git package.

This vulnerability was reported to the npm team by @tyage from Ierae Security through the GitHub Bug Bounty Program.

How To Fix

Minimum fixed version

2.0.8

This is the first release that contains the fix.

npm install @npmcli/git@2.0.8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback