Skip to content
Info disclosure Disclosed report Beginner

Vulnerability Report: Local File Disclosure via file:// Protocol in cURL

The report claims that cURL's file:// protocol handler allows reading local files without validation, and that running cURL with sudo can expose sensitive files such as /etc/shadow. The author suggests this could lead to data exposure and privilege escalation.

ahmedqc1 Follow

Originally disclosed on HackerOne

  • Disclosed after 1 hour

Summary A security vulnerability has been identified that allows unauthorized local file system access via the file:// protocol in cURL, particularly when executed with elevated privileges (e.g., sudo). This could lead to sensitive data exposure, including password hashes stored in /etc/shadow.

Steps to Reproduce Locating Protocol Handlers First, I searched for protocol registration in cURL's source: // Found in lib/url.c static const struct Curl_handler * const protocols[] = { &Curl_handler_dict, &Curl_handler_file, // ← This is what we're interested in &Curl_handler_ftp, ... }; Key Insight: The file handler is enabled by default in the protocols array.

Examining the File Protocol Handler I traced the file handler implementation:

// lib/file.c static CURLcode file_do(struct Curl_easy *data, bool *done) { char *path = data->state.up.path; // ← Raw path from URL FILE *file = fopen(path, "rb"); // ← Direct filesystem access ... } Vulnerability Found: No validation of:

Path traversal sequences (../) Symbolic links Filesystem permissions

  1. Basic Local File Read

curl "file:///etc/passwd" # Reads system user info 2. Privileged File Access (with sudo)

sudo curl "file:///etc/shadow" # Exposes password hashes

echo "test" > /tmp/test_file curl "file:///tmp/test_file" sudo curl "file:///etc/shadow" # Expected Output: root:*: kali:$ [...]

References cURL Security Documentation - Official security considerations for cURL CURLOPT_PROTOCOLS man page - Protocol restriction options

Impact

Confidentiality Breach: Read access to sensitive system files Privilege Escalation: Potential root access via hash cracking Business Impact: Critical for systems processing sensitive data Often missed in containerized environments

Attachments

Screenshot_2025-08-10_230246.png
Screenshot_2025-08-10_230246.png From the original on HackerOne
Screenshot_2025-08-10_230435.png
Screenshot_2025-08-10_230435.png

The original report as published on HackerOne, by ahmedqc1. 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 handler performs no validation of the path, but this is intended behaviour for a file transfer tool rather than a vulnerability.

Impact

The report claims confidentiality breach and potential privilege escalation via hash cracking, but this depends on running cURL with elevated privileges.

What the attacker needed

Ability to run cURL with sudo

How it was found

  1. Search the cURL source for the protocols array and note that the file handler is enabled by default.
  2. Examine the file handler implementation and see that it opens the path directly with fopen.
  3. Run cURL with a file:// URL to read a local file.
  4. Run cURL with sudo and a file:// URL to read a protected file such as /etc/shadow.

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.

cURL can read local files via file://. The report says running it with sudo can read protected files like /etc/shadow, which stores password hashes.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.