Executive brief
@nyariv/sandboxjs is a JavaScript sandboxing library that attempts to isolate untrusted code execution. This vulnerability allows an attacker to break out of the sandbox and execute arbitrary code on the host system by manipulating the Map prototype, bypassing the sandbox's security restrictions entirely. An attacker with the ability to run code through this library can gain complete control over the system.
Technical details
The vulnerability is a sandbox escape caused by improper handling of prototypes in the sandbox implementation. Map is listed in SAFE_PROTOTYPES, but its prototype can be accessed and modified via Map.prototype. An attacker can overwrite Map.prototype.has with arbitrary code (e.g., isFinite), then use the Function constructor to execute arbitrary system commands. No authentication or user interaction is required; the vulnerability is triggered when the attacker-controlled payload is compiled and executed through the sandbox. The attack enables remote code execution on the underlying system. The vulnerability was patched in version 0.8.29; versions 0.8.28 and earlier are affected.
Affected products
- nyariv @nyariv/sandboxjs <=0.8.28
Timeline
- 2026-02-05: disclosed
- 2026-02-05: patched: Version 0.8.29 released with fix