Null characters not escaped
Impact
Anyone using Shescape to defend against shell injection may still be vulnerable against shell injection if the attacker manages to insert a null character into the payload. For example (on Windows):
const cp = require("child_process");
const shescape = require("shescape");
const nullChar = String.fromCharCode(0);
const payload = "foo\" && ls -al ${nullChar} && echo \"bar";
console.log(cp.execSync(`echo ${shescape.quote(payload)}`));
// foototal 3
// drwxr-xr-x 1 owner XXXXXX 0 Mar 13 18:44 .
// drwxr-xr-x 1 owner XXXXXX 0 Mar 13 00:09 ..
// drwxr-xr-x 1 owner XXXXXX 0 Mar 13 18:42 folder
// -rw-r--r-- 1 owner XXXXXX 0 Mar 13 18:42 file
Patches
The problem has been patched in v1.1.3 which you can upgrade to now. No further changes are required.
Workarounds
Alternatively, null characters can be stripped out manually using e.g. arg.replace(/\u{0}/gu, "")
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| npm package | shescape | < 1.1.3 | 1.1.3 |
References
- https://github.com/ericcornelissen/shescape/security/advisories/GHSA-f2rp-38vg-j3gh
- https://nvd.nist.gov/vuln/detail/CVE-2021-21384
- https://github.com/ericcornelissen/shescape/commit/07a069a66423809cbedd61d980c11ca44a29ea2b
- https://github.com/ericcornelissen/shescape/releases/tag/v1.1.3
- https://www.npmjs.com/package/shescape
- CVSS vector
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N- Weakness (CWE)
CWE-88- Platform
- npm
- Package
shescape- Disclosed
- 18.03.2021
- Updated
- 11.10.2026 10:22
Sources and licenses
OSV / GitHub Advisory Database - GHSA-f2rp-38vg-j3gh - CC BY 4.0
Vulnerability history: shescape
All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 13
- First → latest
- 03.2021 07.2026
- Without a fix
- 0
- Exploited in attacks
- 0
Severity breakdown
- Critical 2
- High 5
- Medium 4
- Low 2
Disclosures per year
- 2021: 1
- 2022: 4
- 2023: 2
- 2024: 0
- 2025: 1
- 2026: 5
-
Null characters not escaped this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.