Skip to content
Path traversal Disclosed report Beginner CVE-2019-15600

Path traversal in https://www.npmjs.com/package/http_server via symlink

The http_server npm package serves files from its working directory without checking whether a requested path is a symbolic link. An attacker who can place a symlink in that directory could read arbitrary files outside the web root.

vineetpandey Follow

Originally disclosed on HackerOne

Medium 5.5 View original
  • Triaged in 46 hours
  • Fixed in 3 months
  • Disclosed after 3 months

I would like to report Path traversal in http_server It allows an attacker to read arbitrary system files.

Module

module name: http_server version: 1.0.12 npm page: https://www.npmjs.com/package/http_server

Module Description

Copy description from npm page

Module Stats

Weekly downloads: 35

Vulnerability

Vulnerability Description

With a symbolically linked file in the working directory, it is possible to read arbitrary files outside of the web root directory.

Steps To Reproduce:

  1. Install the http_server: npm install http_server -g

  2. Create a symlink file within the directory

ln -s /etc/shadow test_shadow

  1. Request the file within browser

http://localhost:8888/test_shadow

Patch

Reject the symbolically linked path files.

Supporting Material/References:

State all technical information about the stack where the vulnerability was found

  • Kali Linux
  • Node.js v12.8.0
  • NPM v6.11.3
  • Firefox 60.8.0esr

Wrap up

Select Y or N for the following statements:

  • I contacted the maintainer to let them know: N
  • I opened an issue in the related repository: N

Hunter's comments and funny memes goes here

Impact

It allows attacker to read content of arbitrary file on remote server and could leverage attacks like remote code execution.

Attachments

1.png
1.png From the original on HackerOne
2.png
2.png

The original report as published on HackerOne, by vineetpandey. 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 resolves and serves requested paths without rejecting symbolic links that point outside the web root.

Impact

An attacker could read arbitrary files on the server, which the reporter says could be leveraged toward remote code execution.

What the attacker needed

Ability to create a symlink in the server's working…; server running with http_server

How it was found

  1. Install the http_server package globally.
  2. Create a symbolic link in the working directory that points to a sensitive system file.
  3. Request the symlink's name from the running server in a browser.

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 symbolic link (symlink) is a shortcut file that points to another file elsewhere on the system. This web server hands out files from its folder but does not notice when a file is really a shortcut to something outside that folder, so a request for the shortcut returns the outside file's contents.

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 vineetpandey

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.