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

List any file in the folder by using path traversal

The simplehttpserver module joins the URL path to the web root without resolving symlinks, so a symlink inside the served directory lets a remote user list files outside the web root. An attacker could read directory listings and potentially sensitive files on the host.

vulzzz Follow

Originally disclosed on HackerOne

Medium 6.8 View original
  • Disclosed after 3 months

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: v0.2.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

[319] downloads in the last week

Vulnerability

Vulnerability Description

simpehttpserver is simply get the path name of url and add it to the web root.If there is a symlink file in the directory. You can access files outside the web root directory.

Steps To Reproduce:

create symlink file $ ln -s ../../ symdir

install simplehttpserver $ npm install simplehttpserver -g

start program $ simplehttpserver ./

Nodejs_simpleHTTPServer.png
Nodejs_simpleHTTPServer.png From the original on HackerOne

Patch

Disable symlink file access in webserver.

Supporting Material/References:

Configuration I've used to find this vulnerability:

macos 10.13.6 nodejs v10.9.0 npm 6.4.1 chrome 68.0.3440.106

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

Likely the server concatenates the requested path onto the web root and serves it without checking whether the resolved path stays inside the web root, so symlinks are followed.

Impact

A malicious user could list files in folders outside the web root, which may reveal credentials or other sensitive data and could expose further attack vectors.

What the attacker needed

A symlink exists in the served directory; the server is running and reachable

The fix

The server should be fixed to disable access through symlink files.

How it was found

  1. Create a symlink inside the served directory that points to a parent directory.
  2. Install the simplehttpserver package globally.
  3. Start the server serving the current directory.
  4. Access the symlink to list files outside the web root.

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 follows a shortcut (a symlink) that points to a parent folder, so a visitor can browse files that were meant to stay private. A symlink is like a signpost that points to another place on the disk.

What is Path traversal?

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

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.