Null characters not escaped in shescape
cve-program · CVE-2021-21384
Publishedshescape 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.
Read the publisher's advisoryeuvd · EUVD-2021-0648
Publishedshescape 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.
Read the publisher's advisorynvd · CVE-2021-21384
Publishedshescape 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.
Read the publisher's advisoryosv · GHSA-f2rp-38vg-j3gh
Published### 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](https://en.wikipedia.org/wiki/Null_character) into the payload. For example (on Windows): ```javascript 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](https://github.com/ericcornelissen/shescape/releases/tag/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, "")`
Read the publisher's advisoryAffected versions, risk and source history
Related advisories and sources
Publishers link these advisories through the identifiers shown below. A shared identifier or date alone does not tell you whether your software is affected or whether the advisories describe the same cause.
CVE-2021-21384 · CVE overview and exploitation status
cve-program · CVE-2021-21384
- https://github.com/ericcornelissen/shescape/security/advisories/GHSA-f2rp-38vg-j3gh
- https://github.com/ericcornelissen/shescape/commit/07a069a66423809cbedd61d980c11ca44a29ea2b
- https://github.com/ericcornelissen/shescape/releases/tag/v1.1.3
- https://www.npmjs.com/package/shescape
euvd · EUVD-2021-0648
- https://github.com/ericcornelissen/shescape/security/advisories/GHSA-f2rp-38vg-j3gh
- https://github.com/ericcornelissen/shescape/commit/07a069a66423809cbedd61d980c11ca44a29ea2b
- https://github.com/ericcornelissen/shescape/releases/tag/v1.1.3
- https://www.npmjs.com/package/shescape
nvd · CVE-2021-21384
- https://github.com/ericcornelissen/shescape/commit/07a069a66423809cbedd61d980c11ca44a29ea2b
- https://github.com/ericcornelissen/shescape/releases/tag/v1.1.3
- https://github.com/ericcornelissen/shescape/security/advisories/GHSA-f2rp-38vg-j3gh
- https://www.npmjs.com/package/shescape
osv · GHSA-f2rp-38vg-j3gh
- 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
Related changes
Linked by CVE identifierNo related changes are available here.