[serve-here.js] List any file in the folder by using path traversal.
The serve-here.js module joins the URL path directly to the web root without filtering, so a request containing ../ can list files outside the intended folder. An attacker could read directory contents and potentially sensitive files.
- Disclosed after 48 days
I would like to report Path Traversal in serve-here.js. It allows to list any file in another folder of web root.
Module
module name: serve-here.js
version: 1.1.3
npm page: https://www.npmjs.com/package/serve-here.js
Module Description
Serve static files over HTTP
Vulnerability
Vulnerability Description
serve-here.js 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 serve-here.js
$ npm install serve-here.js -g
start program `$ serve-here
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
Note: This is the module serve-here.js not the module serve-here
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
Impact
A malicious user could list files in arbitrary folders, which might expose sensitive information such as usernames and passwords and could lead to further attacks like remote code execution.
What the attacker needed
Serve-here.js is running; attacker can send HTTP requests
The fix
The path should be filtered to remove or block '..' sequences before using it to access the filesystem.
How it was found
- Install serve-here.js globally with npm.
- Start the serve-here program.
- Use Burp Suite to send a raw HTTP request with a URL containing ../.
- Observe that files in the chosen folder are listed.
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 that serves files from a folder should only allow access to files inside that folder. Here, the server takes the path from the URL and sticks it onto the folder path without checking for '..' which means 'go up one folder'. By sending a URL with '..' an attacker can make the server show 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.