Skip to content
Path traversal Disclosed report Intermediate

inconsistently Rejection Logic in file:// URLs with Authority

curl rejects a file:// URL containing a relative path traversal when no host is given, but accepts the same traversal when a host such as localhost is present. An attacker could use the host form to get past application logic that relies on curl's 'Bad file:// URL' error to block traversal.

unknowperson0212 Follow

Originally disclosed on HackerOne

  • Disclosed after under an hour

curl's file:// protocol handler inconsistently applies path sanitization. in reject file://../ as Bad File:// URL" but allows the same traversal when an authority/host (e.g.,localhost) is present (file://localhost/../). this inconsistency misleads developers who rely on the bad file:// URL error for sandbox enforcement.

##Root Cause: The Bad File:// URL check only triggers for "relative" URLs (no Host). Adding a valid/invalid host bypasses this safety check, allowing path traversal to proceed.

##Step to Reproduce:

  1. echo "SECRET" > /tmp/secret.txt
  2. curl file:///tmp/secret.txt -> Works (Expected).
  3. curl file://../../../../tmp/secret.txt -> Blocked ("Bad file://URL").
  4. curl file://localhost/../../../tmp/secret.txt -> Works (Bypass The Check in #3)
image.png
image.png From the original on HackerOne

While file:// is not designed as a security sandbox, the existence of the specific Bad file:// URL rejection creates a False security guarantee. Developers implicitly trust this error to block traversal. Bypassing this specific control breaks that trust, leading to insecure sandboxing logic in dependent application.

Impact

Bypass off application-level sandboxing that depends on URL parsing validation

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

The 'Bad File:// URL' check only runs for URLs without a host, so supplying a host skips the traversal check.

Impact

Applications that depend on curl's file:// rejection to enforce a sandbox could have that sandbox bypassed, though the report notes file:// is not itself designed as a security sandbox.

What the attacker needed

Application relies on curl's file:// error; attacker can supply a file:// URL

How it was found

  1. Create a file outside the intended directory to act as the target.
  2. Request that file with a plain file:// URL and confirm it is read.
  3. Request it with a relative traversal path and no host, and observe the rejection.
  4. Repeat the traversal request with a host such as localhost and observe that it is accepted.

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.

A file:// URL tells a program to read a file on the local machine. curl refuses some of these URLs when the path tries to climb out of its starting folder, but it only refuses them when no host name is written in the URL. Adding a host name like localhost makes curl accept the same climbing path, so any program that trusted the refusal can be tricked into reading files it meant to block.

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 unknowperson0212

View all

2 more disclosed reports, best first.

More from curl

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.