CVE-2026-92962: vm2 before 3.11.4 Defense Invariant Violation via setup-sandbox.js
vm2 is a sandbox for running untrusted JavaScript. In vm2 versions up to and including 3.11.3, the defaultSandboxPrepareStackTrace function in lib/setup-sandbox.js builds its output array using prototype-walking index assignment (lines[lines.length] = value) rather than a prototype-bypassing define-property primitive. Because this bridge-internal array is allocated in the sandbox realm, code inside the sandbox can install an accessor on Array.prototype for the relevant index; the accessor is then invoked whenever the sandbox reads error.stack (or otherwise triggers Error.prepareStackTrace), allowing sandbox code to observe and intercept each stack-trace line written by the bridge. The same pattern is used in the error-handling (catch) branch. The values written are formatted strings only, so the practical impact is limited to an information side channel and a violation of vm2's bridge-container defense invariant rather than a sandbox escape; the vendor rates the issue Low. The issue is fixed in vm2 3.11.4, which installs each entry as an own data property via Reflect.defineProperty.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
vm2to a version that resolves this vulnerability.Fixed in 3.11.4
Event History
Frequently Asked Questions
Who is exposed to this issue?
Applications using vm2 3.11.3 or earlier to run untrusted JavaScript are exposed. The affected behavior is in the sandbox’s bridge-internal stack-trace handling, including the error-handling branch.
What must an attacker control to trigger it?
The attacker must be able to execute JavaScript inside the vm2 sandbox and install an accessor on Array.prototype for an index used while stack-trace lines are written. They must then cause sandbox code to read error.stack or otherwise trigger Error.prepareStackTrace.
Does this provide a sandbox escape?
No. The written values are formatted stack-trace strings, so the stated practical impact is an information side channel and a violation of the bridge-container defense invariant rather than a sandbox escape.
What is the remediation?
Upgrade to vm2 3.11.4. That version uses Reflect.defineProperty to create each stack-trace entry as an own data property, avoiding prototype-walking assignment.