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.
Originally disclosed on HackerOne
- 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:
-
Install the http_server: npm install http_server -g
-
Create a symlink file within the directory
ln -s /etc/shadow test_shadow
- 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


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
- Install the http_server package globally.
- Create a symbolic link in the working directory that points to a sensitive system file.
- 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.