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

[harp] Path traversal using symlink

The harp development web server follows symbolic links placed inside the served project directory, so a link pointing outside the web root is served as a normal file. An attacker who can get such a link into the project could read files outside the intended directory, such as the system password file.

skyn3t Follow

Originally disclosed on HackerOne

Medium 5.3 View original
  • Triaged in 13 hours
  • Fixed in 3 days
  • Disclosed after 3 days

In reference to #453820

Module

module name: harp version: 0.29.0 npm page: https://www.npmjs.com/package/harp

Module Description

zero-configuration web server with built in pre-processing

Module Stats

2,679 downloads in the last week

Vulnerability

Path traversal using symlink.

Vulnerability Description

Similar to #403703. It can be used to list any file in another folder of web root.

Steps To Reproduce

  • Install harpjs
yarn global add harp
  • Run harp server
harp server
  • Create a symlink inside your project directory.
$ ln -s ../../../../../etc/passwd sympasswd
  • Request the file with curl
$ curl --path-as-is 0.0.0.0:9000/sympasswd
root:x:0:0:root:/root:/bin/bash
...

Patch

Educating users about this behaviour in the docs and probably providing a flag to disable/enable following symlinks.

Supporting Material/References:

  • Ubuntu 16.04
  • node v11.3.0
  • npm 6.4.1

Wrap up

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

Impact

You can access files outside project directory through server via symlink.

The original report as published on HackerOne, by skyn3t. 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 symbolic links without checking that the real target stays inside the web root.

Impact

Files outside the project directory can be read through the server via a symlink, though this requires the ability to place a link in the served directory.

What the attacker needed

Ability to create a symlink in the project; harp server running locally

The fix

The maintainer proposed documenting the behaviour and probably adding a flag to enable or disable following symlinks; the text does not say it was fixed.

How it was found

  1. Install the harp package globally.
  2. Start the harp server.
  3. Create a symbolic link inside the project directory that points to a file outside it.
  4. Request the link's name from the server and receive the outside file's contents.

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 normally only hands out files from the folder it was told to serve. A symbolic link is a shortcut file that points at another file elsewhere on the disk. Here the server followed such shortcuts without checking where they lead, so a shortcut placed in the project folder let the server hand out a file from outside that folder.

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 skyn3t

View all

9 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.