{"id":"CVE-2021-21384","aliases":["GHSA-f2rp-38vg-j3gh"],"url":"https://o3.security/vulnerability/CVE-2021-21384","summary":"Null characters not escaped","details":"### Impact\n\nAnyone using _Shescape_ to defend against shell injection may still be vulnerable against shell injection if the attacker manages to insert a [null character](https://en.wikipedia.org/wiki/Null_character) into the payload. For example (on Windows):\n\n```javascript\nconst cp = require(\"child_process\");\nconst shescape = require(\"shescape\");\n\nconst nullChar = String.fromCharCode(0);\nconst payload = \"foo\\\" && ls -al ${nullChar} && echo \\\"bar\";\nconsole.log(cp.execSync(`echo ${shescape.quote(payload)}`));\n// foototal 3\n// drwxr-xr-x 1 owner XXXXXX      0 Mar 13 18:44 .\n// drwxr-xr-x 1 owner XXXXXX      0 Mar 13 00:09 ..\n// drwxr-xr-x 1 owner XXXXXX      0 Mar 13 18:42 folder                                                                 \n// -rw-r--r-- 1 owner XXXXXX      0 Mar 13 18:42 file\n```\n\n### Patches\n\nThe problem has been patched in [v1.1.3](https://github.com/ericcornelissen/shescape/releases/tag/v1.1.3) which you can upgrade to now. No further changes are required.\n\n### Workarounds\n\nAlternatively, null characters can be stripped out manually using e.g. `arg.replace(/\\u{0}/gu, \"\")`","published":"2021-03-19T00:15:11.793Z","modified":"2026-07-09T00:21:53.169099Z","cvss":{"score":7.8,"severity":"HIGH","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"},"epss":null,"cisaKev":null,"exploitsKnown":null,"affectedPackages":[{"ecosystem":"npm","name":"shescape","fixedVersion":"1.1.3"}],"fix":{"url":"https://github.com/ericcornelissen/shescape/commit/07a069a66423809cbedd61d980c11ca44a29ea2b","label":"ericcornelissen/shescape@07a069a"},"references":[{"type":"WEB","url":"https://www.npmjs.com/package/shescape"},{"type":"ADVISORY","url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.1.3"},{"type":"FIX","url":"https://github.com/ericcornelissen/shescape/commit/07a069a66423809cbedd61d980c11ca44a29ea2b"},{"type":"EVIDENCE","url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-f2rp-38vg-j3gh"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21384"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-07-09T00:21:53.169099Z"}}