Skip to content
Path traversal Disclosed report Beginner CVE-2018-3787

[simplehttpserver] List any file in the folder by using path traversal.

The simplehttpserver module concatenates the URL path directly onto the web root without filtering, so a request containing ../ can list files outside the intended directory. An attacker could use this to browse arbitrary folders and potentially read sensitive files.

n0n4me Follow

Originally disclosed on HackerOne

  • Triaged in 22 days
  • Fixed in 3 months
  • Disclosed after 3 months

Summary by the program

Vulnerability was reported and the package maintainer fixed the issue.

The report

I would like to report Path Traversal in simplehttpserver. It allows to list any file in another folder of web root.

Module

module name: simplehttpserver version: 0.1.1 npm page: https://www.npmjs.com/package/simplehttpserver

Module Description

'simpehttpserver' is an simple imitation of python's SimpleHTTPServer and is intended for testing, development and debugging purposes

Module Stats

[444] downloads in the last week

Vulnerability

Vulnerability Description

simpehttpserver 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 simplehttpserver $ npm install simplehttpserver -g

start program $ simplehttpserver ./

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

1._POC_simplehttpserver.png
1._POC_simplehttpserver.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.11.2
  • npm 6.1.0
  • Burpsuite community

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 n0n4me. 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 builds the file path by directly appending the user-supplied URL path to the web root without sanitising or rejecting '..' sequences.

Impact

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

What the attacker needed

Simplehttpserver running; ability to send raw HTTP requests

The fix

The path should be filtered to reject '..' sequences; the report states the maintainer fixed the issue.

How it was found

  1. Install the simplehttpserver package globally using npm.
  2. Start the server pointing at a directory.
  3. Use a proxy tool to craft a raw request whose URL contains ../ sequences.
  4. Send the request and 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 is supposed to show only files inside a chosen 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 level'. By sending a crafted request, 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 n0n4me

View all

1 more disclosed report, 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.