# Path traversal through path stored in Uint8Array in Node.js 20

Node.js permission model's path traversal check only handled strings and Buffers, so a Uint8Array path like `/tmp/../etc/passwd` bypassed `--allow-fs-read` and read arbitrary files.

- Payout: $3,495
- Severity: high
- Program: Internet Bug Bounty
- Found by: tniessen
- Disclosed: 2024-01-20
- CVE: CVE-2023-39332
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/2256167
- Library page: https://bugbountylibrary.com/r/h1%3A2256167
- Tags: area:oss domain:oss impact:data-leak kind:bounty platform:hackerone sev:high tech:nodejs technique:incomplete-fix technique:source-review vuln:access-control vuln:path-traversal

**Target:** Node.js `node:fs` path handling under `--experimental-permission`
**Root cause:** The permission-model path validation normalized/checked only string and Buffer inputs; non-Buffer Uint8Array paths (e.g. from TextEncoder) skipped the traversal check entirely.
**Steps:**
1. Run `node --experimental-permission --allow-fs-read=/tmp/ -p 'fs.readFileSync(new TextEncoder().encode("/tmp/../etc/passwd"))'`
2. Observe `/etc/passwd` contents returned despite only `/tmp/` being allowed
3. Note TextEncoder produces Uint8Array, not Buffer, evading the Buffer-specific fix
**How found:** Recognized prior fixes (CVE-2023-30584 for strings, CVE-2023-32004 for Buffers) patched only specific input types; hypothesized other path-accepting types like Uint8Array were unhandled and tested with TextEncoder output.
**Exploitation:** Any code running under the Node.js permission model that can pass a Uint8Array path to fs functions reads files outside the allowed directory, defeating the sandbox's fs-read restriction.
**Insight:** When a security fix whitelists specific input types (string, Buffer), enumerate all other types the API accepts (Uint8Array, ArrayBuffer, URL) and test each against the same check — incomplete type coverage is a recurring bypass.

