/

CVE-2026-43999

Severity:

CRITICAL RISK

(9.9)

Authorization Bypass / Sandbox Escape in vm2 NodeVM Builtin

CVE-2026-43999

Modified

Vulnerability type

Category:

Authorization Bypass / Sandbox Escape

CWE:

CWE-863, CWE-829

Impact:

Remote Code Execution via Sandbox Escape

Severity:

CRITICAL RISK

(9.9)

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 flaw in vm2's NodeVM builtin allowlist allows sandboxed code to bypass builtin restrictions when the module builtin is permitted, even indirectly via the '*' wildcard.

By accessing Module._load() from within the sandbox, an attacker can load otherwise excluded core modules such as child_process in the host context and ultimately achieve remote code execution.

Affected context

This issue affects applications that:

  • Embed vm2 as a sandbox for executing untrusted or partially trusted JavaScript, and
  • Use NodeVM with a builtin allowlist that includes module or uses the '*' wildcard to allow all builtins, and
  • Rely on vm2's builtin restrictions as a primary defense against access to sensitive Node.js APIs.

In these configurations, the sandbox is intended to prevent direct use of dangerous builtins, but the exposed module builtin reintroduces a direct bridge into the host's module loading system.

Exploit preconditions

  • Attack surface: Code executed inside a vm2 NodeVM sandbox (e.g., user-supplied scripts, plugins, or extensions).
  • Required access: Ability to provide or influence JavaScript code that runs within a NodeVM instance configured with module or '*' in the builtin allowlist.
  • Trigger point: Execution of attacker-controlled code that calls into the module builtin and then uses Node's Module._load() functionality.
  • Why exploitation is possible: The sandbox grants access to the module builtin, which in turn exposes the host's Module._load() function. This function loads modules directly in the host context, ignoring vm2's builtin restrictions and enabling loading of excluded modules such as child_process.

Why this happens

The underlying issue is a logical authorization bypass in vm2's sandbox boundary design.

NodeVM is designed to enforce a builtin allowlist that restricts which Node.js core modules and APIs can be used by sandboxed code. However, when the module builtin is permitted, it exposes Node's internal Module loader, including methods like Module._load(), which operate in the host context. This effectively creates an unintended privileged capability inside the sandbox.

Because the allowlist was applied to direct builtin usage but not to the indirect loading behavior of Module._load(), sandboxed code can circumvent the intended policy and load any builtin module, including ones that should remain inaccessible. This maps to CWE-863: Incorrect Authorization, where the component responsible for enforcing access control fails to properly restrict access to sensitive functionality reachable through a permitted interface.

Potential impact

  • Sandboxed code can load sensitive core modules (e.g., child_process, fs, net) that were meant to be excluded.
  • Execution of arbitrary system commands via modules like child_process, leading to remote code execution in the host Node.js process.
  • Reading, modifying, or deleting files accessible to the host application.
  • Establishing outbound network connections or acting as a pivot point for further attacks inside the hosting environment.
  • Complete compromise of the security guarantees expected from vm2-based sandboxing.

General mitigation guidance

Mitigation centers on tightening sandbox boundaries and minimizing indirect capability exposure:

  • Avoid granting the module builtin to untrusted or semi-trusted code; prefer a minimal, explicit builtin allowlist that only includes strictly necessary APIs.
  • Refrain from using wildcard allowlists (e.g., '*') for builtins when handling untrusted input; start from a deny-by-default configuration and add only carefully vetted capabilities.
  • Conceptually separate "safe scripting" from general-purpose module loading; treat any API that can dynamically resolve or load modules as a privileged interface.
  • Apply the principle of least privilege to sandbox configurations: restrict filesystem, network, and process-related capabilities at both the Node.js and OS levels (e.g., container isolation, reduced process privileges).
  • Consider layering additional isolation mechanisms (such as OS-level sandboxes or containers) so that a failure in vm2's logical isolation does not directly expose the underlying system.

How teams detect issues like this

Organizations can approach detection of this pattern using:

  • Configuration reviews: Examine vm2 usage (especially NodeVM) for builtin allowlists that include module or the '*' wildcard where untrusted code may run.
  • Static analysis and code scanning: Search for constructors or helper functions that create NodeVM instances and flag those with permissive require or builtin configurations, especially where inputs originate from users, plugins, or external services.
  • Code review guidelines: Treat sandbox boundary code as security-critical; reviewers should verify that no APIs exposed into the sandbox can indirectly reach unrestricted module loaders or other privileged host capabilities.
  • Runtime monitoring: Instrument and log sandboxed module loading behavior (where feasible) and alert on unexpected access to sensitive modules (e.g., child_process, fs, net) originating from sandboxed contexts.
  • Automated security testing tools may assist in discovering sandbox escape vectors by fuzzing sandboxed environments and testing known bypass patterns.

Sources

SourceLink
github.comgithub.com/patriksimek/vm2/security/advisories/GHSA-947f-4v7f-x2v8
access.redhat.comaccess.redhat.com/errata/RHSA-2026:50850
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-43999
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2477196
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-43999.json

Frequently asked

questions

It can be, depending on how vm2 is used. If a service accepts remote input (such as user-submitted scripts or plugins) and executes it in a NodeVM configured with the vulnerable allowlist, a remote attacker can potentially achieve code execution on the host.

The attacker must be able to run or control JavaScript within a vm2 NodeVM instance where the module builtin is allowed (directly or via '*'). No additional host-level privileges are required beyond whatever the Node.js process already has.

Restrict the sandbox's capabilities by removing the module builtin from untrusted contexts and avoiding wildcard builtin allowlists. More broadly, treat any API that can load or resolve modules as privileged and keep it out of sandboxes running untrusted code.

Design sandbox configurations using least privilege, with explicit, minimal allowlists and regular security reviews of exposed capabilities. Combine application-level sandboxing with OS-level isolation, and include sandbox escape checks in threat modeling, code review, and automated security testing pipelines.

Find out what's already
exploitable in your codebase.