[http-file-server] List any files and sub folders in the folder by using path traversal.
The http-file-server module appends the URL path directly to the web root without sanitising '..' sequences, allowing an attacker to list files and subfolders outside the intended directory. This could expose sensitive files such as those containing usernames and passwords.
- Triaged in 3 days
- Fixed in 2 months
- Disclosed after 2 months
I would like to report Path Traversal in http-file-server. It allows to list any files and sub folders in another folder of web root.
Module
module name: http-file-server version: 0.2.6 npm page: https://www.npmjs.com/package/http-file-server
Vulnerability
Vulnerability Description
http-file-server is simply get the path name of url and add it to the web root. it means if you input ../, it will happy add it to web root and you can list the folder you choose. But the trick is web browser or curl are also to try rebuild the url containing ../. I used the burp to make a raw url and send it to server.
Steps To Reproduce:
install http-file-server
$ npm install -g http-file-server
start program: go to the folder of the module and run the file
$ ./http-file-server.js --path=/tmp/ --host=* --port=1234
start burpsuite and enter the url contain ../. you should see the files in the folder.

Patch
filter .. in the path name.
Supporting Material/References:
Configuration I've used to find this vulnerability:
- kali linux 4.15.0
- nodejs v8.9.3
- npm 6.4.1
- Burpsuite
Wrap up
- I contacted the maintainer to let them know: N
- I opened an issue in the related repository: N
Impact
This vulnerability allows malicious user to list file in the folder. This might expose vectors to attack system with Remote Code Execution, reveals files with usernames and passwords and many other possibilities.
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
The server concatenates the user-supplied URL path to the web root without filtering or normalising '..' path traversal sequences.
Impact
An attacker could list files and folders outside the web root, potentially exposing sensitive information such as usernames and passwords, and this might lead to further attacks like remote code execution.
What the attacker needed
Http-file-server installed and running; network access to the server
The fix
The path should be filtered to remove '..' sequences before use.
How it was found
- Install the http-file-server module globally using npm.
- Start the server with a chosen root path, host, and port.
- Use Burp Suite to craft a raw HTTP request containing '../' in the URL path.
- Send the request and observe the directory listing of the targeted folder.
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 is supposed to show only files inside a specific folder. This one takes the path from the web address and sticks it onto the folder name without checking for '..', which means 'go up one folder'. By sending a crafted request, someone can make the server list files from other folders on the computer.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.