How I Chained a File Upload Vulnerability with IDOR to Exploit XS
The application allowed uploading HTML files that executed script when accessed, and the upload API did not verify that the ticket ID belonged to the authenticated user. An attacker could upload a malicious file to another user's ticket feedback section, leading to script execution when the victim viewed the ticket.
Published on amanpreetsinghofficial.medium.com
During my recent security testing on an application, I discovered an interesting vulnerability chain that allowed me to exploit Cross-Site Scripting (XSS) by combining a file upload vulnerability with Insecure Direct Object References (IDOR). Here’s how I did it.
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
Impact
An attacker could execute script in another user's browser when that user viewed the affected ticket, potentially leading to session compromise or other actions.
What the attacker needed
A user account; ability to book a ticket; victim opens the ticket
The fix
The application should restrict uploaded file types to safe formats, validate file contents on the server, and verify that the authenticated user owns the ticket before processing uploads.
How it was found
- Upload an HTML file containing a script to the feedback section of a booked ticket.
- Access the uploaded file's path and observe that the script executes.
- Modify the ticket ID in the upload request to reference a ticket not owned by the user.
- Observe that the upload succeeds and the file appears in the other ticket's feedback.
- Create a second user account, book a ticket, and note the sequential ticket ID.
- Using the original user's session, send an upload request with the second user's ticket ID and user ID, then log in as the second user and open the ticket to see the script execute.
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.
This report describes two mistakes in a web app. First, it let people upload HTML files that run code in the browser (cross-site scripting, or XSS). Second, it did not check that the ticket being modified belonged to the person making the request (an insecure direct object reference, or IDOR). Together, an attacker could put a harmful file into someone else's ticket and run code when that person opened it.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.