From Exploit to Payday-Chaining Stored XSS in PDF Upload to Full
A file upload feature accepted PDFs containing embedded JavaScript, and when a victim opened the uploaded PDF the script ran and sent a request to the application's API to change the victim's email address. The author claims this lets an attacker take over the victim's account without a password.
Published on medium.com
The root cause of this critical vulnerability lies in the use of outdated or insecure PDF processing libraries, such as PDFTron, PDF.js, or similar tools, which fail to sanitize embedded JavaScript in PDFs properly.
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 served uploaded PDFs in a way that let embedded JavaScript execute in the site's origin, so the script could call authenticated API endpoints as the victim.
Impact
The author claims the attacker gains full control of the victim's account and can reset passwords, read sensitive data and lock the victim out, though the text gives no evidence that this was tested on a live target.
What the attacker needed
Ability to upload a PDF; victim opens the uploaded PDF; victim is logged in
How it was found
- Upload a PDF that contains hidden JavaScript.
- The victim opens the uploaded PDF.
- The script runs without the victim noticing.
- The script calls the email update API as the victim, replacing their email with the attacker's.
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 can carry small programs written in JavaScript, and some PDF viewers run them when the file is opened. If the site that hosts the PDF does not strip that code, the program can act as the logged-in victim and call the site's own API. Here the author says that let an attacker swap the victim's email for their own, which is the first step to taking over the account.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.