CVE-2021-23632 Remote Code Execution (RCE)

Medium 6.6 Published Updated

The Node.js git library allows remote code execution via OS command injection in the Git.git method due to missing input sanitization.

Exploited in the wild
Not known
Login needed
An administrator
Attackable
Over the internet
Victim action needed
Not needed
Fix
None listed

What is CVE-2021-23632?

CVE-2021-23632 is a medium-severity command injection vulnerability in git, published on 17 Mar 2022. An attacker needs administrator access to exploit it, with no action from the victim.

Official description

All versions of package git are vulnerable to Remote Code Execution (RCE) due to missing sanitization in the Git.git method, which allows execution of OS commands rather than just git commands. Steps to Reproduce 1. Create a file named exploit.js with the following content: js var Git = require("git").Git; var repo = new Git("repo-test"); var user_input = "version; date"; repo.git(user_input, function(err, result) { console.log(result); }) 2. In the same directory as exploit.js, run npm install git. 3. Run exploit.js: node exploit.js. You should see the outputs of both the git version and date command-lines. Note that the repo-test Git repository does not need to be present to make this PoC work.

Weakness: CWE-78

Which versions are affected by CVE-2021-23632?

2 open source packages ship an affected version, including git. It affects 1 product.

PackageAffectedFixed in
git npmAll versions to 0.1.5None
git npmAll versions to 0.1.5None

Products include Git Project Git.

How do I fix CVE-2021-23632?

No fix has been published for CVE-2021-23632 yet. Limit exposure of the affected software until one is available.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2021-23632 being exploited?

There is no known exploitation of CVE-2021-23632 in the wild and no public exploit code.

Sources

Also known as GHSA-9gqr-xp86-f87h, SNYK-JS-GIT-1568518.

Is CVE-2021-23632 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free