VM2 · GHSA-2cm2-m3w5-gp2f · Package
FIX → 3.11.2
The vm2 npm package is a JavaScript sandbox, and an incomplete earlier fix still lets code inside the sandbox reach its internal state object by name. Code run through vm2 can read internal state that should stay hidden from it, which can lead to escaping the sandbox.
first public May 8, 2026 · 1 source
Check it with your coding agent
It checks your repository and tells you if you’re affected, with the fix.
Any application that runs untrusted or user-supplied JavaScript through vm2 is exposed, because the sandbox boundary is the protection. Projects that only use vm2 for trusted code, or that no longer depend on it, can skip it. The sources do not describe further conditions.
Not affected if trusted-code-only, vm2-not-installed
Who cares cwe-693, node.js, npm, vm2
npm ls vm2 in the project to find every installed copy of vm2 and its version.package-lock.json, yarn.lock, pnpm-lock.yaml) for vm2 entries below 3.11.2.Upgrade to 3.11.2
https://github.com/patriksimek/vm2/security/advisories/GHSA-wp5r-2gw5-m7q7 is not fully patched.
It is still possible to get access to VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.
const {VM} = require("vm2");
const vm = new VM();
console.log(vm.run(`
globalThis['VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL']
`));
Are you affected?
Tell InfraStack what you run. It checks this one, and every next one, against your stack.
Ask from here. InfraStack checks the affected versions against your stack and answers in your inbox.
InfraStack checks the affected versions against your stack and answers in Slack, with the evidence and the fix.
vm2 3.11.2 (fixed version per the advisory's product range).GitHub Advisory Database, CC-BY 4.0. Posts quoted belong to their authors.