Skip to content
Path traversal Disclosed report Beginner

[md-fileserver] Path Traversal

The md-fileserver module does not verify that requested files are within the root directory, allowing path traversal. An attacker can read arbitrary system files, such as /etc/passwd, via a crafted URL.

johnssimon007 Follow

Originally disclosed on HackerOne

High 7.5 View original
  • Triaged in 3 hours
  • Fixed in 10 months
  • Disclosed after 11 months

I would like to report path traversal in md-fileserver modulee It allows an attacker to read system files via path traversal through commandline

Module

module name: md-fileserver version: 1.3.2 npm page: https://www.npmjs.com/package/md-fileserver

Module Description

Starts a local server to render "markdown" files within your browser:

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 -g md-fileserver

2.start the local server by typing below on commandline $mdstart

3.now on terminal type curl -v --path-as-is http://127.0.0.1:8080/etc/passwd

it will list all the credentials in passwd folder

Supporting Material/References:

State all technical information about the stack where the vulnerability was found

  • [OPERATING SYSTEM VERSION] kali linux
  • [NODEJS VERSION] 11.8.0
  • [NPM VERSION] 6.5.0

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]

Impact

This vulnerability allows malicious user to read content of any file on the server, which leads to data breach or other attacks.

Attachments

Screenshot_from_2019-03-14_20-39-50.png
Screenshot_from_2019-03-14_20-39-50.png From the original on HackerOne

The original report as published on HackerOne, by johnssimon007. 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 a malicious user to read the content of any file on the server, which could lead to a data breach or other attacks.

What the attacker needed

Md-fileserver installed and running; attacker can send HTTP requests to the server

How it was found

  1. Install md-fileserver globally using npm.
  2. Start the local server by running the mdstart command.
  3. Send a crafted request with path traversal to read 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.

The md-fileserver tool serves markdown files from a folder. It fails to check that requested files are inside that folder, so an attacker can use a crafted URL to read system files such as password files.

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 johnssimon007

View all

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