CVE-2026-25881: @nyariv/sandboxjs Prototype Pollution Vulnerability via Array Intermediary
Summary
CVE-2026-25881: @nyariv/sandboxjs has host prototype pollution from sandbox via array intermediary (sandbox escape). Affects @nyariv/sandboxjs versions < 0.8.31. Fixed in 0.8.31. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The @nyariv/sandboxjs package is a JavaScript library designed to execute untrusted code in a controlled environment, or sandbox. It aims to provide a secure way to run potentially harmful scripts without compromising the host application. However, it has been found to have a critical vulnerability that allows sandboxed code to mutate host built-in prototypes, leading to severe security risks.
Vulnerability Detail
A sandbox escape vulnerability exists in @nyariv/sandboxjs, allowing untrusted code to modify host built-in prototypes (like Map.prototype and Set.prototype) through array intermediaries. The root cause lies in the improper handling of the 'isGlobal' protection flag, which is stripped when values are passed through array or object literals. This leads to persistent prototype pollution, which can be exploited for remote code execution (RCE) in applications that utilize polluted properties in sensitive operations.
How To Fix
Latest published version: 0.9.7 as of 23 Oct 2026
npm install @nyariv/sandboxjs@0.9.7
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
0.8.31
This is the first release that contains the fix.
npm install @nyariv/sandboxjs@0.8.31
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, you can freeze built-in prototypes in the host process before executing untrusted code. This may prevent the exploitation of the vulnerability but could break functionality for some applications. Example code to freeze prototypes:
Object.freeze(Map.prototype);
Object.freeze(Set.prototype);
Conclusion
The @nyariv/sandboxjs package has a critical vulnerability that allows for prototype pollution through improper handling of the 'isGlobal' flag. It is essential to update to the patched version to mitigate risks associated with this vulnerability. Additionally, using tools like Vulert can help monitor and alert for such vulnerabilities in real-time.
See every vulnerability recorded for @nyariv/sandboxjs →
FAQ
Prototype pollution is a security vulnerability that allows an attacker to modify the prototype of a host object, potentially leading to unexpected behavior or security breaches.
An attacker can exploit this vulnerability by executing untrusted code that modifies built-in prototypes, which can then be used in sensitive operations, leading to remote code execution.
The impacts include breaking isolation between the sandboxed code and the host application, leading to persistent prototype pollution and possible remote code execution.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. You can check your application for this vulnerability using the Vulert playground at Vulert Scanner without any signup.
The CVSS score of this vulnerability is 9.0, indicating a critical level of severity.
References
Related vulnerabilities
Recent vulnerabilities recorded for @nyariv/sandboxjs.