CVE-2024-36137 Patch Bypass - FileHandle.chmod/chown
The fix for CVE-2024-36137 only added permission checks to the callback-based file descriptor methods, leaving the promise-based FileHandle equivalents unchecked. Code running under the Permission Model with restricted write access could still change permissions and ownership on an already-open file descriptor.
Originally disclosed on HackerOne
- Triaged in 3 days
- Fixed in 4 months
- Disclosed after 4 months
Summary by the program
An incomplete fix for CVE-2024-36137 leaves FileHandle.chmod() and FileHandle.chown() in the promises API without the required permission checks, while their callback-based equivalents (fs.fchmod(), fs.fchown()) were correctly patched.
As a result, code running under --permission with restricted --allow-fs-write can still use promise-based FileHandle methods to modify file permissions and ownership on already-open file descriptors, bypassing the intended write restrictions.
This vulnerability affects 20.x, 22.x, 24.x, and 25.x processes using the Permission Model where --allow-fs-write is intentionally restricted.
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 patch for CVE-2024-36137 added permission checks only to the callback-based fs.fchmod and fs.fchown paths and did not apply the same checks to the promise-based FileHandle.chmod and FileHandle.chown methods.
Impact
Code running under the Permission Model with a restricted --allow-fs-write could still change file permissions and ownership on an already-open file descriptor, bypassing the intended write restriction.
What the attacker needed
Node.js Permission Model enabled; restricted --allow-fs-write; an already-open file descriptor
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 a mode that lets you run code with only limited access to the file system. A previous security fix closed one way of changing a file's permissions and owner, but a second, newer way of doing the same thing was missed, so restricted code could still make those changes.
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.