CVE-2026-24118: VM2 Sandbox Breakout Through __lookupGetter__

Published May 4, 2026
·
Updated

Summary

VM2 suffers from a sandbox breakout vulnerability. This allows attackers to write code which can escape from the VM2 sandbox and execute arbitrary commands on the host system.

Details

The lookupGetter method allows to read the getter of an object. It is special in VM2 since it will switch between the host and sandbox version of the method when passed to the other context. This allows to access getters on an object in the host context if the method is called from the host context which can be achieved by using the host apply method which can be accessed through Buffer.apply. Afterwards, this function can be used to call the host version of lookupGetter with Buffer and proto resulting in the prototype lookup method from the host context. With this method the hosts Function.prototype object can be retrieved and the host Function acquired through the constructor property which allows to create and run code in the host context. This issue was attempted to be fixed with https://github.com/patriksimek/vm2/blob/4b009c2d4b1131c01810c1205e641d614c322a29/lib/bridge.js#L427. However, this can be circumvented by using Object.getOwnPropertyDescriptor to get the constructor property.

PoC

The following code demonstrates this issue by acquiring the host process object and executing touch pwned.

js const {VM} = require("vm2"); const vm = new VM(); vm.run( const g = ({}).lookupGetter; const a = Buffer.apply; const p = a.apply(g, [Buffer, ['proto']]); Object.getOwnPropertyDescriptor(p.call(a),'constructor').value('return process')().mainModule.require('childprocess').execSync('touch pwned'); );

Impact

Attackers can perform Remote Code Execution under the assumption that arbitrary code can be executed inside the context of a vm2 sandbox.

Other sources

vm2 is an open source vm/sandbox for Node.js. Prior to version 3.11.0, VM2 suffers from a sandbox breakout vulnerability. This allows attackers to write code which can escape from the VM2 sandbox and execute arbitrary commands on the host system. This issue has been patched in version 3.11.0.

MITRE

Affected Software

2 affected componentsFixes available
npm/vm2<=3.10.4
3.11.0
Vm2 Project Vm2 Node.js<3.11.0

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.0
  2. Upgrade

    Upgrade vm2 to a version that resolves this vulnerability.

    Fixed in 3.11.0
  3. Compensating control

    Assume VM2 sandbox escape is possible until upgraded; restrict network access/permissions for any service using vm2 so RCE attempts have minimal impact if the sandbox is bypassed.

Event History

May 4, 2026
CVE Published
via MITRE·04:28 PM
Data Sourced
via MITRE·04:28 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·04:29 PM
Data Sourced
via GitHub·04:29 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via NVD·05:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via Red Hat·07:02 PM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-24118?

CVE-2026-24118 is classified as a high-severity sandbox breakout vulnerability.

2

How do I fix CVE-2026-24118?

To fix CVE-2026-24118, upgrade the VM2 package to version 3.11.0 or later.

3

Which versions of VM2 are affected by CVE-2026-24118?

All versions of VM2 up to and including 3.10.4 are affected by CVE-2026-24118.

4

What type of vulnerability is CVE-2026-24118?

CVE-2026-24118 is a sandbox breakout vulnerability that allows execution of arbitrary commands on the host system.

5

Who is impacted by CVE-2026-24118?

Any application using the affected versions of VM2 for sandboxing is potentially impacted by CVE-2026-24118.

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