GHSL-2020-111: Command injection vulnerability in standard-version
The standardVersion function in the standard-version library passes user-controlled strings to a shell command, allowing command injection. An attacker who can influence the release commit message format could execute arbitrary commands on the host.
Originally disclosed on GitHub Security Lab
The standardVersion function has a command injection vulnerability. Clients of the standard-version library are unlikely to be aware of this, so they might unwittingly write code that contains a vulnerability.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the library uses child_process.exec, which interprets a string as a shell command, instead of a safer API that does not invoke a shell.
Impact
This issue may lead to remote code execution if a client of the library calls the vulnerable method with untrusted input.
What the attacker needed
A client of the library passes untrusted input; the attacker can control the commit message format
The fix
The library should avoid APIs that interpret strings as shell commands, for example by using child_process.execFile instead of child_process.exec; the text notes a fixed version 8.0.1.
How it was found
- Install standard-version and create a non-empty git repository.
- Write a script that calls standardVersion with a releaseCommitMessageFormat containing a shell command.
- Run the script and observe that the injected command creates a file.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This library builds release commit messages by running shell commands. If a program using it lets an attacker control part of that message, the attacker can sneak in extra shell commands that run on the server. That is called command injection.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.