GHSA-9pcf-h8q9-63f6: Safe eval Sandbox Breakout / Arbitrary Code Vulnerability

HIGH
Published
Advisory Summary

GHSA-9pcf-h8q9-63f6 is a HIGH sandbox breakout / arbitrary code vulnerability (General Security Weakness) affecting Safe eval libraries in the npm ecosystem. The issue involves sandbox breakout / arbitrary code execution in safe-eval. Remediation is available in the latest vendor maintenance releases.

GHSA-9pcf-h8q9-63f6 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-9pcf-h8q9-63f6
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Safe eval
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-9pcf-h8q9-63f6

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 GHSA-9pcf-h8q9-63f6, 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 General Security Weakness. 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

All versions of `safe-eval` are vulnerable to Sandbox Escape leading to Remote Code Execution. A payload chaining a function's callee and caller constructors can escape the sandbox and execute arbitrary code. For example, the payload ``` ((() => { const targetKey = Object.keys(this)[0]; Object.defineProperty(this, targetKey, { get: function() { return arguments.callee.caller.constructor( "return global.process.mainModule.require('child_process').execSync('pwd').toString()" )(); } }); })();``` may be used to print the `pwd` to the console. ## Recommendation No fix is currently available. Consider using an alternative package until a fix is made available.

GHSA-9pcf-h8q9-63f6 Affected Safe eval Versions

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

References

Frequently Asked Questions

What is GHSA-9pcf-h8q9-63f6?
GHSA-9pcf-h8q9-63f6 is a security vulnerability in Safe eval involving Sandbox Breakout / Arbitrary Code Execution in safe-eval under General Security Weakness.
Which Safe eval versions are affected?
Affected versions include releases prior to current release patches across affected packages: safe-eval.
What version fixes GHSA-9pcf-h8q9-63f6?
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 CWE is associated with GHSA-9pcf-h8q9-63f6?
GHSA-9pcf-h8q9-63f6 is classified under General Security Weakness.
How can I check npm dependencies for GHSA-9pcf-h8q9-63f6?
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-9pcf-h8q9-63f6",
  "modified" : "2020-08-31T18:44:49Z",
  "published" : "2020-09-03T17:12:41Z",
  "aliases" : [ ],
  "summary" : "Sandbox Breakout / Arbitrary Code Execution in safe-eval",
  "details" : "All versions of `safe-eval` are vulnerable to Sandbox Escape leading to Remote Code Execution. A payload chaining a function's callee and caller constructors can escape the sandbox and execute arbitrary code.  \n\nFor example, the payload \n```\n((() => { \nconst targetKey = Object.keys(this)[0]; \nObject.defineProperty(this, targetKey, { \nget: function() { \nreturn arguments.callee.caller.constructor( \n\"return global.process.mainModule.require('child_process').execSync('pwd').toString()\" \n)(); \n} \n}); \n})();```\nmay be used to print the `pwd` to the console.\n\n\n## Recommendation\n\nNo fix is currently available. Consider using an alternative package until a fix is made available.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "safe-eval"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1033"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:44:49Z",
    "nvd_published_at" : null
  }
}