Executive brief
vm2 is a library used to run untrusted code in a secure, isolated sandbox. A vulnerability in how it handles error messages allows sandboxed code to see the host server's full file directory structure and library versions. This information could be used by an attacker to map out the server's internal architecture and plan more targeted attacks.
Technical details
The vm2 CallSite wrapper class fails to sanitize the getFileName() method, allowing it to return absolute host paths from the V8 engine. An attacker running code within the sandbox can trigger this leak by accessing the 'stack' property of an Error object or by defining a custom Error.prepareStackTrace function. This allows the extraction of host directory structures, library paths, and internal function names. The vulnerability is rooted in lib/setup-sandbox.js where several V8 CallSite methods are passed through without sanitization. A fix is available in version 3.11.0.
Affected products
- patriksimek vm2 <= 3.10.5
Timeline
- 2026-05-01: disclosed: Initial disclosure by reporter koDove
- 2026-05-01: patched: Version 3.11.0 released
- 2026-05-07: advisory: GitHub Advisory published