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.
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:
echo "SECRET" > /tmp/secret.txtcurl file:///tmp/secret.txt-> Works (Expected).curl file://../../../../tmp/secret.txt-> Blocked ("Bad file://URL").curl file://localhost/../../../tmp/secret.txt-> Works (Bypass The Check in #3)

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
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
- Create a file outside the intended directory to act as the target.
- Request that file with a plain file:// URL and confirm it is read.
- Request it with a relative traversal path and no host, and observe the rejection.
- 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.