# CVE-2023-30587 Process-based permissions can be bypassed with the "inspector" module.

Node.js --experimental-permission sandbox bypassed via node:inspector to flip isInternal on Worker, enabling child_process and arbitrary fs access.

- Payout: $3,495
- Severity: high
- Program: Internet Bug Bounty
- Found by: mattaustin
- Disclosed: 2023-09-30
- CVE: CVE-2023-30587
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/2078581
- Library page: https://bugbountylibrary.com/r/h1%3A2078581
- Tags: area:oss domain:oss impact:privesc impact:rce kind:bounty platform:hackerone sev:high tech:nodejs technique:chained technique:source-review vuln:access-control vuln:auth-bypass vuln:sandbox-escape

**Target:** Node.js 20 experimental permission model / node:worker_threads Worker + node:inspector
**Root cause:** The inspector module remains enabled under --experimental-permission, and the Worker constructor's internal kIsInternal symbol can be mutated via a debugger conditional breakpoint before new WorkerImpl, marking the worker internal and exempt from permission checks.
**Steps:**
1. Create bypass.js requiring node:inspector/promises, connect a Session, enable Debugger and Runtime.
2. Runtime.evaluate `Worker`, getProperties to find [[FunctionLocation]] scriptId, Debugger.getScriptSource to locate the `new WorkerImpl` line.
3. Set Debugger.setBreakpointByUrl on node:internal/worker at that line with condition `((isInternal = true),false)`.
4. Instantiate `new Worker(...)` with eval:true and execArgv including `--experimental-permission --allow-fs-read=* --allow-fs-write=* --allow-child-process`.
5. Run `node --experimental-permission --allow-fs-read=$(pwd) bypass.js`; worker executes `child_process.execSync('ls -l')` and reads /etc/passwd despite restrictions.
**How found:** Noticed the Worker class accepts a kIsInternal Symbol to create internal workers exempt from restrictions, that the Symbol is inaccessible directly, but that node:inspector is not disabled under the permission model — so attaching inspector inside the Worker constructor before WorkerImpl lets them mutate isInternal.
**Exploitation:** Attacker with code execution under the permission model attaches an inspector session, uses debugger APIs to inject `isInternal = true` into the Worker constructor's local scope via a conditional breakpoint, then spawns a worker that bypasses fs/child_process restrictions to read arbitrary files and run commands.
**Insight:** When a sandbox restricts APIs, enumerate which debugging/introspection surfaces (inspector, debugger protocol) remain reachable — they can mutate internal state of otherwise-protected constructors via breakpoints and scope injection.

