CVE-2017-16088: Safe eval Sandbox Breakout Vulnerability

CRITICAL
Advisory Identifier: GHSA-ww6v-677g-p656
CVSS 10.0
CWE-610
Published
Advisory Summary

CVE-2017-16088 is a CRITICAL (CVSS 10.0) sandbox breakout vulnerability (CWE-610: Externally Controlled Reference to a Resource in Another Sphere) affecting Safe eval libraries in the npm ecosystem. The issue involves sandbox breakout in safe-eval. Remediation is available in the latest vendor maintenance releases.

CVE-2017-16088 at a Glance

CVE Identifier CVE-2017-16088
GHSA Identifier GHSA-ww6v-677g-p656
Severity CRITICAL
CVSS v3.1 Base Score 10.0
CWE Classification CWE-610: Externally Controlled Reference to a Resource in Another Sphere
Affected Product Safe eval
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 10.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2017-16088

To remediate this vulnerability, upgrade all affected Safe 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.

safe-eval fixed: Latest secure release
npm install safe-eval@Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls safe-eval

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2017-16088, inspect your project dependencies using npm:

npm ls safe-eval

Analyze the terminal output to locate any version of Safe eval in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The npm ls safe-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-610: Externally Controlled Reference to a Resource in Another Sphere, where the product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere. In Safe 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

Affected versions of `safe-eval` are vulnerable to a sandbox escape. By accessing object constructors, un-sanitized user input can access the entire standard library and effectively break out of the sandbox. ## Proof of Concept: This code accesses the process object and calls `.exit()` ```js var safeEval = require('safe-eval'); safeEval("this.constructor.constructor('return process')().exit()"); ``` ## Recommendation Update to version 0.4.0 or later

CVE-2017-16088 Affected Safe eval Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
safe-eval
npm
≤ 0.3.0

References

Frequently Asked Questions

What is CVE-2017-16088?
CVE-2017-16088 is a security vulnerability in Safe eval involving Sandbox Breakout in safe-eval under CWE-610: Externally Controlled Reference to a Resource in Another Sphere.
Which Safe eval versions are affected?
Affected versions include releases prior to current release patches across affected packages: safe-eval.
What version fixes CVE-2017-16088?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is safe-eval affected?
Yes, safe-eval is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2017-16088?
CVE-2017-16088 has a CVSS v3.1 base score of 10.0 (CRITICAL) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2017-16088?
CVE-2017-16088 is classified under CWE-610: Externally Controlled Reference to a Resource in Another Sphere (The product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere.).
How can I check npm dependencies for CVE-2017-16088?
Run the dependency tree command: 'npm ls safe-eval'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-ww6v-677g-p656",
  "modified" : "2023-09-11T22:19:18Z",
  "published" : "2018-07-18T18:28:10Z",
  "aliases" : [ "CVE-2017-16088" ],
  "summary" : "Sandbox Breakout in safe-eval",
  "details" : "Affected versions of `safe-eval` are vulnerable to a sandbox escape. By accessing object constructors, un-sanitized user input can access the entire standard library and effectively break out of the sandbox. \n\n## Proof of Concept:\nThis code accesses the process object and calls `.exit()`\n```js\nvar safeEval = require('safe-eval');\nsafeEval(\"this.constructor.constructor('return process')().exit()\");\n```\n\n\n## Recommendation\n\nUpdate to version 0.4.0 or later",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "safe-eval"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.3.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-16088"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/hacksparrow/safe-eval/issues/5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/patriksimek/vm2/issues/59"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/hacksparrow/safe-eval/pull/13"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-ww6v-677g-p656"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/337"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-610" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T22:01:17Z",
    "nvd_published_at" : null
  }
}