Skip to content
Path traversal Disclosed report Beginner

`superstatic` is vulnerable to path traversal on Windows

The superstatic static file server only checked for forward-slash parent directory sequences in the decoded request path, so on Windows a backslash-based traversal sequence slipped past the check. An attacker could read any file the server process could access outside the served directory.

chalker Follow

Originally disclosed on HackerOne

High 8.6 View original
  • Triaged in 28 hours
  • Fixed in 2 months
  • Disclosed after 2 months

I would like to report path traversal vulnerability in superstatic It allows to read arbitrary out-of-dir files when running on the Windows platform

Module

module name: superstatic version: 5.0.1 npm page: https://www.npmjs.com/package/superstatic

Module Description

Superstatic is an enhanced static web server that was built to power. It has fantastic support for HTML5 pushState applications, clean URLs, caching, and many other goodies.

Module Stats

2 196 downloads in the last day 33 588 downloads in the last week 139 118 downloads in the last month

~1 669 416 estimated downloads per year

Vulnerability

Vulnerability Description

superstatic verifies that current dir is not evaded by checking the presense of ../ in the decoded path, but on Windows, ..\ works. Code: https://github.com/firebase/superstatic/blob/v5.0.1/lib/providers/fs.js#L71

Steps To Reproduce:

Install and run superstatic (npx superstatic in any dir). It could be also used as a Node.js lib.

Go to http://localhost:3474/..%5c..%5c..%5c/Windows/notepad.exe (adjust the path accordingly, that's for C:\Users\User\tmp).

Note: don't use Edge for that, it decodes the path itself. Use e.g. Chromium.

Supporting Material/References:

  • OS: Windows 10
  • Node.js v8.9.4
  • npm v5.6.0
  • Chromium

Wrap up

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

Impact

Read any accessible files outside of the restricted directory.

The original report as published on HackerOne, by chalker. 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 path check only looked for forward-slash traversal sequences and did not account for Windows backslash separators.

Impact

An attacker could read any accessible files outside of the restricted directory, but only when the server runs on Windows.

What the attacker needed

Server runs on Windows; network access to the server

How it was found

  1. Install and run superstatic, for example with npx in any directory.
  2. Send a request to the local server whose path uses encoded backslash traversal sequences to reach a file outside the served directory.
  3. Use a browser such as Chromium rather than Edge, because Edge decodes the path itself.

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 static web server hands out files from one folder. It tries to stop people asking for files in parent folders by looking for a particular pattern in the request. On Windows, folders can also be separated with a backslash, and that form was not checked, so a crafted request could climb out of the folder and read other files 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 chalker

View all

36 more disclosed reports, 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.