Vulnerabilities in pkg:npm/static-eval
PACKAGECVE-2017-16226 is a MODERATE sandbox breakout / arbitrary code vulnerability (CWE-20: Improper Input Validation) affecting Static eval libraries in the npm ecosystem. The issue involves sandbox breakout / arbitrary code execution in static-eval. Remediation is available by upgrading affected packages to version 2.0.0.
pkg:npm/static-eval
Vulnerability advisories affecting package pkg:npm/static-eval. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-5mjw-6jrh-hvfq | CVE-2017-16226 | MODERATE | Sandbox Breakout / Arbitrary Code Execution in static-eval |
| GHSA-x9hc-rw35-f44h | - | HIGH | Sandbox Breakout / Arbitrary Code Execution in static-eval |
| GHSA-8v27-2fg9-7h62 | CVE-2021-23334 | CRITICAL | Withdrawn: Arbitrary Code Execution in static-eval |
CVE-2017-16226 at a Glance
How to Fix CVE-2017-16226
To remediate this vulnerability, upgrade all affected Static eval dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install static-eval@2.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls static-eval
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2017-16226, inspect your project dependencies using npm:
npm ls static-eval
Analyze the terminal output to locate any version of Static eval in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0), your application is affected.
Note: The npm ls static-eval command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Static eval, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2017-16226 Affected Static eval Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
static-eval
|
npm |
< 2.0.0
|
2.0.0
|
References
Frequently Asked Questions
What is CVE-2017-16226?
Which Static eval versions are affected?
What version fixes CVE-2017-16226?
Is static-eval affected?
What CWE is associated with CVE-2017-16226?
How can I check npm dependencies for CVE-2017-16226?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}