CVE-2021-21384
JSON

6.3medium

Null characters not escaped in shescape

Severity
6.3medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.57% (higher than 48% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-f2rp-38vg-j3gh

Description

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.

Affected

Product or packageVersionsReported by
ericcornelissen shescape< 1.1.3CVE List
shescape (npm)before 1.1.3GitHub Advisory Database
shescape_project shescapebefore 1.1.3NVD

All scores

GitHub_M6.3medium CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
GitHub6.3high CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD4.6medium CVSS:2.0AV:L/AC:L/Au:N/C:P/I:P/A:P

Classification

What each source says

CVE List

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.

GitHub Advisory Database
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, "")

NVD (es)

shescape es un paquete de escape de shell simple para JavaScript.&#xa0;En shescape versiones anteriores a 1.1.3, cualquiera que use _Shescape_ para defenderse de la inyección de shell puede ser vulnerable frente a una inyección shell si el atacante logra insertar en la carga útil.&#xa0;Para visualizar un ejemplo, consulte el Aviso de Seguridad de GitHub al que se hace referencia.&#xa0;El problema ha sido solucionado en la versión 1.1.3.&#xa0;No son requeridos más cambios

References

Sources

SourceRecordLicence
CVE ListCVE-2021-21384 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-f2rp-38vg-j3gh changed 2026-09-10CC-BY-4.0
NVDCVE-2021-21384 changed 2026-06-17Public domain