Executive brief
vm2 is a popular software library used to run untrusted code in a secure, isolated environment (a sandbox). A critical flaw was discovered that allows an attacker to bypass these security restrictions and "break out" of the sandbox. If exploited, an attacker could gain full control over the underlying server, allowing them to steal sensitive data, disrupt operations, or execute malicious commands.
Technical details
A sandbox escape vulnerability exists in vm2 prior to version 3.11.0 due to a flaw in how the 'inspect' function handles proxies. Specifically, util.inspect({showProxy:true}) can leak a BaseHandler instance to the sandbox environment. An attacker can leverage this leaked handler to reconstruct the handler class via its prototype chain (e.g., using p.getPrototypeOf(p).constructor). By constructing a new handler that wraps an attacker-controlled object, the attacker can use the '.set' trap as a cross-realm read/write channel to execute arbitrary code on the host Node.js process. The fix implements a three-layer defense including a construction token, receiver guards, and rebinding the constructor on handler prototypes to a sentinel function.
Affected products
- patriksimek vm2 < 3.11.0
Timeline
- 2026-04-24: other: Fix developed to block handler class reconstruction
- 2026-05-04: advisory: CVE-2026-24781 published
- 2026-05-04: patched: Version 3.11.0 released
References
- https://github.com/patriksimek/vm2/commit/8d30d93213c1898b3e035298b89a814970dd1189
- https://github.com/patriksimek/vm2/commit/bdd3d15e57bc4ec5e70365cd79f7cb0256e5f88c
- https://github.com/patriksimek/vm2/commit/fd266d084e0a3322d0f71ba2a8dc4c96cd030228
- https://github.com/patriksimek/vm2/releases/tag/v3.11.0
- https://github.com/patriksimek/vm2/security/advisories/GHSA-v37h-5mfm-c47c
- https://access.redhat.com/errata/RHSA-2026:26234
- https://access.redhat.com/security/cve/CVE-2026-24781