Skip to content
XSS Disclosed report Beginner CVE-2019-15602

[fileview] Inadequate Output Encoding and Escaping

The fileview module did not sanitise filenames, so a file named with HTML and JavaScript could execute script when the directory listing was viewed in a browser. An attacker could run arbitrary JavaScript in the context of the file server.

johnssimon007 Follow

Originally disclosed on HackerOne

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

I would like to report stored xss in fileview module It allows an attacker to embed malicious js code in filename there was no sanitization performed.

Module

**module name:**fileview version: 0.1.6 npm page: https://www.npmjs.com/package/fileview

Module Description

File browsers on web. It's easy to browser your local file.

Vulnerability

Vulnerability Description

since there was no sanitizations performed on filenames ,an attacker can include filenames with malicious js code which gets executed when browsed to the file over the web browser

Steps To Reproduce:

1.install fileview: npm install fileview -g

2:now create a file with xss payload as follows: "><img src=x onerror=alert("xss")>.jpg

3.running below command on terminal will start a file server at port 8080

fileview -p /root/ -P 8080

4.now goto http://127.0.0.1:8080/

you will see the xss got executed

Patch

If you're able to provide a patch with the fix please post it in this section

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 could have allowed an attacker to embed malicious js code in filename and executes it when victim browse to file over the web browser

Attachments

Screenshot_from_2019-03-09_20-41-37.png
Screenshot_from_2019-03-09_20-41-37.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

Root cause

Likely the file listing page inserted filenames into HTML without escaping special characters.

Impact

An attacker could embed JavaScript in a filename that executes when a victim browses the file listing.

What the attacker needed

Ability to create a file with a crafted name; victim browses the file listing

How it was found

  1. Install the fileview package globally.
  2. Create a file whose name contains an HTML image tag with an error handler.
  3. Start the fileview server on a chosen port.
  4. Open the server's address in a browser and observe the script executing.

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 file server shows a list of files in a web page. If a filename contains HTML code, the browser may treat it as part of the page instead of plain text. Here, a filename with an image tag and an error handler ran JavaScript when the page loaded, which is called stored cross-site scripting because the malicious content is saved as a filename.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

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.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.