/

CVE-2026-44006

Severity:

CRITICAL RISK

(10.0)

Code Injection / Sandbox Escape in vm2 Node.js Sandbox

CVE-2026-44006

Modified

Vulnerability type

Category:

Code Injection / Sandbox Escape

CWE:

CWE-94, CWE-914

Impact:

Sandbox Escape and 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 sandbox escape vulnerability in vm2 allows untrusted code to reach BaseHandler.getPrototypeOf, exposing arbitrary JavaScript prototypes inside the host environment.

Under certain conditions, an attacker running code inside a vm2 sandbox can abuse this prototype access to break isolation and potentially execute arbitrary code outside the intended sandbox boundary.

Affected context

This issue affects applications that:

  • Use vm2 as a security boundary to execute untrusted or semi-trusted JavaScript,
  • Rely on vm2's VM/sandbox abstraction to prevent access to host objects and prototypes, and
  • Expose vm2-powered execution as part of an API, plugin system, rules engine, or user-supplied scripting layer.

The vulnerability is relevant when sandboxed code can indirectly reach BaseHandler.getPrototypeOf, which undermines the assumption that prototype chains and core objects are safely isolated from untrusted scripts.

Exploit preconditions

  • Attack surface: Any feature where users can supply JavaScript executed inside a vm2 sandbox (e.g., custom scripts, expressions, extensions, in-app automation).
  • Required access: Ability to run code in the vm2 VM (even without direct access to Node.js APIs).
  • Trigger point: Invocation of APIs or language constructs that, due to vm2's internal logic, end up calling BaseHandler.getPrototypeOf.
  • Why exploitation is possible: The internal handler permits access to arbitrary prototypes, allowing the attacker to tamper with or traverse prototype chains and potentially craft objects that escape the sandbox's intended constraints, leading to code injection or access to host capabilities.

Why this happens

The root cause lies in vm2's handling of object introspection and prototype access inside the sandbox. BaseHandler.getPrototypeOf is part of vm2's machinery for mediating object interactions between the sandbox and host environment.

By allowing untrusted code to reach this handler, the sandbox leaks a powerful primitive: direct control over which prototypes can be observed or interacted with. This can enable construction of objects with privileged or unexpected prototypes, bypassing isolation assumptions and enabling execution paths that were not intended to be exposed. Conceptually, this maps to CWE-94: Improper Control of Generation of Code, because it breaks the controls around what code and behavior can be instantiated from untrusted input in a supposedly restricted execution environment.

Potential impact

  • Sandbox escape from vm2 into the surrounding Node.js process.
  • Execution of arbitrary JavaScript or OS commands with the privileges of the hosting application.
  • Access to sensitive process resources (environment variables, filesystem, network, secrets in memory).
  • Lateral movement within the application's infrastructure if the compromised process has further network or service access.
  • Tampering with application logic, data, and security checks that rely on the sandbox boundary.

General mitigation guidance

Effective mitigation focuses on hardening sandbox boundaries and minimizing trust in untrusted code execution:

  • Reassess whether untrusted JavaScript execution is strictly necessary; prefer declarative configuration or constrained DSLs when possible.
  • Treat the sandbox as a defense-in-depth control rather than a sole security boundary, and avoid granting it high-privilege process environments.
  • Apply strict input and feature restrictions to what untrusted scripts can access (e.g., avoid exposing powerful host objects or bridging helpers into the VM).
  • Run sandboxed execution in isolated processes or containers with least-privilege OS-level permissions, separate from core application services.
  • Enforce timeouts, memory limits, and resource quotas around untrusted script execution to constrain blast radius.
  • Regularly review and update sandbox libraries and incorporate them into a broader secure design instead of relying purely on library-level isolation promises.

How teams detect issues like this

Detection typically involves a mix of code-level analysis and runtime safeguards:

  • Static analysis / review: Look for code paths that:
  • Instantiate vm2 and execute arbitrary user-controlled code,
  • Treat vm2 as a primary security boundary (e.g., "this is safe because it runs in vm2"),
  • Expose powerful host objects, functions, or bridges into the sandbox context.
  • Security code review: Flag any use of vm2 in authentication, authorization, or multi-tenant isolation boundaries for deeper manual inspection.
  • Policy enforcement: Incorporate rules in CI/CD to:
  • Identify and gate the use of sandbox libraries for untrusted code,
  • Require security review when changing sandbox configuration or upgrading sandbox-related dependencies.
  • Runtime monitoring: Instrument sandboxed execution to track unexpected access patterns, errors, or escape attempts, and correlate them with upstream requests or tenants.

Sources

SourceLink
github.comgithub.com/patriksimek/vm2/security/advisories/GHSA-qcp4-v2jj-fjx8
access.redhat.comaccess.redhat.com/errata/RHSA-2026:50850
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-44006
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2477200
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-44006.json

Frequently asked

questions

It can be, if an application exposes vm2 as part of a remotely accessible feature (such as a scriptable API, rules engine, or plugin system) where attackers can supply arbitrary JavaScript. In such deployments, exploitation may be fully remote.

That depends on how vm2 is integrated. If only authenticated users can submit code to the sandbox, then exploitation is gated by authentication. If the feature is public or multi-tenant, any user with the ability to run code in the vm2 VM could attempt to exploit the issue.

The safest pattern is to avoid treating vm2 (or similar JavaScript sandboxes) as a hard security boundary. Where possible, replace arbitrary script execution with constrained configuration or a limited DSL, and if sandboxing is unavoidable, run it in separate, locked-down processes or containers, with minimal privileges and well-defined communication channels.

Design systems so that untrusted code execution is not central to security; apply defense-in-depth around any sandbox, including OS-level isolation, strict capability exposure, and resource limits. Incorporate dependency review, security testing, and regular updates for sandbox libraries into your development lifecycle, and treat any sandbox escape disclosure as a high-priority architectural concern rather than a minor library update.

Find out what's already
exploitable in your codebase.