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 package | Versions | Reported by |
|---|---|---|
| ericcornelissen shescape | < 1.1.3 | CVE List |
| shescape (npm) | before 1.1.3 | GitHub Advisory Database |
| shescape_project shescape | before 1.1.3 | NVD |
All scores
| GitHub_M | 6.3medium CVSS:3.1 | CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N |
| GitHub | 6.3high CVSS:3.1 | CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:L/I:H/A:N |
| NVD | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 4.6medium CVSS:2.0 | AV: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. 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. Para visualizar un ejemplo, consulte el Aviso de Seguridad de GitHub al que se hace referencia. El problema ha sido solucionado en la versión 1.1.3. No son requeridos más cambios
References
| https://github.com/ericcornelissen/shescape/security/advisories/GHSA-f2rp-38vg-j3gh | exploit, third-party-advisory, web | |
| https://github.com/ericcornelissen/shescape/commit/07a069a66423809cbedd61d980c11ca44a29ea2b | patch, third-party-advisory, web | |
| https://github.com/ericcornelissen/shescape/releases/tag/v1.1.3 | release-notes, third-party-advisory, web | |
| https://www.npmjs.com/package/shescape | product, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-21384 | advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-21384 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-f2rp-38vg-j3gh changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2021-21384 changed 2026-06-17 | Public domain |