CVE-2026-25520 Overview
CVE-2026-25520 is a critical sandbox escape vulnerability in SandboxJS, a JavaScript sandboxing library used for executing untrusted code in isolated environments. Prior to version 0.8.29, the library fails to properly wrap return values of functions, allowing attackers to access the host environment's Function constructor and execute arbitrary code outside of the sandbox boundaries.
Critical Impact
This vulnerability allows complete sandbox escape, enabling attackers to execute arbitrary code in the host environment with full privileges, effectively negating all sandboxing protections.
Affected Products
- SandboxJS versions prior to 0.8.29
- Applications utilizing SandboxJS for JavaScript code isolation
- Web applications and Node.js services implementing SandboxJS sandboxing
Discovery Timeline
- 2026-02-06 - CVE CVE-2026-25520 published to NVD
- 2026-02-06 - Last updated in NVD database
Technical Details for CVE-2026-25520
Vulnerability Analysis
This vulnerability stems from an improper neutralization of special elements (CWE-74) in how SandboxJS handles function return values. The library is designed to create a secure JavaScript execution environment by wrapping and proxying all interactions between sandboxed code and the host environment. However, the return values from certain built-in functions were not properly wrapped, creating a pathway to escape the sandbox.
Specifically, the Object.values() and Object.entries() methods return Arrays that contain references to host objects without proper wrapping. By leveraging Array.prototype.at(), an attacker can access these unwrapped elements and ultimately obtain a reference to the host's Function constructor. With access to the Function constructor, arbitrary code execution outside the sandbox becomes trivial.
Root Cause
The root cause lies in incomplete coverage of the sandbox wrapper logic. While SandboxJS properly intercepts and wraps many JavaScript operations, the return values from Object.values() and Object.entries() were returned directly to sandboxed code without being processed through the security wrapper. This oversight allowed untrusted code to obtain direct references to host environment objects, including the critical Function constructor which serves as an escape hatch from any JavaScript sandbox.
Attack Vector
The attack is network-accessible and requires no authentication or user interaction. An attacker who can submit JavaScript code for sandboxed execution can exploit this vulnerability to escape the sandbox and execute arbitrary code in the host environment. The attack chain involves:
- Using Object.values() or Object.entries() on an object containing function references
- Accessing the unwrapped Function object from the returned Array using Array.prototype.at()
- Obtaining the host's Function constructor from the unwrapped function
- Creating and executing arbitrary functions in the host context
The security patch introduces additional scope management and reserved word handling to prevent access to the host Function constructor:
IOptionParams,
IOptions,
IScope,
+ LocalScope,
replacementCallback,
SandboxGlobal,
SubscriptionSubject,
Source: GitHub Commit Changes
import unraw from './unraw.js';
-import { CodeString, isLisp, LispType } from './utils.js';
+import { CodeString, isLisp, LispType, reservedWords } from './utils.js';
export type DefineLisp<
op extends LispType,
Source: GitHub Commit Changes
Detection Methods for CVE-2026-25520
Indicators of Compromise
- Unexpected code execution or process spawning from applications using SandboxJS
- Log entries showing access to Object.values(), Object.entries(), or Array.prototype.at() in sandboxed contexts followed by suspicious activity
- Network connections or file system access originating from sandboxed code execution environments
- Attempts to access or invoke the Function constructor from within sandboxed code
Detection Strategies
- Monitor for JavaScript code patterns attempting to chain Object.values()/Object.entries() with Array.prototype.at() in sandboxed execution contexts
- Implement runtime analysis to detect attempts to access the Function constructor from within sandbox boundaries
- Deploy application-level logging to track all sandboxed code execution and flag suspicious object access patterns
- Use static analysis on submitted code to identify potential sandbox escape attempts before execution
Monitoring Recommendations
- Enable verbose logging for all SandboxJS execution contexts to capture attempted exploitation
- Implement alerting for any sandbox execution that results in host-level resource access
- Deploy endpoint detection to identify post-exploitation behaviors such as unauthorized network access or file operations
- Review application logs for repeated sandbox execution failures which may indicate exploitation attempts
How to Mitigate CVE-2026-25520
Immediate Actions Required
- Upgrade SandboxJS to version 0.8.29 or later immediately across all affected systems
- Audit all applications using SandboxJS to identify deployment locations requiring updates
- Consider temporarily disabling sandboxed code execution capabilities until patching is complete
- Review recent sandbox execution logs for signs of exploitation attempts
Patch Information
The vulnerability has been fixed in SandboxJS version 0.8.29. The patch introduces a LocalScope type and enhanced reserved word handling to properly wrap all return values and prevent access to the host Function constructor. The fix is available in commit 67cb186c41c78c51464f70405504e8ef0a6e43c3.
For detailed patch information, see the GitHub Security Advisory GHSA-58jh-xv4v-pcx4 and the GitHub Commit Changes.
Workarounds
- Implement additional input validation to block code containing Object.values, Object.entries, or Array.prototype.at patterns until patching is possible
- Deploy network segmentation to limit the impact of potential sandbox escape by restricting host environment capabilities
- Consider using alternative sandboxing solutions with stronger isolation guarantees (e.g., WebAssembly, isolated VM processes) for highly sensitive use cases
- Apply strict Content Security Policy headers to limit capabilities available to potentially escaped code in web contexts
# Update SandboxJS to patched version
npm update sandboxjs@0.8.29
# Verify installed version
npm list sandboxjs
# Audit for vulnerable versions across project
npm audit
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


