Skip to content
XSS Disclosed report Beginner

Unrestricted file upload leads to stored xss on https://████████/

The web application did not validate the content type of uploaded certificate files, allowing an attacker to upload an HTML file containing a script. When the uploaded file was opened, the script executed in the context of the site, enabling stored cross-site scripting.

sensoyard Follow

Originally disclosed on HackerOne

  • Triaged in 2 hours
  • Fixed in 16 days
  • Disclosed after 37 days

Summary:

When the user want to upload a "certificate", the web app doesn't check the content-type of the file. A user can upload any kind of file (binary,html,...)

Step-by-step Reproduction Instructions

  1. Create an account at https://██████/████████/app/registration/basic-info

  2. When you are connected, click on "certification"

Upload this file as xss.html and save the modifications:

HTML
<!DOCTYPE html>
<html>
  <head>
    <title>Simple Test</title>
    <meta name="viewport" content="initial-scale=1.0">
    <meta charset="utf-8">
  </head>
  <body>
    <script>
	alert(document.cookie	)
	</script>
  </body>
</html>

3 . Go back to the "certification tab " and open the attachement in a new tab

POC :https://███/████/registration-service/files/███████.html

Suggested Mitigation/Remediation Actions

Restrict the content-type of the uploaded files

Impact

The unrestricted file upload vulnerability leads to stored xss.

The original report as published on HackerOne, by sensoyard. 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 application failed to validate or restrict the content type of uploaded files, allowing an HTML file with script to be stored and later served.

Impact

The unrestricted file upload could lead to stored cross-site scripting, allowing script execution when the uploaded file is opened.

What the attacker needed

A user account; ability to upload a certificate file

The fix

The application should restrict the content type of uploaded files.

How it was found

  1. Create an account on the site.
  2. Go to the certification section.
  3. Upload an HTML file containing a script as the certificate and save.
  4. Return to the certification tab and open the uploaded attachment in a new tab.

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 website let people upload a file to prove a certificate, but it did not check what kind of file it was. Someone uploaded a web page with a small script instead of a real certificate. When that page was opened, the script ran in the website's own context, which is called stored cross-site scripting because the harmful file is saved on the server.

What is XSS?

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

More from U.S. Dept Of Defense

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.