process.binding() can bypass the permission model through path traversal
The deprecated process.binding('fs') API bypassed the permission model's path traversal validation, allowing a script to create a directory outside the allowed path. Other methods could eventually bypass it too.
- Triaged in under an hour
- Fixed in 35 days
- Disclosed after 2 months
Summary by the program
The use of the deprecated API process.binding() can bypass the permission model through path traversal.
This vulnerability affects all users using the experimental permission model in Node.js 20.x.
Please note that at the time this CVE was issued, the permission model is an experimental feature of Node.js.
The report
Summary: process.binding('fs') bypassed the permission model validation against path traversal
Description: process.binding('fs') can be used to bypass the path traversal validation for the permisison model
Steps To Reproduce:
Create the following index.js and store at /home/pathtraversal/
// index.js
const fs = process.binding('fs')
fs.mkdir('/home/pathtraversal/../test0', 511, false, null, null)
$ pwd
/home/pathtraversal/
$ node --experimental-permission --allow-fs-read="/home/pathtraversal/*" --allow-fs-write="/home/pathtraversal/*" index.js
/home/test0 will be created bypassing the permission model validation
Impact
All the methods exposed by the process.binding('fs') could eventually bypass the permission model using path traversal. It will require the attacker to read the node_file.cc implementation, but that's trivial.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the permission model's path validation is only applied to the public fs module, not to the internal process.binding('fs') API, so path traversal checks are missing there.
Impact
All methods exposed by process.binding('fs') could eventually bypass the permission model using path traversal, allowing an attacker to read or write files outside the allowed paths.
What the attacker needed
Node.js with experimental permission model enabled; Ability to run a script with process.binding access
How it was found
- Create a script that uses process.binding('fs') to call a file system method with a path containing '../'.
- Run the script with Node.js using the experimental permission flags that restrict read and write access to a specific directory.
- Observe that the file system operation succeeds outside the allowed directory, bypassing the permission model.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Node.js has an experimental permission model that restricts which files a script can read or write. This report shows that an old, deprecated way of accessing the file system (process.binding) skips the check that stops paths like '../' from escaping the allowed folder. So a script could create or access files outside the folder it was supposed to be limited to.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.