Skip to content
Path traversal Disclosed report Beginner

arbitrary file read via `file://` path traversal with `--path-as-is`

The curl tool with the --path-as-is option and a file:// URL does not normalise '..' path segments, allowing an attacker to read arbitrary local files that the process can access. This could disclose sensitive files such as /etc/passwd or private keys.

demsese Follow

Originally disclosed on HackerOne

  • Disclosed after 4 days

Summary:

Using --path-as-is with a file:// URL skips normalization of .. segments allowing reading of any local file the process can access

Affected version

* curl 8.15.0-DEV (commit 2a9dfe275, June 27, 2025) on Kali Linux 2024.3, x86_64

Steps To Reproduce:

  1. bulild curl with debug and ASan:
git clone https://github.com/curl/curl.git && cd curl  
autoreconf -fi  
CFLAGS="-fsanitize=address -g" ./configure --enable-debug --with-openssl  
make -j$(nproc)
  1. read /etc/passwd:
./src/curl --path-as-is file:///../../../../../../../../etc/passwd
  1. read /etc/hosts:
./src/curl --path-as-is file:///../../../../../../../../etc/hosts

Mitigation:

Normalize and sanitize .. segments in the file-URL handler even when --path-as-is is used, or disallow its use on local paths.

Impact

Summary:

Disclosure of any world-readable file e.g. /etc/passwd, /etc/hosts, private keys

The original report as published on HackerOne, by demsese. 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 file:// URL handler does not normalise or reject '..' path segments when the --path-as-is option is used, allowing directory traversal.

What the attacker needed

Curl built with file:// support; ability to run curl with --path-as-is; local file readable by the curl process

How it was found

  1. Build curl with debug and AddressSanitizer enabled.
  2. Run curl with --path-as-is and a file:// URL containing many '..' segments to read /etc/passwd.
  3. Run curl with --path-as-is and a file:// URL containing many '..' segments to read /etc/hosts.

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.

When you give curl a file:// address with the --path-as-is option, it does not clean up '..' parts of the path, which normally mean 'go up one folder'. Because of this you can use many '..' to read any file on the computer that your user account can read.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

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.