Skip to content
File upload Disclosed report Beginner

Unrestricted File Upload Leads to XSS & Potential RCE

The application allowed uploading an HTML file without restriction, which was then served back to users and executed as stored XSS. The report also claims a PHP shell could be uploaded, giving potential remote code execution.

5050thepiguy Follow

Originally disclosed on HackerOne

  • Triaged in 6 hours
  • Fixed in 20 days
  • Disclosed after 21 days

Summary: Unrestricted file upload at████████/request?openform. When the user wants to upload a file the app allows the user to upload a HTML file leading to stored XSS and creation of a simple php script. A user can upload the HTML file and trigger XSS and trigger potential RCE with php shell. Please go to the ██████ Request that I created at -- ██████████AllOpenOrders/4F4D0C69EA2B33A58525858A001E2B8C?opendocument and select the file at the bottom "unsure1.html" to trigger payload to show XSS and php shell. You can also go directly to the uploaded file at ████0/4f4d0c69ea2b33a58525858a001e2b8c/$FILE/unsure1.html. Please see the attached PoC video as well. Thanks.

Impact

The unrestricted file upload vulnerability leads to stored XSS and creation of php shell leading to potential RCE, which opens the door to numerous malicious attacks by the attacker.

Step-by-step Reproduction Instructions

  1. Go to███/request?openform
  2. Enter in the details for this page and you will automatically be redirected to the next page. Do the same thing here and enter in all the necessary information
  3. Then, towards the bottom you are given the option to upload files so click "browse" and upload your payload
  4. Click "submit request" then go back to █████████ModifyRequest.xsp and enter in the 14 digit Document Number.
  5. Scroll down to the bottom of your request and click the HTML payload.
  6. Observe that XSS triggers and php shell is seen as well.

Product, Version, and Configuration (If applicable)

███ ███request?openform

Suggested Mitigation/Remediation Actions

Restrict file uploads to only necessary business requirements. If possible restrict uploads to JPG, DOC, DOCX, and PDF. Don't allowed upload of executable files.

##References Please see attached PoC video Please see attached PoC HTML page as well used for the payload

Impact

The unrestricted file upload vulnerability leads to stored XSS and creation of php shell leading to potential RCE, which opens the door to numerous malicious attacks by the attacker.

The original report as published on HackerOne, by 5050thepiguy. 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 upload feature did not check file type or content, and uploaded files were served from a location that executed or rendered them.

Impact

An attacker could run script in other users' browsers and potentially execute code on the server, though the report only claims potential RCE.

What the attacker needed

Access to the request form; ability to upload a file

The fix

The upload feature should restrict file types to only those needed for business, such as images and documents, and should not allow executable or HTML files.

How it was found

  1. Open the request form page.
  2. Fill in the form details and continue to the next page, entering all required information.
  3. At the bottom, use the browse option to upload the payload file.
  4. Submit the request, then go to the modify request page and enter the 14-digit document number.
  5. Scroll to the bottom of the request and click the uploaded HTML file.
  6. Observe that the XSS triggers and a PHP shell is visible.

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 upload feature accepted an HTML file and later showed it to other users in a way that made the browser run any scripts inside it. That is called stored cross-site scripting because the malicious script is saved on the server and runs for anyone who opens the file. The report also says a PHP script could be uploaded, which, if the server ran it, would let an attacker run commands on the server.

What is File upload?

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.

More by 5050thepiguy

View all

4 more disclosed reports, best first.

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.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.