fs.mkdtemp() and fs.mkdtempSync() are missing getValidatedPath() checks.
The fs.mkdtemp() and fs.mkdtempSync() functions in Node.js lack proper path validation, allowing a path traversal attack to bypass the experimental permission model. An attacker could create an arbitrary directory outside the permitted scope.
- Triaged in under an hour
- Fixed in 45 days
- Disclosed after 47 days
Summary by the program
fs.mkdtemp() and fs.mkdtempSync() can be used to bypass the permission model check using a path traversal attack. This flaw arises from a missing check in the fs.mkdtemp() API and the impact is a malicious actor could create an arbitrary directory.
This vulnerability affects all users using the experimental permission model in Node.js 20.
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 fs.mkdtemp() and fs.mkdtempSync() functions did not call the getValidatedPath() check that other file system functions use to enforce the permission model.
Impact
A malicious actor could create an arbitrary directory, bypassing the permission model, but this only affects users of the experimental permission model in Node.js 20.
What the attacker needed
Node.js 20 with experimental permission model enabled
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 restricts which files and folders a program can access. Two functions that create temporary folders did not check the folder path properly, so someone could trick them into creating a folder anywhere on the system, even outside the allowed area.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.