Limited LFI
The Docs controller concatenates a user-supplied page parameter into a file path without sanitisation, then reads that file with file_get_contents. An attacker can use directory traversal to read files outside the intended documentation directory, though the hardcoded .md extension limits which files can be read.
Originally disclosed on HackerOne
- Triaged in 26 hours
- Fixed in 13 days
- Paid in 11 days
- Disclosed after 28 days
Summary:
Due to improper parameter sensitization local file inclusion is possible. LFI is limited as we were not able to truncate the end of string.
Description:
Application root is located at /var/www/dashboard/new/public
Due to URL Manipulation we are able to raed file from /var/www/dashboard/new/ Which should not be allowed.
Below we present function Index in Docs class -> parameter $page is set in URL in below example "..%2fREADME" Path is constructed as follow $docs_path = $docs_path . $page . '.md'; then file is read in file_get_contents and returned in application GUI. LFI is limited due to " . '.md';" part, but may be bypassed in futures, we have not found a way to bypass it thats why the risk was set to low. In case of bugs combination , PHP bugs etc.. in future this may be escalated. User should not control any part of "file_get_contents" function
public function index($page = 'main')
{
$data = array();
$docs_path = ($this->config->item('docs_path')) ? $this->config->item('docs_path') : 'https://raw.githubusercontent.com/GSA/project-open-data-dashboard/master/documentation/';
$docs_path = $docs_path . $page . '.md';
$docs = @file_get_contents($docs_path);
Steps To Reproduce:
- Read file from main root by calling URL:
https://labs.data.gov/dashboard/Docs/index/..%2fREADME
POC
File README.md not exists in our current dir. F863983
File README.md can be read due to LFI https://labs.data.gov/dashboard/Docs/index/..%2fREADME F863984
Confirmation: File exact as: https://github.com/GSA/project-open-data-dashboard/blob/master/README.md
Impact
User have ability to control part of @file_get_contents function. This type of usage may lead to critical file read. In this scenario, we did not bypass the hardcoded ext so files was limited to ".md" and low risk was set. This should be corrected in case of future PHP bugs, if attacker will truncate the .ext part any file read will be allowed.
Attachments


Context
The target is labs.data.gov, a GSA Bounty asset on HackerOne. The affected feature is the documentation viewer of the project-open-data-dashboard application: a Docs controller whose index action renders a Markdown documentation page inside the application GUI. The page to display is chosen by a URL segment, so the feature is meant to fetch a documentation file and show it to the visitor.
By default the documentation is pulled from a remote GitHub raw URL, but the path is built by concatenating a configured base path with the user-supplied page name and a hardcoded .md extension. That concatenation is where the problem sits.
Setup
No account, role or special tooling is described. The only precondition is network access to the public labs.data.gov host and the ability to request the Docs/index route with an arbitrary path segment. The application root is stated as:
/var/www/dashboard/new/public
and the directory the researcher was able to read from is its parent:
/var/www/dashboard/new/
Finding it
The researcher describes the issue as improper sanitisation of a parameter, which allows local file inclusion. The relevant code is the index function of the Docs class, where the $page parameter comes straight from the URL. In the example given it is ..%2fREADME. The path is assembled as $docs_path = $docs_path . $page . '.md';, then read with file_get_contents and returned in the application GUI.
The full function as quoted in the report:
public function index($page = 'main')
{
$data = array();
$docs_path = ($this->config->item('docs_path')) ? $this->config->item('docs_path') : 'https://raw.githubusercontent.com/GSA/project-open-data-dashboard/master/documentation/';
$docs_path = $docs_path . $page . '.md';
$docs = @file_get_contents($docs_path);
Two things stand out. First, $page is appended to the base path without any validation, so path traversal sequences in the URL segment reach the filesystem call. Second, the base path is not fixed: if docs_path is configured it is used, otherwise the code falls back to the GitHub raw documentation URL. Either way, the user controls the tail of the string handed to file_get_contents.
Exploitation
Step 1: Traverse out of the documentation directory
The researcher requested the Docs/index route with a URL-encoded traversal segment:
https://labs.data.gov/dashboard/Docs/index/..%2fREADME
..%2f decodes to ../, so the constructed path becomes the base path followed by ../README and the hardcoded .md. Instead of resolving inside the documentation directory, the path walks up one level, into /var/www/dashboard/new/, and reads README.md from there. The report notes that this file is outside the directory that should be reachable and that reading it should not be allowed.
Step 2: Confirm the file was not present in the current directory
The first screenshot shows that README.md does not exist in the directory the application would normally serve from.

Step 3: Confirm the file is read through the traversal
The second screenshot shows the same URL returning the contents of README.md, which is only possible because the traversal moved the lookup to the parent directory.

Step 4: Verify the content is genuine
The researcher confirmed that the returned file is exactly the same as the project's public README:
https://github.com/GSA/project-open-data-dashboard/blob/master/README.md
That comparison rules out a generic error page or unrelated output: the bytes served by the vulnerable route match the repository file.
Root cause
The mistake is that a user-controlled URL segment is concatenated directly into a path passed to file_get_contents, with no normalisation, no allow-list and no check that the resolved path stays inside the intended documentation directory. The @ before the call suppresses errors, so failures are silent rather than visible.
The hardcoded '.md' suffix is the only thing limiting the bug. Because the code appends it after the user input, the attacker cannot choose the extension, and the researcher explicitly says no way to truncate the end of the string was found. That is why the report describes the LFI as limited and sets the risk to low. The report also notes that the suffix might be bypassed in future, for example through a combination of bugs or PHP bugs, in which case the issue could be escalated.
Impact
An attacker can control part of the argument to @file_get_contents and read files outside the intended documentation directory, in this case from /var/www/dashboard/new/. The report frames this as a class of usage that may lead to critical file read. In the scenario actually demonstrated, the hardcoded .md extension restricted reads to Markdown files, so the practical impact was limited and the risk was rated low. The report warns that if an attacker could truncate the extension, any file read would be allowed, and that the code should be corrected with that in mind.
Fix
The report does not describe a fix that was applied. Its recommendation is that the user should not control any part of the file_get_contents call, and that the code should be corrected in case of future PHP bugs that would allow the .md suffix to be truncated. In practice that means validating or allow-listing the page name and confirming the resolved path stays within the documentation directory before reading it.
Variants to test
- Try other traversal depths and encodings on the same route, such as additional
../sequences or double-encoded separators, and look for content from directories further up the tree. - Try null-byte or truncation techniques against the appended
.mdsuffix on older PHP versions, and treat any response containing a non-Markdown file as a positive result. - Look for other actions in the same controller that take a path or file name from the URL, and check whether they apply the same concatenation pattern.
- Check whether the configured
docs_pathcan be influenced, since the code uses it when present and otherwise falls back to the remote GitHub URL. - Test whether the same parameter accepts absolute paths or URL schemes, which would turn the limited LFI into something broader.
Hunting notes
This kind of bug tends to hide in features that render content from disk or from a remote source: documentation viewers, help pages, changelog readers, template loaders and anything with a page, file, doc or template parameter. During recon, look for routes whose responses contain Markdown or other file-like content and whose URLs end in a name rather than an ID. A quick signal is a page whose content changes when you alter the last path segment.
The researcher demonstrated a concrete traversal out of the application root, captured the before and after states in screenshots, and matched the returned content against the public repository file.
What happened, in plain words
A website on the GSA Bounty programme hosts a dashboard that shows documentation pages. The dashboard is a web application: a program running on a server that sends web pages to your browser when you visit a URL. One of its features lets you pick which documentation page to view by putting the page's name at the end of the URL. The application then fetches that file from the server's disk and shows it to you.
The problem is that the application took the name you typed in the URL and glued it straight onto a folder path, without checking it. By putting a special sequence of characters in the URL, the researcher made the application walk up out of the documentation folder and read a file from a folder it should never have reached. This kind of bug is called local file inclusion (LFI): the application is tricked into including (reading and showing) a file that lives on the same machine, chosen by the attacker.
The bug is limited because the application always sticks .md on the end of whatever name you give it, so only Markdown files (.md) could be read. The researcher could not find a way around that suffix, so the risk was rated low, though the report warns it could become worse if that suffix could ever be removed.
The target and the feature
The target is labs.data.gov, reported under the GSA Bounty programme on HackerOne (a platform where organisations pay researchers to find bugs in their systems). The affected feature is the documentation viewer of an application called project-open-data-dashboard. In web applications, a controller is the part of the code that handles a particular kind of request, and an action is a specific thing a controller can do. Here the controller is called Docs and its action is index. When you visit the right URL, Docs/index runs, fetches a Markdown documentation file, and displays it inside the application's graphical interface (the pages you see in your browser).
By default the documentation is pulled from a remote GitHub address (a raw file URL on github.com), but the code builds the path by joining three things together: a base path, the page name you supplied in the URL, and a fixed .md extension. That joining is where the bug lives.
What you need to try it
No account, login or special tool is described. All you need is a normal internet connection, a browser (or any tool that can request a URL), and the ability to visit the Docs/index route with any path segment you like. The application's root folder on the server is stated as:
/var/www/dashboard/new/public
and the folder the researcher was able to read from is its parent, one level up:
/var/www/dashboard/new/
Think of a folder path like a street address: /var/www/dashboard/new/public is a house, and /var/www/dashboard/new/ is the street it sits on. The application was only supposed to look inside the house, but the researcher got it to look at the street.
Finding the bug
The researcher describes the issue as improper sanitisation of a parameter. Sanitisation means cleaning up input from the user before using it, for example by removing characters like .. that have special meaning. A parameter here is simply a piece of information the user supplies, in this case the page name taken from the URL.
The relevant code is the index function of the Docs class. A class is a bundle of related code, and a function is a named block of code that does one job. The $page variable (a variable is a named storage slot) comes straight from the URL. In the example it holds ..%2fREADME. The path is assembled with $docs_path = $docs_path . $page . '.md';, then read with file_get_contents (a PHP function that reads a file's contents) and returned to the page you see.
Here is the full function as quoted in the report:
public function index($page = 'main')
{
$data = array();
$docs_path = ($this->config->item('docs_path')) ? $this->config->item('docs_path') : 'https://raw.githubusercontent.com/GSA/project-open-data-dashboard/master/documentation/';
$docs_path = $docs_path . $page . '.md';
$docs = @file_get_contents($docs_path);
Line by line, in plain words:
public function index($page = 'main')declares the function. It takes one input,$page, and if nobody supplies one it defaults to the wordmain.$data = array();creates an empty list (an array) to hold data. It is not the source of the bug.- The long
$docs_path = ...line sets the base path. It checks whether a configuration setting calleddocs_pathexists; if it does, that value is used, otherwise it falls back to the GitHub raw documentation URL. Either way, this is the starting point of the path. $docs_path = $docs_path . $page . '.md';is the dangerous line. The dot in PHP means "join these strings together". So it takes the base path, glues on whatever the user put in the URL, and glues.mdon the end. No checking happens here.$docs = @file_get_contents($docs_path);reads the file at that path. The@symbol tells PHP to stay quiet if the read fails, so errors are hidden rather than shown.
Two things stand out. First, $page is appended with no validation, so path traversal sequences (special characters that mean "go up a folder") reach the file-reading call. Second, the base path is not fixed: it can be a configured folder or the GitHub URL, but in both cases the user controls the tail end of the string handed to file_get_contents.
Exploitation
Step 1: Walk up out of the documentation folder
The researcher requested the Docs/index route with a URL-encoded traversal segment:
https://labs.data.gov/dashboard/Docs/index/..%2fREADME
What this means, piece by piece:
https://labs.data.govis the website./dashboard/Docs/index/is the route that runs the vulnerable function...%2fREADMEis the page name.%2fis how a URL writes a forward slash/when it needs to be encoded (URL encoding is a way of writing special characters safely in a web address). So..%2fdecodes to../.- In file paths,
..means "the folder above this one". So../READMEmeans "go up one folder, then look for a file called README".
When the application joins this onto the base path, the constructed path becomes the base path followed by ../README and the fixed .md. Instead of staying inside the documentation folder, the path walks up one level into /var/www/dashboard/new/ and reads README.md from there. The report notes that this file is outside the folder that should be reachable, and reading it should not be allowed.
Step 2: Show the file is not in the normal folder
The first screenshot shows that README.md does not exist in the folder the application would normally serve from. This matters because it proves the file being shown later is not simply the normal documentation file.

Step 3: Show the file is read through the traversal
The second screenshot shows the same URL returning the contents of README.md. That is only possible because the ../ moved the lookup to the parent folder.

Step 4: Check the content is genuine
The researcher confirmed that the returned file is exactly the same as the project's public README:
https://github.com/GSA/project-open-data-dashboard/blob/master/README.md
Comparing the two rules out a generic error page or unrelated output: the bytes served by the vulnerable route match the repository file. "Bytes" just means the raw characters of the file; if they match exactly, it is the same file.
Why it works
The mistake is that a user-controlled URL segment is joined directly into a path passed to file_get_contents, with no normalisation (tidying the path so .. is resolved and checked), no allow-list (a list of permitted names), and no check that the final path stays inside the intended documentation folder. The @ before the call hides errors, so failures are silent rather than visible.
The fixed .md suffix is the only thing limiting the bug. Because the code adds it after the user input, the attacker cannot choose the extension, and the researcher explicitly says no way to cut off the end of the string was found. That is why the report calls the LFI limited and rates the risk low. The report also notes that the suffix might be bypassed in future, for example through a combination of bugs or PHP bugs, in which case the issue could become more serious.
Impact
An attacker can control part of the argument to @file_get_contents and read files outside the intended documentation folder, in this case from /var/www/dashboard/new/. The report frames this as a kind of usage that may lead to critical file read. In the scenario actually demonstrated, the fixed .md extension restricted reads to Markdown files, so the practical impact was limited and the risk was rated low. The report warns that if an attacker could cut off the extension, any file read would be allowed, and that the code should be corrected with that in mind.
Fix
The report does not describe a fix that was applied. Its recommendation is that the user should not control any part of the file_get_contents call, and that the code should be corrected in case of future PHP bugs that would allow the .md suffix to be cut off. In practice that means validating or allow-listing the page name and confirming the final path stays within the documentation folder before reading it.
Other things to try
- Try other traversal depths and encodings on the same route, such as extra
../sequences or double-encoded separators, and look for content from folders further up the tree. - Try null-byte or truncation tricks against the appended
.mdsuffix on older PHP versions, and treat any response containing a non-Markdown file as a positive result. (A null byte is a zero character that some older software treated as "end of string".) - Look for other actions in the same controller that take a path or file name from the URL, and check whether they join strings the same way.
- Check whether the configured
docs_pathcan be influenced, since the code uses it when present and otherwise falls back to the remote GitHub URL. - Test whether the same parameter accepts absolute paths (paths starting from the very top of the disk) or URL schemes, which would turn the limited LFI into something broader.
How to spot this kind of bug
This kind of bug tends to hide in features that show content from disk or from a remote source: documentation viewers, help pages, changelog readers, template loaders, and anything with a page, file, doc or template parameter. During recon (the early stage of looking around a target), look for routes whose responses contain Markdown or other file-like content and whose URLs end in a name rather than an ID. A quick signal is a page whose content changes when you alter the last part of the URL.
The researcher demonstrated a concrete traversal out of the application root, captured the before and after states in screenshots, and matched the returned content exactly against the public repository file.
Glossary
- API: a way for one program to ask another program to do something or give it data, like a waiter taking your order to the kitchen.
- Action: a specific thing a controller can do when a particular URL is visited.
- Allow-list: a list of things that are permitted; anything not on the list is refused.
- Array: a list of values stored together under one name in code.
- Base path: the starting folder or URL that other pieces are joined onto.
- Byte: one unit of data, roughly one character of text; matching bytes means matching content.
- Class: a bundle of related code and data in a programming language.
- Configuration setting: a value stored in the application's settings that the code reads at runtime.
- Controller: the part of a web application that handles a particular kind of request.
- CVSS: a scoring system that rates how severe a security bug is.
- Documentation viewer: a feature that shows help or reference pages to users.
- Extension: the part of a file name after the dot, such as
.md, which hints at the file type. - file_get_contents: a PHP function that reads a file's contents into the program.
- Function: a named block of code that does one job.
- GSA: the name of the bounty programme the report was filed under.
- HackerOne: a platform where organisations pay researchers to find and report bugs.
- Hardcoded: written directly into the code and not changeable by the user.
- LFI (local file inclusion): a bug where an attacker makes an application read a file from the server's own disk that it should not.
- Markdown (
.md): a simple text format for writing formatted documents. - Normalisation: tidying a path so that things like
..are resolved before use. - Null byte: a zero character that some older software treated as the end of a string.
- Parameter: a piece of information supplied by the user, often in a URL.
- Path traversal: using
..sequences to move up out of an intended folder. - PHP: the programming language the application is written in.
- Recon: the early stage of exploring a target to find things worth testing.
- Remote file inclusion: a related bug where an attacker makes an application load a file from another server.
- Route: the part of a URL that tells the application which code to run.
- Sanitisation: cleaning user input before using it, for example by removing dangerous characters.
- Suffix: characters added to the end of a string.
- URL encoding: writing special characters in a web address in a safe form, such as
%2ffor/. - Variable: a named storage slot in code that holds a value.