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

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.

haxatron1 Follow

Originally disclosed on HackerOne

  • 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.

The original report as published on HackerOne, by haxatron1. 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 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.

More by haxatron1

View all

30 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.