Skip to content
XSS Write-up Beginner

Stored xss using PDF a bug?

Uploaded PDF files containing JavaScript were served from the main application domain, so opening the uploaded file executed the script in that origin. The author reports this as stored cross-site scripting, though they note that common cookie and location access did not work in their tests.

dsmodi484 Follow

Published on medium.com

Hello Hackers, Today in this writeup I am going to discuss a bug which is not that high level but sometimes this bug will give you HOF. It totally depends on the company to company.

cryptoshant🇮🇳, 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 stored user-uploaded PDFs on its main domain and served them without a sandbox or separate origin, allowing embedded PDF JavaScript to run in the site's context.

Impact

Other workspace members or employees who open the uploaded PDF could have script run in the main site's context, though the author could not access cookies or location in their tests and the second case was initially limited to the uploader.

What the attacker needed

Ability to upload a PDF; victim opens the uploaded PDF; PDF viewer executes JavaScript

The fix

The company should store and serve uploaded PDFs from a separate sandbox domain so they do not run in the main site's origin.

How it was found

  1. Find a feature that lets users upload PDF files.
  2. Upload a PDF containing a simple JavaScript alert payload.
  3. Open the uploaded PDF from its URL on the main domain.
  4. Observe the alert pop-up, showing script execution.

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.

A PDF file can contain JavaScript, and some PDF viewers run it when the file is opened. If the file is stored on the same website address as the application, that script may run as if it were part of the site. This is called stored cross-site scripting because the harmful file is saved on the server and later shown to other users.

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 dsmodi484

View all

8 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.