CVE-2017-16088: Sandbox Breakout in safe-eval

safe-eval Updated 02 Oct 2025

Summary

18/07/2018
No i
Critical
10.0

CVE-2017-16088: Sandbox Breakout in safe-eval. Affects safe-eval versions < 0.3.0. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The safe-eval package is an npm package that provides a sandboxed JavaScript evaluator. It allows users to execute JavaScript code in a controlled environment, preventing access to potentially harmful operations. However, certain versions of safe-eval are vulnerable to a sandbox escape, which can lead to unauthorized access to the entire standard library and potential security breaches.

Vulnerability Detail

The vulnerability in safe-eval arises from the ability of un-sanitized user input to access object constructors. By exploiting this, an attacker can break out of the sandbox and gain access to sensitive resources. For example, an attacker could access the process object and call .exit(), potentially terminating the application or executing arbitrary code. This vulnerability poses a significant risk as it allows an attacker to bypass the intended restrictions of the sandbox and perform unauthorized actions.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If updating to the latest version of safe-eval is not immediately feasible, a temporary workaround is to avoid using un-sanitized user input in the evaluation process. By thoroughly validating and sanitizing user input before passing it to safe-eval, the risk of a sandbox escape can be mitigated. Here is an example of how to sanitize user input in Node.js:

const safeEval = require('safe-eval');

function sanitizeInput(input) {
  // Perform input validation and sanitization
  // ...
  return sanitizedInput;
}

const userInput = 'this.constructor.constructor(\'return process\')().exit()';
const sanitizedInput = sanitizeInput(userInput);

safeEval(sanitizedInput);

Conclusion

The safe-eval package is vulnerable to a sandbox escape, allowing unauthorized access to the standard library. It is crucial to update to version 0.4.0 or later to fix this vulnerability. If immediate updating is not possible, sanitizing user input can provide a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for safe-eval →

Share this vulnerability

FAQ

This vulnerability allows an attacker to break out of the sandbox in safe-eval and access the entire standard library. This can lead to unauthorized actions, such as terminating the application or executing arbitrary code.

Versions 0.3.0 and earlier of safe-eval are affected by this vulnerability.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your package-lock.json file, and Vulert will analyze it for any open-source vulnerabilities, including this one.

Yes, updating to version 0.4.0 or later of the safe-eval package will fix this vulnerability.

If updating to the latest version is not immediately feasible, you can sanitize user input before passing it to safe-eval to mitigate the risk of a sandbox escape. Ensure thorough validation and sanitization of user input to prevent unauthorized access.

Related vulnerabilities

Recent vulnerabilities recorded for safe-eval.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback