QID 983848

QID 983848: Nodejs (npm) Security Update for shescape (GHSA-f2rp-38vg-j3gh)

Security update has been released for shescape to fix the vulnerability. Note: The preceding description block is extracted directly from the security advisory. Using automation, we have attempted to clean and format it as much as possible without introducing additional issues.

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 ```

  • CVSS V3 rated as High - 7.8 severity.
  • CVSS V2 rated as Medium - 4.6 severity.
  • Solution
    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.Workaround:
    Alternatively, null characters can be stripped out manually using e.g. `arg.replace(/\u{0}/gu, "")`
    Vendor References

    CVEs related to QID 983848

    Software Advisories
    Advisory ID Software Component Link
    GHSA-f2rp-38vg-j3gh shescape URL Logo github.com/advisories/GHSA-f2rp-38vg-j3gh