PROBABLYPWNED
VulnerabilitiesMay 8, 20264 min read

12 Critical Flaws in vm2 Node.js Sandbox Enable Host Takeover

Security researchers disclosed 12 sandbox escape vulnerabilities in vm2, including three with CVSS 10.0 scores. The popular JavaScript isolation library can no longer be trusted to contain untrusted code.

Marcus Chen

The vm2 JavaScript sandbox library, downloaded millions of times from npm, has been gutted by a dozen critical vulnerabilities that allow malicious code to escape containment and execute on the host system. Three of the flaws carry perfect CVSS 10.0 scores, and the library's fundamental security model is now in question.

Security researchers at Semgrep and others have systematically dismantled vm2's protections, revealing that the library cannot reliably isolate untrusted JavaScript—the one thing it was designed to do.

The Vulnerability Landscape

Here's what's been disclosed:

CVECVSSEscape Method
CVE-2026-4399710.0Host object access via code injection
CVE-2026-4400510.0Prototype pollution enablement
CVE-2026-4400610.0BaseHandler.getPrototypeOf injection
CVE-2026-439999.9NodeVM allowlist bypass for child_process
CVE-2026-241189.8lookupGetter exploitation
CVE-2026-440089.8neutralizeArraySpeciesBatch() abuse
CVE-2026-440099.8Null proto exception handling
CVE-2026-247819.8inspect function vulnerability
CVE-2026-263329.8SuppressedError abuse
CVE-2026-241209.8Promise species patch bypass
CVE-2026-269569.8Symbol-to-string TypeError trigger
CVE-2026-440079.1OS command execution via access controls

Every single one of these flaws enables remote code execution on the underlying host system.

What vm2 Was Supposed to Do

vm2 exists to run untrusted JavaScript safely by intercepting and proxying JavaScript objects, preventing sandboxed code from reaching the host environment. It's used in CI/CD pipelines, online code execution platforms, and anywhere developers need to evaluate user-supplied code without handing over the keys to the server.

That core promise—that code inside a VM instance cannot reach the host—is now broken across multiple attack vectors.

The Patch Treadmill

The maintainers have released patches, but the disclosure notes are sobering: "new bypasses will likely be discovered in the future." The library has been patched repeatedly, with each fix introducing new attack surfaces:

  • Version 3.10.5 patched some flaws but introduced others
  • Version 3.11.0 addressed multiple issues but missed edge cases
  • Version 3.11.1 caught more escapes
  • Version 3.11.2 is the current "secure" release—until the next disclosure

This pattern echoes what we've seen with supply chain attacks on PyPI packages, where the security of upstream dependencies becomes a moving target that defenders can never quite catch.

Who Should Worry

If you're running vm2 in production to isolate untrusted code, you have a fundamental architecture problem. The library's security model has failed publicly and repeatedly. Even if you update to 3.11.2 today, you're trusting that no one finds another bypass before you can patch the next one.

Organizations using vm2 for:

  • Online code editors - User-submitted code can now attack your infrastructure
  • Plugin systems - Third-party plugins could escalate to full server access
  • Automated testing - Malicious test payloads could compromise CI/CD
  • Low-code platforms - User-defined automations become RCE vectors

Alternatives and Mitigations

The JavaScript ecosystem has alternative isolation approaches, though none are perfect:

  1. Process isolation - Run untrusted code in separate OS processes with restricted permissions
  2. Container isolation - Use Docker or similar with minimal capabilities
  3. WebAssembly sandboxes - Compile untrusted code to Wasm for stronger isolation
  4. Deno's permission model - Built-in sandboxing with explicit capability grants

For organizations that must continue using vm2 short-term, update to version 3.11.2 immediately and implement defense-in-depth: network segmentation, minimal process privileges, and monitoring for suspicious system calls.

Why This Matters

vm2's collapse illustrates a broader problem: JavaScript's dynamic nature makes true sandboxing extraordinarily difficult. The language wasn't designed for isolation, and bolt-on solutions keep failing. Organizations building products that execute user code need to revisit their security architecture, because npm packages are not security boundaries.

Related Articles