File Upload XSS Beyond SVG: Four Vectors Validation Misses
The author found that a document management product validated file contents thoroughly but displayed the uploaded filename without escaping, allowing script injection. An attacker could upload a harmless file with a malicious name to execute script when the filename is rendered.
Day twenty-three. Yesterday was about one file type.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application treated the filename as trusted metadata and rendered it without output encoding, while all validation focused on file contents.
Impact
If the filename is rendered unescaped for other users, an attacker could execute script in their browsers, potentially leading to account compromise or data theft.
What the attacker needed
Ability to upload a file; victim views the filename
The fix
The application should escape or encode the filename wherever it is displayed, treating it as untrusted user input.
How it was found
- Upload a clean, valid file of an accepted type.
- Change only the filename to include a marker.
- Upload it and find where the marker appears (list view, detail view, download link, etc.).
- Test whether the marker is escaped using a character probe.
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 write-up has not been written yet. The Original tab links to the source.
When you upload a file, the website checks the file's contents for safety. But the file's name is also shown on the page, and if the site does not clean it, someone can put code in the name that runs in other users' browsers. This 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.