Skip to content
XSS Write-up Beginner

How I Found a Stored XSS Vulnerability Through a PDF Upload

A team messaging application stored a PDF file whose filename or metadata contained script code, and displayed it in the chat without proper encoding. When another user opened the chat, the script executed in their browser, allowing session theft or actions on their behalf.

Abhiii_Sharma Follow

Published on medium.com

While exploring a web application recently, I discovered an interesting stored (persistent) XSS vulnerability that was triggered through a PDF upload feature inside a team messaging system. This post walks you through how I found it, what caused it, the potential impact, and how such bugs can be prevented.

Abhishek sharma, on medium.com

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 displayed user-controlled PDF metadata or filename in the chat without HTML encoding, possibly inserting it via innerHTML or serving the PDF with an incorrect Content-Type.

Impact

An attacker could steal session cookies or local storage tokens, perform actions on behalf of the victim, display phishing prompts, and potentially spread automatically as a wormable XSS.

What the attacker needed

Two accounts on the same team; victim opens the chat with the file

How it was found

  1. Create two accounts and log each into a separate browser.
  2. Account A invites Account B to its team.
  3. Account A uploads a PDF containing script code in its filename or metadata to the team's General messages.
  4. Switch to Account B's browser and open the General chat where the file was shared.
  5. Observe the script executing as a popup.

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.

Cross-site scripting (XSS) is when a website shows text from a user as if it were part of the page's code, so the browser runs it. Here, a file name or file details were shown in a chat without being made safe, so script hidden in them ran for anyone who viewed the chat. That lets an attacker act as the victim in the app.

What is XSS?

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

More by Abhiii_Sharma

View all

3 more disclosed reports, best first.

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.