fs.fchown/fchmod bypasses permission model
The Node.js experimental permission model does not check file descriptor operations, so functions like fs.fchown and fs.fchmod can change a file's owner and permissions using a read-only file descriptor. An attacker could bypass the intended write restrictions of the --allow-fs-write flag.
- Triaged in 3 days
- Fixed in 3 months
- Disclosed after 3 months
Summary by the program
A vulnerability has been identified in Node.js, affecting users of the experimental permission model when the --allow-fs-write flag is used.
Node.js Permission Model do not operate on file descriptors, however, operations such as fs.fchown or fs.fchmod can use a "read-only" file descriptor to change the owner and permissions of a file.
This vulnerability affects all users using the experimental permission model in Node.js 20 and Node.js 21.
Please note that at the time this CVE was issued, the permission model is an experimental feature of Node.js.
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 only checks path-based file operations and does not enforce restrictions on file descriptor-based operations such as fchown and fchmod.
Impact
An attacker could bypass the --allow-fs-write restriction to change file ownership or permissions, but only when the experimental permission model is enabled.
What the attacker needed
Experimental permission model enabled; --allow-fs-write flag used; Node.js 20 or 21
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 feature that lets you restrict which files a program can write to. This report found that some file functions can still change a file's owner or permissions even when the program only has read access, so the restriction can be bypassed.
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.