PDF.js PDF file editing - HTML injection can cause data exfiltration
PDF.js's PDF editing feature allowed pasting HTML/CSS content, which could lead to HTML injection. An attacker could exploit this to leak the referrer or exfiltrate data.
Originally disclosed on Mozilla
- Fixed in 10 days
- Paid in 10 days
- Disclosed after 10 days
PDF.js version: PDF.js: 4.1.249 [d07f37f44]
Firefox: 124.0.1
OS: OSX
Finding based on Michał Bentkowski research:
https://research.securitum.com/the-curious-case-of-copy-paste/
https://research.securitum.com/css-data-exfiltration-in-firefox-via-single-injection-point/
Step to reproduce:
1. Go to copy&paste playground: https://cdn.sekurak.pl/copy-paste/playground.html
2. Create HTML/CSS input
3. Copy as HTML
4. Go to example pdf file: https://assets.mozilla.net/wnp124-en/wnp-fx124-en.pdf
5. Edit PDF using "Text" option
6. Paste HTML/CSS input
PoC: https://drive.google.com/file/d/1mdDZSaxp3HICh-pSxRa3ezrZQcQXNmfP/view?usp=sharing
Threats that may occur:
- referer leakage
- data exfiltration
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 PDF editor's text editing feature did not sanitise pasted HTML/CSS content, allowing injection.
What the attacker needed
PDF.js editor with text editing; victim pastes malicious HTML/CSS
How it was found
- Go to the copy&paste playground.
- Create HTML/CSS input.
- Copy as HTML.
- Go to an example PDF file.
- Edit the PDF using the 'Text' option.
- Paste the HTML/CSS input.
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.
PDF.js is a tool that lets you view and edit PDFs in your browser. The report says that when you paste content into a PDF, the editor doesn't properly handle HTML and CSS, so malicious code could be injected. This could let an attacker steal information about you or send data to themselves.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.