Summary
A policy enforcement flaw in vm2's NodeVM can bypass a deny-list entry when the entry uses a node:-prefixed builtin name. Untrusted sandboxed code may then access child_process and invoke process-spawning APIs, potentially achieving command execution on the host.
Affected context
The vulnerability occurs in vm2 NodeVM configurations that allow builtins through a wildcard policy while attempting to deny specific modules using node:-prefixed entries. It becomes risky when untrusted code runs in the sandbox and the policy relies on exact-name matching without normalizing builtin module specifiers.
Exploit preconditions
- Attack surface: NodeVM's builtin-module require policy
- Required access: Ability to execute untrusted JavaScript within an affected NodeVM sandbox
- Trigger point: Resolution of a builtin module requested through
require() - Why exploitation is possible: The policy compares negative entries against canonical builtin names, while
node:-prefixed deny entries are not normalized consistently, allowing a supposedly blocked module to remain available
Why this happens
The underlying bug is inconsistent canonicalization of module identifiers across authorization and resolution paths. NodeVM removes the node: prefix when resolving builtin modules, but its negative wildcard policy entries are compared using their original spelling. This maps to CWE-269: Improper Privilege Management, because a security policy fails to restrict access to a privileged capability that should have been denied.
Potential impact
- Sandboxed code may access the host
child_processbuiltin - An attacker could execute operating-system commands through process-spawning APIs
- The NodeVM isolation boundary could be bypassed
- Host files, credentials, or services may be exposed depending on process privileges
- A compromised process could affect other workloads or systems reachable from the host
General mitigation guidance
Mitigation generally focuses on making module authorization use one canonical representation throughout policy evaluation and module resolution.
Common defensive patterns include:
- Normalize builtin specifiers before applying allow or deny rules
- Use explicit allowlists instead of wildcard permissions where practical
- Deny high-risk capabilities such as process creation by default
- Run sandboxed workloads with minimal operating-system privileges and isolated resources
- Treat sandboxing as one layer and apply operating-system, container, and network restrictions around it
- Keep dependency and security-policy review processes aligned with the supported security fixes
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis for mismatched normalization between authorization checks and resource resolution
- Code review searches for wildcard module permissions combined with string-based deny rules
- Tests covering equivalent module spellings, including canonical and
node:-prefixed builtin names - Runtime policy monitoring for unexpected access to process-spawning modules
- Dependency and configuration checks that flag broad builtin access in sandbox environments
Automated security review tools may help identify inconsistent canonicalization and overly broad capability policies.

