Skip to content
XSS Write-up Intermediate

CVE-2024-4367 – Arbitrary JavaScript execution in PDF.js

PDF.js did not properly validate font data, allowing an attacker to execute arbitrary JavaScript when a malicious PDF is opened. This affected Firefox users and web or Electron applications that use PDF.js for previewing.

Thomas Rinsma Follow

Published on codeanlabs.com

This post details CVE-2024-4367, a vulnerability in PDF.js found by Codean Labs. PDF.js is a JavaScript-based PDF viewer maintained by Mozilla.

Thomas Rinsma, on codeanlabs.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, PDF.js failed to validate font data, allowing JavaScript to be injected and executed.

Impact

An attacker could execute arbitrary JavaScript code when a victim opens a malicious PDF, affecting Firefox users and applications using PDF.js.

What the attacker needed

Victim opens a malicious PDF

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.

PDF.js is a tool that lets you view PDF files in a web browser. A security flaw meant that a specially crafted PDF file could run harmful code on your computer as soon as you opened it, without you doing anything else.

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 Thomas Rinsma

View all

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