/

CVE-2026-44005

Severity:

CRITICAL RISK

(10.0)

Sandbox Escape / Prototype Pollution in vm2 for Node.js

CVE-2026-44005

Modified

Vulnerability type

Category:

Sandbox Escape / Prototype Pollution

CWE:

CWE-94, CWE-1321, CWE-653

Impact:

Sandbox Escape and Arbitrary Code Execution in Host Context

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

vm2's sandbox bridge exposed mutable proxies to host-realm intrinsic prototypes and forwarded writes from the sandbox into real host objects.

Attacker-controlled JavaScript running in a default VM or inherited NodeVM could mutate shared host Object.prototype, Array.prototype, and Function.prototype, effectively escaping the sandbox and executing arbitrary behavior in the host context.

Affected context

This vulnerability affects applications that:

  • Use vm2 versions 3.9.6 through 3.10.5
  • Rely on the default VM or inherited NodeVM to isolate untrusted or semi-trusted JavaScript
  • Allow sandboxed code to interact with bridged host objects or built-ins

In such setups, the vm2 bridge exposes proxies tied to host intrinsic prototypes (e.g., Object.prototype, Array.prototype, Function.prototype), so prototype changes made inside the sandbox can leak into and corrupt the host environment's global behavior.

Exploit preconditions

  • Attack surface: JavaScript execution environments that embed vm2 for isolation (e.g., plugin systems, online code runners, multi-tenant services).
  • Required access: Ability to execute arbitrary or attacker-controlled code inside a vm2 VM (default VM or inherited NodeVM).
  • Trigger point: The moment sandboxed code performs writes (e.g., property assignment or defineProperty) on bridged prototypes or objects backed by host prototypes.
  • Why exploitation is possible: The vm2 bridge exposes mutable proxies referencing real host intrinsic prototypes and uses otherReflectSet() and otherReflectDefineProperty() to forward write operations. This breaks isolation guarantees by allowing sandbox code to directly modify shared host prototypes, impacting all host-side code that depends on them.

Why this happens

The core issue is a broken isolation boundary in vm2's bridging mechanism. Instead of providing fully detached or deeply cloned copies of host objects, the bridge exposes proxies that remain logically connected to host intrinsic prototypes.

Because otherReflectSet() and otherReflectDefineProperty() forward write operations from sandbox proxies to underlying host objects, sandbox code can mutate Object.prototype, Array.prototype, and Function.prototype in the host realm.

This maps to CWE-1321: Prototype Pollution, where modification of prototype chains leads to unexpected behavior and security violations, and is closely related to CWE-94: Code Injection because polluted prototypes can be leveraged to execute arbitrary code or subvert security controls in the host environment.

Potential impact

  • Sandbox escape, allowing untrusted code to influence or control logic in the host Node.js process
  • Execution of arbitrary behavior in the host context by modifying core prototypes used throughout the application
  • Data theft or tampering via altered behavior of common operations (e.g., property access, array iteration, function invocation)
  • Bypassing security checks or logging by injecting malicious behavior into patched prototype methods
  • Denial of service through prototype changes that cause infinite loops, excessive allocations, or widespread runtime errors

General mitigation guidance

Effective mitigation focuses on restoring strict isolation between sandbox and host realms and minimizing trust in shared prototypes:

  • Use sandboxing mechanisms that do not expose direct or proxied access to host intrinsic prototypes; prefer fully isolated realms or deep copies of necessary objects.
  • Restrict or eliminate bridging of host objects into the sandbox unless strictly necessary; prefer narrow, well-defined APIs instead of broad object graphs.
  • Enforce defensive programming patterns that assume prototypes may be polluted: avoid relying on inherited properties, and use Object.create(null) where practical for maps.
  • Run sandboxed environments with least privilege: isolate processes, restrict file system, network, and environment access, and consider OS-level sandboxing to contain potential escapes.
  • Treat all code executed inside vm2 (or similar sandboxes) as potentially hostile, and architect systems to remain secure even if isolation fails.

How teams detect issues like this

Detection can focus both on code-level indicators and runtime behaviors:

  • Static analysis and review:
  • Scan for uses of vm2 (or similar sandboxes) that rely on default bridges or broad object exposure to untrusted code.
  • Flag patterns where host objects or global built-ins (Object, Array, Function) are passed into or exposed inside the sandbox.
  • Review any custom bridge or wrapper logic around vm2, especially where Reflect APIs or proxies interact with host internals.
  • Policy and configuration checks:
  • Enforce internal guidelines discouraging prototype-dependent logic and direct reliance on inherited methods from Object.prototype, Array.prototype, or Function.prototype.
  • Require security review when integrating sandboxing libraries for multi-tenant or untrusted code execution scenarios.
  • Runtime monitoring:
  • Instrument applications to detect unexpected changes to core prototypes at runtime (e.g., detecting new properties on Object.prototype, Array.prototype, Function.prototype).
  • Use logging or telemetry to capture anomalous behavior from sandboxed code, such as attempts to reconfigure global objects.
  • Automated tooling:
  • Integrate SCA (software composition analysis) tools to highlight risky vm2 usage and known vulnerable versions.
  • Use automated code review tools to help spot unsafe bridging patterns and direct prototype manipulation.

Sources

SourceLink
github.comgithub.com/patriksimek/vm2/security/advisories/GHSA-vwrp-x96c-mhwq
access.redhat.comaccess.redhat.com/errata/RHSA-2026:50850
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-44005
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2477205
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-44005.json

Frequently asked

questions

It can be, depending on how vm2 is used. If a service accepts or executes user-supplied JavaScript inside a vm2 VM (for example, in an online REPL, plugin system, or multi-tenant platform), a remote attacker can exploit this issue by submitting crafted code to that service.

The attacker needs the ability to run arbitrary or controllable JavaScript inside a default VM or inherited NodeVM created by vm2. No direct access to the underlying host process is required; the exploit works through the sandbox boundary itself.

The general fix pattern is to ensure the sandbox does not expose mutable references or proxies to host intrinsic prototypes, and that any bridging occurs through narrow, controlled APIs. Using a vm2 configuration or alternative sandbox that enforces strict realm separation and avoids forwarding prototype writes is critical.

Design isolation boundaries under the assumption that shared prototypes are dangerous, avoid bridging global objects directly, and favor explicit capability-based interfaces. Combine this with defense-in-depth: process-level isolation, least-privilege execution, regular dependency reviews, and automated checks for prototype pollution and sandbox-escape patterns in code and dependencies.

Find out what's already
exploitable in your codebase.