CVE-2025-34146
JavaScript vulnerability analysis and mitigation

Overview

CVE-2025-34146 is a prototype pollution vulnerability in the @nyariv/sandboxjs npm package (versions <= 0.8.23) that allows attackers to inject arbitrary properties into Object.prototype via crafted JavaScript code, potentially causing a denial-of-service (DoS) condition or escaping the sandboxed execution environment. The vulnerability was discovered by researcher Hagrid29 and reported via a GitHub issue on April 12, 2025, with public disclosure and NVD publication on July 31, 2025. The patched version 0.8.24 was released concurrently with disclosure. It carries a CVSS v4.0 base score of 7.0 (High) (Github Advisory, VulnCheck).

Technical details

The root cause is classified as CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes — Prototype Pollution). The flaw resides in the sandbox's executor logic (dist/node/executor.js), specifically in how it handles JavaScript function objects: when accessing "".sub.__proto__, the sandbox checks the prototype but incorrectly branches based on the type being function, causing hasOwnProperty of __proto__ to return false and bypassing the SandboxError check. A second bypass occurs because the payload {}.constructor.constructor("return true") is not matched by the regex used to detect and sandbox function declarations (dist/node/parser.js), allowing unsandboxed execution. A public PoC demonstrates the attack: "".sub.__proto__.__proto__.__defineGetter__('polluted', {}.constructor.constructor("return true")); executed within the sandbox successfully pollutes Object.prototype (Hagrid29 Gist, SandboxJS Issue #31).

Impact

Successful exploitation allows an attacker to inject arbitrary properties into Object.prototype, which affects all objects in the Node.js process sharing the same prototype chain. This can cause a denial-of-service condition by corrupting application logic that relies on prototype properties, and under certain conditions enables sandbox escape — potentially leading to remote code execution (RCE) in applications that use SandboxJS to safely execute untrusted JavaScript. Integrity of the vulnerable system is rated High, and availability is rated High, while confidentiality impact is assessed as None in the CVSS v4.0 scoring (Github Advisory, VulnCheck).

Exploitability

A public proof-of-concept is available via a GitHub Gist published by the discoverer (Hagrid29), demonstrating the prototype pollution payload (Hagrid29 Gist). There is no confirmed evidence of in-the-wild exploitation or threat actor attribution at this time (Github Advisory). The EPSS score is approximately 0.054% per Feedly data (1.459% per the GitHub Advisory, placing it at the 81st percentile), and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The vulnerability requires no privileges and no user interaction, lowering the bar for exploitation in any application that exposes SandboxJS to attacker-controlled input.

Exploitation steps

  1. Identify target: Locate a Node.js application that uses @nyariv/sandboxjs version <= 0.8.23 to execute user-supplied or attacker-controlled JavaScript code (e.g., a code sandbox, template engine, or scripting interface).
  2. Craft malicious payload: Prepare a JavaScript snippet that exploits the prototype access bypass, such as:
    "".sub.__proto__.__proto__.__defineGetter__('polluted', {}.constructor.constructor("return true"));
  3. Submit payload to sandbox: Pass the crafted code as input to the application's sandboxed execution interface (e.g., via an API endpoint, form field, or scripting console that invokes sandbox.compile(code).run()).
  4. Trigger prototype pollution: The sandbox executor fails to block access through "".sub.__proto__ (a function type) and does not detect {}.constructor.constructor(...) as a sandboxed function, allowing the payload to execute and inject the polluted property into Object.prototype.
  5. Achieve objective: Depending on the application, the attacker can cause a DoS by corrupting shared prototype properties, or escalate to sandbox escape/RCE by leveraging the polluted prototype to influence application logic or gain access to unsandboxed execution contexts (Hagrid29 Gist, SandboxJS Issue #31).

Indicators of compromise

  • Logs: Node.js application logs showing unexpected errors related to prototype property access or __defineGetter__/__defineSetter__ calls; error traces originating from dist/node/executor.js in the sandboxjs module.
  • Application Behavior: Sudden application crashes or unexpected behavior in code paths that rely on standard object properties (e.g., toString, valueOf, or custom properties), which may indicate Object.prototype has been polluted.
  • Process: Unexpected code execution or spawning of child processes from a Node.js process running SandboxJS, particularly if the application is not expected to execute system commands.
  • Network: Unusual outbound connections from the Node.js server process following execution of user-supplied sandbox code, which may indicate sandbox escape and subsequent payload delivery.

Mitigation and workarounds

Users should upgrade @nyariv/sandboxjs to version 0.8.24 or later, which contains the fix for this prototype pollution vulnerability (Github Advisory). As a workaround prior to patching, strictly validate and sanitize all JavaScript code submitted to the sandbox, and avoid exposing the sandbox to untrusted user input. Additionally, consider running the SandboxJS process in an isolated environment (e.g., a separate process or container) to limit the blast radius of a potential sandbox escape.

Community reactions

The vulnerability was assigned by VulnCheck and published to the GitHub Advisory Database on July 31, 2025, with the advisory noting the potential for RCE (Github Advisory). The original issue was filed by researcher Hagrid29 on the SandboxJS GitHub repository in April 2025, with a detailed technical write-up published as a public Gist (SandboxJS Issue #31). No significant broader media coverage or notable community debate has been observed beyond the technical disclosure.

Additional resources


SourceThis report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-77415CRITICAL9.3
  • JavaScript logoJavaScript
  • jsonata
NoYesAug 21, 2026
CVE-2026-77414CRITICAL9.3
  • JavaScript logoJavaScript
  • jsonata
NoYesAug 21, 2026
CVE-2026-77413CRITICAL9.3
  • JavaScript logoJavaScript
  • jsonata
NoYesAug 21, 2026
CVE-2026-63421HIGH7.5
  • JavaScript logoJavaScript
  • @keystone-6/core
NoYesAug 21, 2026
CVE-2026-53509MEDIUM5.7
  • JavaScript logoJavaScript
  • @aborruso/ckan-mcp-server
NoYesAug 21, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management