Critical vm2 Flaw Lets Attackers Escape Node.js Sandbox and Execute Arbitrary Code (CVE-2026-22709)

A serious security vulnerability has been discovered in vm2, a popular JavaScript sandbox library widely used in Node.js applications. The flaw, tracked as CVE-2026-22709, has been classified as critical severity due to its potential impact on systems that rely on vm2 to safely execute untrusted code.

vm2 is designed to isolate JavaScript code and prevent it from accessing sensitive parts of the host environment. However, this newly disclosed issue completely breaks that isolation model, allowing attackers to escape the sandbox and run arbitrary code directly on the host system.


How the Vulnerability Works

The root cause of the vulnerability lies in improper sanitization of Promise callback handling within vm2. Specifically, when async functions are executed inside the sandbox, they return global Promise objects instead of sandboxed ones. The callbacks attached to these Promises—such as .then() and .catch()—are not properly cleaned or isolated before being executed.

This oversight creates an opportunity for attackers to manipulate execution flow. By carefully crafting malicious code, an attacker can break out of the restricted environment and gain access to sensitive Node.js internals that should never be reachable from inside the sandbox.


Proof of Concept and Exploitation

Security researchers have demonstrated a proof-of-concept exploit showing how the flaw can be abused in real-world scenarios. Using the vulnerability, an attacker can reach Node.js’s powerful Function constructor, which can then be leveraged to execute arbitrary system commands.

Once this point is reached, the sandbox is effectively useless. The attacker gains the same level of control as the application itself, opening the door to data theft, unauthorized access, and full server compromise.


Affected Versions and Fixes

The vulnerability affects a broad range of vm2 installations:

  • Vulnerable versions: All vm2 releases up to and including version 3.10.0
  • Partial mitigation: Introduced in version 3.10.1
  • Fully patched: vm2 version 3.10.2

Users running vulnerable versions are strongly urged to update immediately. Continuing to use unpatched versions of vm2 to execute untrusted code poses a significant security risk.


Why This Issue Is So Serious

vm2 is used in hundreds of thousands of projects across the Node.js ecosystem. It powers SaaS platforms, online code execution tools, developer utilities, chatbots, and automation systems—many of which rely on vm2 as a core security boundary.

A sandbox escape vulnerability like CVE-2026-22709 allows attackers to bypass that boundary entirely. In the worst case, this can result in full remote code execution, server takeover, data breaches, or lateral movement within a network.


A Pattern of Past Security Concerns

Unfortunately, this is not the first time vm2 has faced major security issues. Similar sandbox escape vulnerabilities have been disclosed in previous years, including CVE-2022-36067, raising ongoing concerns about the long-term reliability of vm2 as a secure sandboxing solution.


What Developers Should Do Now

If you maintain a Node.js application that uses vm2, take action immediately:

  • Check your current vm2 version
  • Upgrade to version 3.10.2 or later
  • Review and audit any features that execute user-supplied code

Given vm2’s history of critical vulnerabilities, teams should also consider whether additional isolation mechanisms or alternative sandboxing approaches are necessary for high-risk workloads.