Every CVE Search/ Get API key

CVE-2021-21384

Null characters not escaped in shescape

6.3 MediumFix available

shescape is a simple shell escape package for JavaScript. In shescape before version 1.1.3, anyone using Shescape to defend against shell injection may still be vulnerable against shell injection if the attacker manages to insert a into the payload. For an example see the referenced GitHub Security Advisory. The problem has been patched in version 1.1.3. No further changes are required.

Attack profile

How easy it is to exploit

Attack vector
Local
Complexity
High
Privileges needed
None
User interaction
Required

What an attacker can affect

Confidentiality
Low
Integrity
High
Availability
None

Exploit likelihood

0.58%Down 10.1 points since Apr 14, 2021
90%50%10%1%

What each source reports

CVE List Score used 6.3

Null characters not escaped in shescape

shescape is a simple shell escape package for JavaScript. In shescape before version 1.1.3, anyone using Shescape to defend against shell injection may still be vulnerable against shell injection if the attacker manages to insert a into the payload. For an example see the referenced GitHub Security Advisory. The problem has been patched in version 1.1.3. No further changes are required.

Record
CVE-2021-21384
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
Weakness
CWE-88
Updated
2026-11-02
EUVDEUVD-2021-0648 6.3

shescape is a simple shell escape package for JavaScript. In shescape before version 1.1.3, anyone using Shescape to defend against shell injection may still be vulnerable against shell injection if the attacker manages to insert a into the payload. For an example see the referenced GitHub Security Advisory. The problem has been patched in version 1.1.3. No further changes are required.

Record
EUVD-2021-0648
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
Updated
2026-11-03
GitHub AdvisoriesGHSA-f2rp-38vg-j3gh 6.3

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, "")

Record
GHSA-f2rp-38vg-j3gh
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
Weakness
CWE-88
Updated
2026-11-02
NVD 6.3

shescape is a simple shell escape package for JavaScript. In shescape before version 1.1.3, anyone using Shescape to defend against shell injection may still be vulnerable against shell injection if the attacker manages to insert a into the payload. For an example see the referenced GitHub Security Advisory. The problem has been patched in version 1.1.3. No further changes are required.

Record
CVE-2021-21384
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
4.6 MediumAV:L/AC:L/Au:N/C:P/I:P/A:P
Weakness
CWE-88
Updated
2026-11-02
OSV 7.8

shescape is a simple shell escape package for JavaScript. In shescape before version 1.1.3, anyone using Shescape to defend against shell injection may still be vulnerable against shell injection if the attacker manages to insert a into the payload. For an example see the referenced GitHub Security Advisory. The problem has been patched in version 1.1.3. No further changes are required.

Record
CVE-2021-21384
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVGHSA-f2rp-38vg-j3gh 6.3

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, "")

Record
GHSA-f2rp-38vg-j3gh
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
Weakness
CWE-88
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
shescape
npm
before 1.1.3
1.1.3

History

History
RecordedChangedSources
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-21384 is a medium vulnerability (CVSS 6.3) in Ericcornelissen Shescape, published March 18, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.58%, the 47th percentile. Fixed in shescape 1.1.3.

References

MoveEnter Open