Skip to content
XSS Disclosed report Intermediate

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.

krysztofiak.jedrzej Follow

Originally disclosed on Mozilla

  • Fixed in 10 days
  • Paid in 10 days
  • Disclosed after 10 days
Text
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

The original report as published on Mozilla's Bugzilla, by krysztofiak.jedrzej. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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

  1. Go to the copy&paste playground.
  2. Create HTML/CSS input.
  3. Copy as HTML.
  4. Go to an example PDF file.
  5. Edit the PDF using the 'Text' option.
  6. 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.

More by krysztofiak.jedrzej

View all

1 more disclosed report, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

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.