Skip to content
Path traversal Disclosed report Beginner

[min-http-server] List any file in the folder by using path traversal.

The min-http-server module joins the URL path directly to the web root without filtering '..' sequences, so a crafted raw request can list files outside the intended directory. An attacker could browse directories and potentially read sensitive files.

toannc123 Follow

Originally disclosed on HackerOne

High 8.2 View original
  • Triaged in 3 days
  • Fixed in 16 months
  • Disclosed after 16 months

I would like to report Path Traversal in min-http-server. It allows to list any file in another folder of web root.

Module

module name: min-http-server version: 1.0.6 npm page: https://www.npmjs.com/package/min-http-server

Module Description

'min-http-server' is a zero-configuration, lightweight http static resource server.

Vulnerability

Vulnerability Description

min-http-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 min-http-server $ npm install min-http-server -g

start program $ min-http-server

start burpsuite and enter the url contain ../. you should see the files in the folder.

Capture.PNG
Capture.PNG From the original on HackerOne

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 possibilites.

The original report as published on HackerOne, by toannc123. 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

The server concatenates the user-supplied URL path to the web root without sanitising or rejecting '..' path segments.

Impact

A malicious user could list files in folders outside the web root, which might expose credentials or other sensitive data and could lead to further attacks such as remote code execution.

What the attacker needed

Min-http-server running; ability to send raw HTTP requests

The fix

The path should be filtered to remove or reject '..' sequences before it is joined to the web root.

How it was found

  1. Install the min-http-server package globally.
  2. Start the min-http-server program.
  3. Use Burp Suite to craft a raw request whose URL contains '..' sequences.
  4. Send the request and observe the listing of files in the chosen 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 its public 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 request that contains '..', someone can make the server list files in other folders on the machine.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by toannc123

View all

5 more disclosed reports, best first.

More from Node.js third-party modules

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.