{"id":"CVE-2026-24118","kind":"vulnerability","aliases":["CVE-2026-24118","GHSA-grj5-jjm8-h35p"],"related":[],"title":"VM2 Sandbox Breakout Through __lookupGetter__","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 `__lookupGetter__` method allows to read the getter of an object. It is special in VM2 since it will switch between the host and sandbox version of the method when passed to the other context.\nThis allows to access getters on an object in the host context if the method is called from the host context which can be achieved by using the host `apply` method which can be accessed through `Buffer.apply`.\nAfterwards, this function can be used to call the host version of `__lookupGetter__` with `Buffer` and `__proto__` resulting in the prototype lookup method from the host context.\nWith this method the hosts `Function.prototype` object can be retrieved and the host `Function` acquired through the `constructor` property which allows to create and run code in the host context.\nThis issue was attempted to be fixed with https://github.com/patriksimek/vm2/blob/4b009c2d4b1131c01810c1205e641d614c322a29/lib/bridge.js#L427. However, this can be circumvented by using `Object.getOwnPropertyDescriptor` to get the `constructor` property.\n\n### PoC\n\nThe following code demonstrates this issue by acquiring the host process object and executing `touch pwned`.\n\n```js\nconst {VM} = require(\"vm2\");\nconst vm = new VM();\nvm.run(`\nconst g = ({}).__lookupGetter__;\nconst a = Buffer.apply;\nconst p = a.apply(g, [Buffer, ['__proto__']]);\nObject.getOwnPropertyDescriptor(p.call(a),'constructor').value('return process')().mainModule.require('child_process').execSync('touch pwned');\n`);\n```\n\n### Impact\n\nAttackers can perform Remote Code Execution under the assumption that arbitrary code can be executed inside the context of a vm2 sandbox.","summary":"vm2 is a Node.js library that runs untrusted JavaScript in a sandbox. A flaw in how __lookupGetter__ crosses between sandbox and host lets sandboxed code reach the host Function constructor and run arbitrary shell commands on the server.","severity":"critical","cvss":9.8,"epss":0.00905,"exploited":false,"exploited_at":null,"products":[{"name":"vm2","fixed":["3.11.0"],"affected":"< 3.11.0","ecosystem":"npm"},{"name":"vm2 project vm2","fixed":["3.11.0"],"affected":"< 3.11.0","ecosystem":"vendor"}],"ecosystems":["npm","vendor"],"tags":["cwe-693","cwe-749","cwe-94","javascript","node.js","package","sandboxing","vm2"],"not_affected_if":["fixed-3.11.0-or-later","no-untrusted-code","vm2-not-installed"],"how_to_check":"- Run `npm ls vm2` in each project to see whether vm2 is installed and at what version.\n- Search lockfiles (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`) for `vm2`.\n- Check whether any code path passes user-supplied or third-party code to `new VM()` or `NodeVM` from vm2.","fix":"- vm2 `3.11.0` (fixed version; earlier versions are affected)","status":"open","published_at":"2026-05-04T16:29:15+00:00","first_seen_at":"2026-11-04T03:31:21+00:00","triaged_at":"2026-11-04T03:32:43+00:00","updated_at":"2026-11-04T03:46:40+00:00","category":"package","confidence":0.85,"triage":{"at":"2026-11-04T03:32:43Z","model":"claude-haiku-5-5","output":{"fix":"- vm2 `3.11.0` (fixed version; earlier versions are affected)","reach":"unknown","title":"vm2: sandbox escape through __lookupGetter__ lets untrusted code run host commands","impact":"high","summary":"vm2 is a Node.js library that runs untrusted JavaScript in a sandbox. A flaw in how __lookupGetter__ crosses between sandbox and host lets sandboxed code reach the host Function constructor and run arbitrary shell commands on the server.","audience":"developers","category":"package","nicknames":[],"who_cares":["node.js","vm2","javascript","sandboxing"],"confidence":0.85,"fix_status":"available","needs_auth":"unknown","worst_case":"Sandboxed code runs arbitrary commands on the host server.","analyst_note":"Confirm whether the sources state that the fix at 3.11.0 fully closes the bypass and whether any earlier workaround exists; check the GHSA-grj5-jjm8-h35p advisory page for auth and setup requirements.","how_to_check":"- Run `npm ls vm2` in each project to see whether vm2 is installed and at what version.\n- Search lockfiles (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`) for `vm2`.\n- Check whether any code path passes user-supplied or third-party code to `new VM()` or `NodeVM` from vm2.","plain_action":"","needs_analyst":true,"not_affected_if":["no-untrusted-code","vm2-not-installed","fixed-3.11.0-or-later"],"who_is_affected":"Only applications that use vm2 to run code they do not fully trust (user scripts, plugins, or code submitted through an API) are exposed, because the sandbox is the security boundary. Applications that only run vm2 on code they wrote themselves are at much lower risk. The sources do not say whether the flaw needs a particular vm2 API or configuration beyond running code inside the sandbox.","user_interaction":"no","needs_special_setup":"unknown","severity_if_unknown":"critical"},"cost_usd":0.00084,"input_tokens":4796,"output_tokens":720,"severity_before":"critical"},"analyst_status":null,"analyst_note":null,"search":"'-2026':7A,15A '-24118':8A,16A '-693':22B '-749':24B '-94':26B '/patriksimek/vm2/blob/4b009c2d4b1131c01810c1205e641d614c322a29/lib/bridge.js#l427.':239C 'a.apply':288C 'access':138C,169C 'achiev':159C 'acquir':213C,261C 'afterward':172C 'allow':79C,103C,136C,219C 'appli':164C 'arbitrari':64B,93C,316C 'assumpt':314C 'attack':80C,306C 'attempt':232C 'breakout':3A,76C 'buffer':186C,290C 'buffer.apply':171C,285C 'call':151C,179C 'child':300C 'circumv':244C 'code':56B,83C,224C,256C,310C,317C 'command':66B,94C 'const':271C,275C,280C,283C,286C 'constructor':61B,216C,251C,295C 'context':134C,146C,155C,198C,228C,323C 'creat':221C 'cross':49B 'cve':6A,14A 'cwe':21B,23B,25B 'demonstr':257C 'detail':99C 'escap':86C 'execsync':302C 'execut':92C,267C,311C,320C 'fix':235C 'flaw':45B 'follow':255C 'function':60B,174C,212C 'function.prototype':204C 'g':281C,289C 'get':249C 'getter':107C,139C 'ghsa':10A 'ghsa-grj5-jjm8-h35p':9A 'github.com':238C 'github.com/patriksimek/vm2/blob/4b009c2d4b1131c01810c1205e641d614c322a29/lib/bridge.js#l427.':237C 'grj5':11A 'h35p':13A 'host':53B,59B,97C,122C,145C,154C,163C,181C,197C,203C,211C,227C,263C 'howev':240C 'impact':305C 'insid':321C 'issu':230C,259C 'javascript':27B,40B 'jjm8':12A 'js':270C 'let':54B 'librari':36B 'lookup':193C 'lookupgett':5A,48B,101C,184C,282C 'mainmodule.require':299C 'method':102C,128C,149C,165C,194C,201C 'new':277C 'node.js':28B,35B 'object':110C,142C,205C,265C 'object.getownpropertydescriptor':247C,292C 'p':287C 'p.call':293C 'packag':29B 'pass':130C 'perform':308C 'poc':253C 'process':264C,298C,301C 'project':19A 'properti':217C,252C 'proto':188C,291C 'prototyp':192C 'pwned':269C,304C 'reach':57B 'read':105C 'remot':309C 'requir':273C 'result':189C 'retriev':208C 'return':297C 'run':38B,63B,223C 'sandbox':2A,30B,43B,51B,55B,75C,90C,124C,327C 'server':69B 'shell':65B 'sinc':116C 'special':113C 'suffer':72C 'summari':70C 'switch':119C 'system':98C 'touch':268C,303C 'untrust':39B 'use':161C,177C,246C 'valu':296C 'version':125C,182C 'vm':272C,276C,278C 'vm.run':279C 'vm2':1A,17A,18A,20A,31B,32B,71C,89C,115C,274C,326C 'vulner':77C 'write':82C","nicknames":[],"mitigations":[],"who_affected":"Only applications that use vm2 to run code they do not fully trust (user scripts, plugins, or code submitted through an API) are exposed, because the sandbox is the security boundary. Applications that only run vm2 on code they wrote themselves are at much lower risk. The sources do not say whether the flaw needs a particular vm2 API or configuration beyond running code inside the sandbox.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["projectvm2","vm2","vm2projectvm2"],"ptokens":["project","vm2"],"labels":["critical","cwe693","cwe749","cwe94","javascript","nodejs","npm","package","sandboxing","vendor","vm2"],"campaign_type":null,"first_public_at":"2026-05-01T20:39:11+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-grj5-jjm8-h35p","url":"https://github.com/advisories/GHSA-grj5-jjm8-h35p","severity":"critical","published_at":"2026-05-04T16:29:15+00:00","modified_at":"2026-11-04T03:28:54+00:00","first_seen_at":"2026-11-04T03:31:21+00:00","fetched_at":"2026-11-04T03:31:21+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-24118","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-24118","severity":null,"published_at":"2026-05-04T17:16:21+00:00","modified_at":"2026-10-26T19:10:00+00:00","first_seen_at":"2026-11-04T03:46:40+00:00","fetched_at":"2026-11-04T03:46:40+00:00","note":null}],"documents":[{"id":63595,"url":"https://api.github.com/repos/patriksimek/vm2/security-advisories/GHSA-grj5-jjm8-h35p","title":"Maintainer's advisory: api.github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: api.github.com"},{"id":63596,"url":"https://github.com/patriksimek/vm2/security/advisories/GHSA-grj5-jjm8-h35p","title":"Maintainer's advisory: github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":"2026-05-01T20:39:11+00:00","relation":"advisory","confidence":null,"note":"Maintainer's advisory: github.com"},{"id":63597,"url":"https://github.com/patriksimek/vm2/commit/2b5f3e3a060d9088f5e1cdd585d683d491f990a3","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":63598,"url":"https://github.com/patriksimek/vm2/commit/f9b700b1c7d9ef2df416666cb24e0b659140cc74","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":63594,"url":"https://github.com/patriksimek/vm2/releases/tag/v3.11.0","title":"Release: github.com","kind":"release","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release: github.com"}],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}