Loading HuntDB...

GHSA-qg8p-v9q4-gh34

GitHub Security Advisory

Potential Command Injection in shell-quote

✓ GitHub Reviewed CRITICAL Has CVE

Advisory Details

Affected versions of `shell-quote` do not properly escape command line arguments, which may result in command injection if the library is used to escape user input destined for use as command line arguments.

## Proof of Concept:

The following characters are not escaped properly: `>`,`;`,`{`,`}`

Bash has a neat but not well known feature known as "Bash Brace Expansion", wherein a sub-command can be executed without spaces by running it between a set of `{}` and using the `,` instead of ` ` to seperate arguments. Because of this, full command injection is possible even though it was initially thought to be impossible.

```
const quote = require('shell-quote').quote;
console.log(quote(['a;{echo,test,123,234}']));
// Actual "a;{echo,test,123,234}"
// Expected "a\;\{echo,test,123,234\}"
// Functional Equivalent "a; echo 'test' '123' '1234'"
```

## Recommendation

Update to version 1.6.1 or later.

Affected Packages

npm shell-quote
Affected versions: 0 (fixed in 1.6.1)

Related CVEs

Key Information

GHSA ID
GHSA-qg8p-v9q4-gh34
Published
February 18, 2019 11:58 PM
Last Modified
November 22, 2022 5:49 PM
CVSS Score
9.0 /10
Primary Ecosystem
npm
Primary Package
shell-quote
GitHub Reviewed
✓ Yes

Dataset

Last updated: July 4, 2025 6:27 AM

Data from GitHub Advisory Database. This information is provided for research and educational purposes.