[seeftl] Stored XSS when directory listing via filename.
The seeftl static server does not sanitise filenames when rendering a directory listing, so a filename containing HTML event-handler attributes is inserted into the page unescaped. An attacker who can create a file with a crafted name can cause script to run in the browser of anyone who views the listing and hovers over the filename.
- Triaged in 2 days
- Fixed in 5 months
- Disclosed after 5 months
I would like to report Stored XSS via filename in directory listing in seeftl
It allows to inject malicious input in a filename that leads to stored XSS when directories listing.
# Module
**module name:** seeftl
**version:** 0.1.1
**npm page:** `https://www.npmjs.com/package/seeftl`
## Module Description
seeftl -- 一个简单的预览ftl文件的静态服务器(在anywhere基础上改的)
�
�
是通过在ftl同级目录写一个config文件,替换ftl里的变量和宏 达到实时预览的功能:
## Module Stats
[8] downloads in the last week
# Vulnerability
## Vulnerability Description
The XSS occurs due the module does not sanitize de representation of filename when directories listing.
## Steps To Reproduce:
install seeftl:
`$ npm install seeftl -g`
Create a file with the following name:
`" onmouseover=alert('xss') "`
{{media:0}}
run seeftl server in the path that you created the file with the malicious filename:
```
$ seeftl
Running at http://127.0.0.1:8000/
```
Open `http://localhost:8000/` in your browser.
{{media:1}}
Put the mouse over the filename and the event will be triggered and pop up the alert.
{{media:2}}
## Patch
Users input should be sanitized and dangerous characters should be HTML encoded before printing them on screen.
## Supporting Material/References:
- Kali Linux 2019.2 amd64
- v10.15.2
- 5.8.0
- Firefox ESR 60.7.2esr (64-bit)
# Wrap up
- I contacted the maintainer to let them know: [N]
- I opened an issue in the related repository: [N]
## Impact
It allows to inject malicious scripts in filenames and execute them in the browser via a XSS.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 concatenates raw filenames into the directory-listing HTML without HTML-encoding special characters.
Impact
An attacker could inject malicious scripts via filenames and have them execute in a victim's browser when the victim views and interacts with the directory listing.
What the attacker needed
Ability to create a file with a crafted name; victim views the directory listing; victim hovers over the filename
How it was found
- Install the seeftl package globally with npm.
- Create a file whose name contains an HTML attribute that triggers an alert on mouseover.
- Start the seeftl server in the directory containing that file.
- Open the server's root URL in a browser.
- Hover the mouse over the displayed filename to trigger the alert.
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 directory listing is a web page that shows the files in a folder. This tool builds that page by pasting each filename directly into the HTML without cleaning it first. If a filename contains special characters that look like HTML code, the browser treats them as code and runs them, which is called cross-site scripting (XSS).
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.