Skip to content
Path traversal Disclosed report Beginner

Local File Inclusion in download.php

The download.php script accepts a file path parameter and does not properly restrict it, allowing directory traversal to read files outside the intended directory. An attacker who knows a valid externally-facing file path can download arbitrary files such as /etc/passwd, potentially disclosing sensitive information or enabling code execution.

tokyoenigma Follow

Originally disclosed on HackerOne

  • Triaged in 31 hours
  • Fixed in 12 days
  • Disclosed after 2.0 years

Able to download arbitrary files using directory traversal via filePathDownload parameter provided the attacker knows a valid file path of an externally-facing document.

To reproduce:

  1. Go to https://███████.mil/download.php?filePathDownload=data_products/MISC/frida_cal/../../../../../../../../etc/passwd

This appears to only work if a valid file directory that is externally-facing is utilized before the directory traversal (in this case, data_products/MISC/frida_cal/)

Impact

The ability to download arbitrary files could lead to: -Sensitive information disclosure -In certain cases, code execution on the server

System Host(s)

████.mil

Affected Product(s) and Version(s)

CVE Numbers

Steps to Reproduce

  1. Go to https://███.mil/download.php?filePathDownload=data_products/MISC/frida_cal/../../../../../../../../etc/passwd

This appears to only work if a valid file directory that is externally-facing is utilized before the directory traversal (in this case, data_products/MISC/frida_cal/)

Suggested Mitigation/Remediation Actions

Implement the parameter in such a way that externally-facing files are identified and referred to by IDs instead of by file path. In this way, directory traversal is not possible. Ex. download.php?docID=d14fb1aa-dd71-4c76-8e41-ba047efb7dfe

Additionally, avoid trusting user input by validating that only expect values are submitted and accepted.

The original report as published on HackerOne, by tokyoenigma. 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 download.php script passes user-supplied filePathDownload input directly to a file-reading function without validating or restricting the path to an allowed directory.

Impact

An attacker could download arbitrary files, leading to sensitive information disclosure and in certain cases code execution on the server.

What the attacker needed

Knowledge of a valid externally-facing file path

The fix

The parameter should be changed so that externally-facing files are referenced by IDs instead of file paths, and user input should be validated to accept only expected values.

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 web server has a script that lets users download files by giving a path. The script trusts the path completely, so by adding '../' sequences a user can climb out of the intended folder and read other files on the server. This is called directory traversal, and it can expose private files like system password lists.

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 U.S. Dept Of Defense

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.