CVE-2026-23830: @nyariv/sandboxjs SandboxJS Has Sandbox Escape Vulnerability

CRITICAL
Advisory Identifier: GHSA-wxhw-j4hc-fmq6
CVSS 10.0
CWE-693 CWE-913 CWE-94
Published
Advisory Summary

CVE-2026-23830 is a CRITICAL (CVSS 10.0) sandboxjs has sandbox escape vulnerability (CWE-693: Protection Mechanism Failure) affecting @nyariv/sandboxjs libraries in the npm ecosystem. The issue involves sandboxjs has sandbox escape via unprotected asyncfunction constructor. Remediation is available by upgrading affected packages to version 0.8.26.

CVE-2026-23830 at a Glance

CVE Identifier CVE-2026-23830
GHSA Identifier GHSA-wxhw-j4hc-fmq6
Severity CRITICAL
CVSS v3.1 Base Score 10.0
CWE Classification CWE-693: Protection Mechanism Failure
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-23830

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.26
npm install @nyariv/sandboxjs@0.8.26
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-23830, 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.26), 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-693: Protection Mechanism Failure, where the product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product. 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 vulnerability due to `AsyncFunction` not being isolated in `SandboxFunction` ### Details The library attempts to sandbox code execution by replacing the global `Function` constructor with a safe, sandboxed version (`SandboxFunction`). This is handled in `utils.ts` by mapping `Function` to `sandboxFunction` within a map used for lookups. However, the library did not include mappings for `AsyncFunction`, `GeneratorFunction`, and `AsyncGeneratorFunction`. These constructors are not global properties but can be accessed via the `.constructor` property of an instance (e.g., `(async () => {}).constructor`). In `executor.ts`, property access is handled. When code running inside the sandbox accesses `.constructor` on an async function (which the sandbox allows creating), the `executor` retrieves the property value. Since `AsyncFunction` was not in the safe-replacement map, the `executor` returns the actual native host `AsyncFunction` constructor. Constructors for functions in JavaScript (like `Function`, `AsyncFunction`) create functions that execute in the global scope. By obtaining the host `AsyncFunction` constructor, an attacker can create a new async function that executes entirely outside the sandbox context, bypassing all restrictions and gaining full access to the host environment (Remote Code Execution). ### PoC ```js const sandbox = require('@nyariv/sandboxjs'); const s = new sandbox.default(); const payload = ` const af = async () => {}; // .constructor returns the host AsyncFunction constructor because it's not intercepted const AsyncConstructor = af.constructor; console.log("AsyncConstructor name:", AsyncConstructor.name); // Create a function that executes outside the sandbox const func = AsyncConstructor("return process.mainModule.require('child_process').execSync('id').toString()"); // Execute RCE const p = func(); p.then(proc => { console.log(proc); }); `; try { s.compile(payload)().run(); } catch (e) { console.error("Bypass failed:", e.message); } ``` Run above script in nodejs. If you run it in browser, change the `AsyncConstructor` argument by returning `window` object. ### Impact A Remote Code Execution, attacker may be able to run an arbitrary code.

CVE-2026-23830 Affected @nyariv/sandboxjs Versions

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

References

Frequently Asked Questions

What is CVE-2026-23830?
CVE-2026-23830 is a security vulnerability in @nyariv/sandboxjs involving SandboxJS has Sandbox Escape via Unprotected AsyncFunction Constructor under CWE-693: Protection Mechanism Failure.
Which @nyariv/sandboxjs versions are affected?
Affected versions include releases prior to 0.8.26 across affected packages: @nyariv/sandboxjs.
What version fixes CVE-2026-23830?
Upgrading to 0.8.26 (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.26. Upgrade your dependency to 0.8.26 or later.
What is the CVSS score of CVE-2026-23830?
CVE-2026-23830 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-23830?
CVE-2026-23830 is classified under CWE-693: Protection Mechanism Failure (The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.).
How can I check npm dependencies for CVE-2026-23830?
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-wxhw-j4hc-fmq6",
  "modified" : "2026-01-29T03:43:42Z",
  "published" : "2026-01-27T19:55:11Z",
  "aliases" : [ "CVE-2026-23830" ],
  "summary" : "SandboxJS has Sandbox Escape via Unprotected AsyncFunction Constructor",
  "details" : "### Summary\nA sandbox escape vulnerability due to `AsyncFunction` not being isolated in `SandboxFunction`\n\n### Details\n\nThe library attempts to sandbox code execution by replacing the global `Function` constructor with a safe, sandboxed version (`SandboxFunction`). This is handled in `utils.ts` by mapping `Function` to `sandboxFunction` within a map used for lookups.\n\nHowever, the library did not include mappings for `AsyncFunction`, `GeneratorFunction`, and `AsyncGeneratorFunction`. These constructors are not global properties but can be accessed via the `.constructor` property of an instance (e.g., `(async () => {}).constructor`).\n\nIn `executor.ts`, property access is handled. When code running inside the sandbox accesses `.constructor` on an async function (which the sandbox allows creating), the `executor` retrieves the property value. Since `AsyncFunction` was not in the safe-replacement map, the `executor` returns the actual native host `AsyncFunction` constructor.\n\nConstructors for functions in JavaScript (like `Function`, `AsyncFunction`) create functions that execute in the global scope. By obtaining the host `AsyncFunction` constructor, an attacker can create a new async function that executes entirely outside the sandbox context, bypassing all restrictions and gaining full access to the host environment (Remote Code Execution).\n\n### PoC\n\n```js\nconst sandbox = require('@nyariv/sandboxjs');\nconst s = new sandbox.default();\n\nconst payload = `\n    const af = async () => {};\n    // .constructor returns the host AsyncFunction constructor because it's not intercepted\n    const AsyncConstructor = af.constructor;\n    console.log(\"AsyncConstructor name:\", AsyncConstructor.name);\n    \n    // Create a function that executes outside the sandbox\n    const func = AsyncConstructor(\"return process.mainModule.require('child_process').execSync('id').toString()\");\n    \n    // Execute RCE\n    const p = func();\n    p.then(proc => {\n        console.log(proc);\n    });\n`;\n\ntry {\n    s.compile(payload)().run();\n} catch (e) {\n    console.error(\"Bypass failed:\", e.message);\n}\n```\n\nRun above script in nodejs. If you run it in browser, change the `AsyncConstructor` argument by returning `window` object. \n\n### Impact\n\nA Remote Code Execution, attacker may be able to run an arbitrary code.",
  "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.26"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nyariv/SandboxJS/security/advisories/GHSA-wxhw-j4hc-fmq6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-23830"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nyariv/SandboxJS/commit/345aee6566e47979dee5c337b925b141e7f78ccd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nyariv/SandboxJS"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-693", "CWE-913", "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-01-27T19:55:11Z",
    "nvd_published_at" : "2026-01-28T00:15:50Z"
  }
}