Skip to content
Path traversal Disclosed report Intermediate CVE-2023-32558

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.

rafaelgss Follow

Originally disclosed on HackerOne

High 7.1 View original
  • 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/

JavaScript
// index.js
const fs = process.binding('fs')

fs.mkdir('/home/pathtraversal/../test0', 511, false, null, null)
CONSOLE
$ 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.

The original report as published on HackerOne, by rafaelgss. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. Create a script that uses process.binding('fs') to call a file system method with a path containing '../'.
  2. Run the script with Node.js using the experimental permission flags that restrict read and write access to a specific directory.
  3. 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.

More by rafaelgss

View all

2 more disclosed reports, best first.

More from Node.js

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.