Sandbox Breakout / Arbitrary Code Execution in localeval

localeval Updated 02 Oct 2025

Summary

04/09/2020
CRITICAL
Yes i
Critical
Not published

GHSA-mmqv-m45h-q2hp: Sandbox Breakout / Arbitrary Code Execution in localeval. Affects localeval versions >= 0.0.0, < 15.3.0. Fixed in 15.3.0. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The localeval package is an npm package used for evaluating JavaScript code in a sandboxed environment. It provides a secure way to execute user-provided code without exposing the underlying system. However, all versions of localeval are vulnerable to a Sandbox Escape leading to Remote Code Execution. This vulnerability allows attackers to execute arbitrary code in the system by bypassing the sandbox restrictions.

Vulnerability Detail

The vulnerability in localeval arises from the package's failure to restrict access to the main context through constructor.constructor. This allows attackers to execute arbitrary code in the system. By evaluating the payload constructor.constructor("return process.env")(), an attacker can retrieve the contents of process.env, potentially exposing sensitive information. This vulnerability poses a significant risk as it can lead to remote code execution and compromise the security and integrity of the system.

How To Fix

Minimum fixed version

15.3.0

This is the first release that contains the fix.

npm install localeval@15.3.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As there is no fix available, a possible workaround is to avoid using localeval altogether and switch to a different package that provides similar functionality but without the vulnerability. This will help mitigate the risk of sandbox escape and arbitrary code execution. Here is an example of how to use the vm module in Node.js as an alternative:

const vm = require('vm');

const code = 'console.log(process.env);';

const sandbox = {
  console,
  process
};

const script = new vm.Script(code);
const context = new vm.createContext(sandbox);

script.runInContext(context);

This code snippet demonstrates how to execute user-provided code in a sandboxed environment using the vm module in Node.js. By explicitly defining the allowed objects and properties in the sandbox object, you can restrict access to sensitive resources and prevent arbitrary code execution.

Conclusion

The localeval package is vulnerable to a Sandbox Escape leading to Remote Code Execution. This vulnerability allows attackers to execute arbitrary code in the system by bypassing the sandbox restrictions. Currently, there is no fix available, and it is recommended to consider using an alternative package until a fix is made available. Stay updated with the official GitHub repository or the npm package page for any updates on a patched version. For further support on vulnerability remediation, you can reach out to the Devnack team at DevNack.com.

See every vulnerability recorded for localeval →

Share this vulnerability

FAQ

localeval is an npm package used for evaluating JavaScript code in a sandboxed environment. It provides a secure way to execute user-provided code without exposing the underlying system.

This vulnerability allows attackers to break out of the sandbox and execute arbitrary code in the system. It can lead to remote code execution and compromise the security and integrity of the system.

Currently, there is no fix available for this vulnerability in localeval. It is recommended to consider using an alternative package until a fix is made available.

To mitigate the risk of this vulnerability, it is recommended to avoid using localeval and switch to a different package that provides similar functionality but without the vulnerability. Additionally, ensure that your application is always up to date with the latest security patches and follow secure coding practices.

You can find more information about this vulnerability in the official GitHub advisory database. Additionally, you can reach out to the Devnack team at info@devnack.com for further support on vulnerability remediation.

How To Fix

Minimum fixed version

15.3.0

This is the first release that contains the fix.

npm install localeval@15.3.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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