Skip to content
Access control Disclosed report Intermediate CVE-2023-30583

fs.openAsBlob() bypasses permission system

Node's experimental permission system did not restrict the fs.openAsBlob() function, so a script running with --experimental-permission could still read a file it had not been granted access to. An attacker able to run code in such a process could read files outside the intended permission boundary.

cjihrig Follow

Originally disclosed on HackerOne

Medium 4.4 View original
  • Triaged in under an hour
  • Fixed in 52 days
  • Disclosed after 3 months

Summary: [add summary of the vulnerability] fs.openAsBlob() does not appear to be limited by the permission system.

Description: [add more details about this vulnerability] Starting Node with --experimental-permission does not appear to restrict fs.openAsBlob().

Steps To Reproduce:

Run the following code with --experimental-permission and do not grant is read access to file.txt:

JavaScript
'use strict';
const fs = require('node:fs');

async function main() {
	const blob = await fs.openAsBlob(__dirname + '/file.txt');

	console.log(await blob.text());
}

main();

Impact: [add why this issue matters]

The permission system is bypassed when it should not be.

Supporting Material/References:

None

Impact

An attacker can read files they should not be able to.

The original report as published on HackerOne, by cjihrig. 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 check was applied to some file-reading APIs but not to the newer fs.openAsBlob() function, leaving a gap in enforcement.

Impact

The permission system is bypassed, so an attacker could read files they should not be able to.

What the attacker needed

Ability to run code in a Node process; process started with --experimental-permission

How it was found

  1. Start Node with the experimental permission flag and do not grant read access to the target file.
  2. Call fs.openAsBlob() on that file from a script.
  3. Read the returned blob's text and observe the file contents despite the missing permission.

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 optional mode that lets you say which files a program is allowed to read. The idea is that even if someone slips bad code into the program, it cannot open files you did not allow. Here, one particular way of opening a file was simply not checked by that mode, so the restriction could be sidestepped.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by cjihrig

View all

1 more disclosed report, 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.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.