/

CVE-2026-93603

Severity:

CRITICAL RISK

(10.0)

Sandbox Escape (CWE-94) in vm2 JavaScript Bridge Trap

CVE-2026-93603

Deferred

Vulnerability type

Category:

Sandbox Escape

CWE:

CWE-94

Impact:

Host-Level Arbitrary Code Execution

Severity:

CRITICAL RISK

(10.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A critical sandbox escape in vm2 exposes the host realm's global object when sandboxed code invokes an exposed non-strict host function without a receiver. This can allow untrusted JavaScript to access host capabilities, including process-level functionality, and potentially execute arbitrary commands on the host.

Affected context

The vulnerability occurs in vm2 deployments that expose at least one non-strict, host-defined JavaScript function to sandboxed code. It is triggered when that function is called with a nullish receiver, allowing the JavaScript engine to substitute the host realm's global object before vm2 wraps the result for the sandbox. Strict-mode and ES module host functions are not affected by this specific behavior.

Exploit preconditions

  • Attack surface: The vm2 JavaScript sandbox and its bridge for host-provided functions
  • Required access: Ability to execute untrusted JavaScript within the affected vm2 sandbox
  • Required exposure: At least one non-strict host function must be made available to sandboxed code
  • Trigger point: Invocation of the exposed function without a receiver
  • Why exploitation is possible: The bridge forwards a nullish receiver to the host call, while the JavaScript runtime substitutes the host global object and vm2 returns a live wrapped reference to the sandbox

Why this happens

The underlying bug is an incorrect handling of a nullish this receiver in the bridge's apply trap. For non-strict functions, the JavaScript runtime may replace an undefined receiver with the host realm's global object. By passing that object back through the sandbox boundary, vm2 violates the isolation assumption that host globals and their capabilities cannot be reached by untrusted code. This behavior maps to CWE-94: Improper Control of Generation of Code, because the resulting boundary escape can expose host execution capabilities to attacker-controlled script.

Potential impact

  • Sandboxed code could escape its intended isolation boundary
  • An attacker may access host process and runtime capabilities
  • Arbitrary code or operating-system commands could be executed on the host
  • Application credentials, environment data, or local files could be exposed
  • The host application and other workloads sharing the runtime could be compromised

General mitigation guidance

Mitigation generally focuses on preserving a strict capability boundary between sandboxed code and the host runtime.

Common defensive patterns include:

  • Avoiding exposure of non-strict host functions to untrusted sandboxes
  • Prefering strict-mode or narrowly scoped wrapper functions when host functionality is required
  • Explicitly validating and normalizing receivers at the bridge boundary
  • Exposing minimal capabilities through purpose-built interfaces rather than host objects or globals
  • Running sandboxed workloads with separate process, container, or operating-system isolation where practical
  • Applying least privilege to the host process and restricting access to sensitive files, credentials, and runtime services
  • Treating sandbox escape findings as boundary failures requiring review of all exposed host APIs

How teams detect issues like this

Detection can combine static analysis, code review, and runtime policy checks:

  • Search for vm2 configurations that expose host-defined functions to untrusted code
  • Review whether exposed callbacks are non-strict and whether receiver handling is explicit
  • Identify bridge or proxy traps that forward nullish receivers without normalization
  • Enforce policies limiting access to process, module-loading, filesystem, and command-execution capabilities
  • Add tests covering detached calls and other receiver-less invocation forms at the sandbox boundary
  • Use automated security review tools to flag dynamic host capability exposure and unsafe sandbox assumptions

Sources

SourceLink
github.comgithub.com/patriksimek/vm2/security/advisories/GHSA-j89j-5m6r-cr2q
vulncheck.comvulncheck.com/advisories/vm2-before-3.12.1-sandbox-escape-rce-via-non-strict-host-function

Frequently asked

questions

It can be exploitable remotely when an application executes attacker-controlled JavaScript in vm2 and exposes a qualifying non-strict host function. The exact reachability depends on how the application accepts and runs untrusted code.

The attacker needs the ability to execute script inside the affected sandbox. They do not necessarily need direct access to the host operating system, but the embedding application must expose at least one vulnerable host function.

Preserve the sandbox boundary by preventing exposure of non-strict host functions, normalizing receivers at the bridge, and exposing only narrowly scoped capabilities through strict wrappers or isolated services.

Minimize host-to-sandbox interfaces, test all invocation forms at security boundaries, apply least privilege to the host process, and use defense-in-depth isolation outside the JavaScript sandbox.

Find out what's already
exploitable in your codebase.