Skip to main content
COSMICBYTEZLABS
NewsSecurityHOWTOsToolsTraining
StudyProjectsNewsletterHire MeAbout
Subscribe

Press Enter to search or Esc to close

News
Security
HOWTOs
Tools
Training
Study
Projects
Newsletter
Hire Me
About
RSS Feed
Reading List
Subscribe

Stay in the Loop

Get the latest security alerts, tutorials, and tech insights delivered to your inbox.

Subscribe NowFree forever. No spam.
COSMICBYTEZLABS

Your trusted source for IT intelligence, cybersecurity insights, and hands-on technical guides.

1451+ Articles
151+ Guides

CONTENT

  • Latest News
  • Security Alerts
  • HOWTOs
  • Checklists
  • Projects
  • Exam Prep

RESOURCES

  • Search
  • Browse Tags
  • Newsletter Archive
  • Reading List
  • RSS Feed

COMPANY

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CosmicBytez Labs. All rights reserved.

System Status: Operational
  1. Home
  2. Security
  3. CVE-2026-47131: vm2 Sandbox Escape via Buffer Prototype Hijack (CVSS 10.0)
CVE-2026-47131: vm2 Sandbox Escape via Buffer Prototype Hijack (CVSS 10.0)

Critical Security Alert

This vulnerability is actively being exploited. Immediate action is recommended.

SECURITYCRITICALCVE-2026-47131

CVE-2026-47131: vm2 Sandbox Escape via Buffer Prototype Hijack (CVSS 10.0)

A CVSS 10.0 critical sandbox escape in vm2 for Node.js allows sandboxed code to obtain the host TypeError constructor via Buffer.__lookupGetter__ abuse,...

Dylan H.

Security Team

June 13, 2026
6 min read

Affected Products

  • vm2 Node.js sandbox library — all versions prior to 3.11.4

CVE-2026-47131: vm2 Node.js Sandbox Escape via Buffer Prototype Hijack

A maximum-severity sandbox escape vulnerability tracked as CVE-2026-47131 has been disclosed in vm2, one of the most widely used Node.js sandbox libraries. With a CVSS v3.1 score of 10.0 (Critical), the flaw allows code running inside the vm2 sandbox to break out and execute arbitrary commands on the host Node.js process.

The vulnerability exploits a combination of Buffer.call.call({}.__lookupGetter__, Buffer, "__proto__") and Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__") together with Node.js's ERR_INVALID_ARG_TYPE Error to obtain a reference to the host's TypeError constructor from within sandboxed code. This reference can then be leveraged to escape isolation entirely and run code at the host level.

The vulnerability is patched in vm2 version 3.11.4. All users of prior versions should upgrade immediately.


Vulnerability Overview

AttributeValue
CVE IDCVE-2026-47131
CVSS Score10.0 (Critical)
Affected Softwarevm2 Node.js sandbox — all versions < 3.11.4
Attack VectorLocal (sandboxed code execution)
Authentication RequiredNone — sandboxed context only
Primary ImpactFull host code execution / sandbox breakout
SourceNVD / NIST (published 2026-06-12)
FixUpgrade to vm2 3.11.4

Background: vm2 and Node.js Sandboxing

vm2 is a Node.js module that provides a hardened sandbox environment, building on top of Node.js's built-in vm module. It is used extensively in:

  • Multi-tenant SaaS platforms that run user-submitted code
  • CI/CD pipelines executing plugin or workflow scripts
  • Code playgrounds and REPL environments
  • Build tools that evaluate arbitrary JavaScript configurations
  • Security testing and CTF infrastructure

The core promise of vm2 is that code running inside the sandbox cannot reach the host Node.js process — it should be fully isolated. This CVE, along with three related issues (CVE-2026-47137, CVE-2026-47140, CVE-2026-47208), breaks that isolation entirely.


Technical Details

The Attack Primitive: Buffer Prototype Access

JavaScript's Buffer object in Node.js is a subclass of Uint8Array. The vm2 sandbox normally intercepts property access and prototype chains to prevent sandboxed code from touching host-realm objects.

The attack leverages:

  1. {}.__lookupGetter__ — The __lookupGetter__ method walks the prototype chain to find the getter for a given property
  2. Buffer.call.call(...) — A double .call technique to invoke __lookupGetter__ as if called on the Buffer object itself, operating in the host realm
  3. "__proto__" — The property being looked up, which exposes the prototype chain

By combining these:

// Sandboxed attacker code (simplified)
const hostGetter = Buffer.call.call({}.__lookupGetter__, Buffer, "__proto__");
const hostSetter = Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__");

The vm2 sandbox fails to intercept this indirect prototype access pattern. The attacker gains a reference into the host JavaScript realm's object hierarchy.

Leaking the Host TypeError Constructor

With access to Buffer.__proto__, the attacker can traverse the host prototype chain. Node.js's ERR_INVALID_ARG_TYPE error is thrown when Buffer operations receive invalid arguments — and because this error is a host-realm TypeError, catching it provides a direct reference to the host TypeError constructor:

// Obtain host TypeError constructor
let hostTypeError;
try {
  // Trigger an ERR_INVALID_ARG_TYPE from Buffer
  Buffer.from("x").copy(null);
} catch (e) {
  hostTypeError = e.constructor;  // Now a host-realm TypeError, not the sandboxed one
}

Full Sandbox Escape

Once the attacker holds a reference to a host-realm constructor, they can access the Function constructor chain and execute arbitrary code:

const hostFunc = hostTypeError.prototype.constructor.constructor;
hostFunc("return process")().execSync("id");  // Executes on host

The escape path in simplified terms:

Buffer.call.call(__lookupGetter__, Buffer, "__proto__")
  → Host realm Buffer prototype exposed
    → ERR_INVALID_ARG_TYPE caught → host TypeError constructor obtained
      → TypeError.constructor.constructor === host Function
        → Arbitrary host code execution

Impact Assessment

Impact AreaDescription
Host RCEFull remote/local code execution on the Node.js host process
Sandbox Isolation BrokenAll isolation guarantees of vm2 are void on affected versions
Privilege EscalationSandboxed code runs with full Node.js process privileges on the host
Data ExfiltrationComplete access to host filesystem, environment variables, and network
Multi-tenant RiskAny platform using vm2 for tenant isolation is exposed to cross-tenant attacks
Supply Chain RiskPackages depending on vm2 for security inherit the vulnerability

Affected Systems

Any Node.js application that:

  • Runs untrusted or user-supplied JavaScript code inside vm2 < 3.11.4
  • Uses vm2 to isolate plugin execution, build scripts, or configuration evaluation
  • Relies on vm2 for multi-tenant code sandboxing

Run npm list vm2 or yarn list vm2 to check the installed version in your project.


Remediation

Immediate Fix: Upgrade vm2

# npm
npm update vm2
 
# yarn
yarn upgrade vm2
 
# Check version after upgrade
node -e "console.log(require('vm2/package.json').version)"
# Should output: 3.11.4 or later

Verify package.json / package-lock.json

{
  "dependencies": {
    "vm2": "^3.11.4"
  }
}

Consider Alternatives

vm2 has a history of sandbox escape CVEs. For production multi-tenant sandboxing of untrusted code, consider:

AlternativeMechanismNotes
Worker Threads + Permissions APIOS process isolation (Node.js 20+)Native, actively maintained
DenoV8 isolates with permissions modelStrong isolation model
isolated-vmV8 isolates via C++ bindingsLow-level, high performance
vm2 + seccompvm2 inside restricted containerDefense in depth

Related CVEs in This Batch

This advisory is one of four simultaneous vm2 sandbox escape disclosures all fixed in vm2 3.11.4:

CVEVulnerability
CVE-2026-47131 (this advisory)Buffer prototype hijack via __lookupGetter__ + TypeError
CVE-2026-47137Strict equality bypass enables require: false circumvention
CVE-2026-47140Incomplete denylist — process and inspector/promises not blocked
CVE-2026-47208General sandbox breakout enabling arbitrary host command execution

Key Takeaways

  1. CVE-2026-47131 is a CVSS 10.0 critical vm2 sandbox escape allowing full host Node.js process takeover
  2. The attack uses Buffer.call.call({}.__lookupGetter__, Buffer, "__proto__") to reach the host realm from sandboxed code
  3. All vm2 versions prior to 3.11.4 are vulnerable — upgrade immediately
  4. vm2 has an established pattern of sandbox escapes; evaluate whether stricter OS-level isolation is appropriate for your workload
  5. Run npm audit to identify downstream dependencies that bundle a vulnerable vm2 version

Sources

  • CVE-2026-47131 — NIST NVD
  • vm2 on npm
  • CWE-284: Improper Access Control
#CVE-2026-47131#vm2#Node.js#Sandbox Escape#RCE#Prototype Hijack#Buffer#CVSS 10.0#Critical#NVD

Related Articles

CVE-2026-47137: vm2 Sandbox Escape via Strict Equality require Bypass (CVSS 10.0)

A CVSS 10.0 critical sandbox escape in vm2 for Node.js allows attackers to bypass the require: false security option using falsy values, circumventing the...

6 min read

CVE-2026-47140: vm2 Sandbox Escape via Incomplete Builtin Denylist (CVSS 10.0)

A CVSS 10.0 critical sandbox escape in vm2 for Node.js allows sandboxed code to access the host process via the process and inspector/promises builtins,...

6 min read

CVE-2026-47208: vm2 General Sandbox Breakout — Arbitrary Host Execution (CVSS 10.0)

A CVSS 10.0 critical vulnerability in vm2 for Node.js allows sandbox code to escape and execute arbitrary OS commands on the host system. Patched in vm2 3.11.4.

6 min read
Back to all Security Alerts