Press enter or click to view image in full size
During testing, I encountered a PDF export feature that allowed users to preview and download generated reports. The application provided multiple predefined templates each producing a dynamically generated PDF.
All screenshots shown are locally reproduced in a controlled environment to maintain real target confidentiality.
At first, everything appeared normal. The preview functionality worked as expected and each download returned a randomly named PDF file.
However, while inspecting the network requests behind the download action, I noticed something unusual.
The application was passing a filesystem path directly as a GET parameter.
Press enter or click to view image in full size
Instead of referencing a logical identifier (such as a report ID), the p parameter contained an absolute path on the server.
That was the first red flag.
The disclosed path revealed several critical details:
This suggested that the application was blindly trusting user input to locate and serve files.
At this point, I suspected a Local File Inclusion (LFI) vulnerability.
To validate the issue, I replaced the PDF path with a known system file.
Press enter or click to view image in full size
The server responded with the contents of /etc/passwd, confirming that arbitrary files could be read from the filesystem.
The response included the application user account proving that the process had sufficient permissions to read sensitive system files.
This confirmed unrestricted local file inclusion.
Once arbitrary file reads were confirmed, I tested whether application-level secrets were also accessible.
I attempted to retrieve the environment configuration file:
Press enter or click to view image in full size
The request successfully returned the .env file.
This file contained sensitive information such as:
At this stage, the vulnerability escalated from file disclosure to full application compromise.
Join Medium for free to get updates from this writer.
Access to environment variables alone is often enough to pivot into database access, authentication bypass, or further internal exploitation.
One of the most serious issues here was how the application was hosted.
The web application was running from a privileged system user’s home directory, rather than a restricted webroot.
This is a dangerous configuration.
/var/www/html)www-data or an equivalent service accountRunning a web application under a privileged system user turns simple bugs into critical vulnerabilities.
In this case, the LFI would have been far less damaging if proper privilege separation had been enforced.
This issue occurred due to a combination of mistakes:
Individually, each mistake is bad.
Together, they resulted in a high-impact LFI.
Have you ever found a critical bug in a feature as simple as a PDF export?
If you’re interested in real-world vulnerability discoveries, follow me here on Medium.
I write about:
Every write-up is based on hands-on analysis, not theory.