{"id":"CVE-2022-24725","aliases":["CVE-2022-24725","GHSA-446w-rrm4-r47f"],"related":[],"kind":"vulnerability","state":"published","title":"Exposure of home directory through shescape on Unix with Bash","summary":"Shescape is a shell escape package for JavaScript. An issue in versions 1.4.0 to 1.5.1 allows for exposure of the home directory on Unix systems when using Bash with the `escape` or `escapeAll` functions from the _shescape_ API with the `interpolation` option set to `true`. Other tested shells, Dash and Zsh, are not affected. Depending on how the output of _shescape_ is used, directory traversal may be possible in the application using _shescape_. The issue was patched in version 1.5.1. As a workaround, manually escape all instances of the tilde character (`~`) using `arg.replace(/~/g, \"\\\\~\")`.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Shescape is a shell escape package for JavaScript. An issue in versions 1.4.0 to 1.5.1 allows for exposure of the home directory on Unix systems when using Bash with the `escape` or `escapeAll` functions from the _shescape_ API with the `interpolation` option set to `true`. Other tested shells, Dash and Zsh, are not affected. Depending on how the output of _shescape_ is used, directory traversal may be possible in the application using _shescape_. The issue was patched in version 1.5.1. As a workaround, manually escape all instances of the tilde character (`~`) using `arg.replace(/~/g, \"\\\\~\")`.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nThe issue allows for exposure of the home directory on Unix systems when using Bash with the `escape` or `escapeAll` functions from the _shescape_ API with the `interpolation` option set to `true`. Other tested shells, Dash and Zsh, are not affected.\n\n```javascript\nconst cp = require(\"child_process\");\nconst shescape = require(\"shescape\");\n\nconst payload = \"home_directory=~\";\nconst options = { interpolation: true };\nconsole.log(cp.execSync(`echo ${shescape.escape(payload, options)}`));\n// home_directory=/home/user\n```\n\nDepending on how the output of _shescape_ is used, directory traversal may be possible in the application using _shescape_.\n\n### Patches\n\nThe issue was patched in `v1.5.1`.\n\n### Workarounds\n\nManually escape all instances of the tilde character (`~`) using `arg.replace(/~/g, \"\\\\~\")`.\n\n### References\n\nSee GitHub issue https://github.com/ericcornelissen/shescape/issues/169.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Shescape es un paquete de escape de shell para JavaScript. Un problema en las versiones 1.4.0 a 1.5.1 permite una exposición del directorio de inicio en los sistemas Unix cuando es usada Bash con las funciones \"escape\" o \"escapeAll' de la API _shescape_ con la opción \"interpolation\" establecida en \"true\". Otros shells probados, Dash y Zsh, no están afectados. Dependiendo de cómo es usada la salida de _shescape_, puede ser posible un salto de directorio en la aplicación que usa _shescape_. El problema fue parcheado en la versión 1.5.1. Como medida de mitigación, escape manualmente todas las instancias del carácter tilde (\"~\") usando \"arg.replace(/~/g, \"\\~~\")`","source":"nvd"}],"published":"2022-03-03T19:26:11.000Z","modified":"2026-06-17T04:32:22.800Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":6.2,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":6.2,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:M/Au:N/C:P/I:N/A:N","score":1.9,"rating":"LOW"}],"cwes":["CWE-78","CWE-200"],"affected":[{"ranges":[{"version":">= 1.4.0, < 1.5.1","status":"affected"}],"vendor":"ericcornelissen","product":"shescape","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"1.4.0","status":"affected","fixed":"1.5.1"}],"ecosystem":"npm","package":"shescape","purl":"pkg:npm/shescape","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"1.4.0","fixed":"1.5.1"}],"vendor":"shescape_project","product":"shescape","cpe":"cpe:2.3:a:shescape_project:shescape:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-446w-rrm4-r47f","tags":["exploit","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/issues/169","tags":["exploit","issue-tracking","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/pull/170","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24725","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/ericcornelissen/shescape","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-04-22T15:49:34.610Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-24725","url":"https://www.cve.org/CVERecord?id=CVE-2022-24725","licence":"CVE Terms of Use","modified":"2025-04-22T18:20:38.968Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-446w-rrm4-r47f","url":"https://github.com/advisories/GHSA-446w-rrm4-r47f","licence":"CC-BY-4.0","modified":"2023-11-08T04:08:33.838Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-24725","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24725","licence":"Public domain","modified":"2026-06-17T04:32:22.800Z"}],"updatedAt":"2026-11-25T22:58:09.909Z","epss":{"score":0.00499,"percentile":0.44367,"date":"2026-12-01T12:00:22.000Z"}}