CVE-2024-34342 react-pdf's PDF.js vulnerable to arbitrary JavaScript execution upon opening a malicious PDF
Attackers can execute arbitrary JavaScript in the hosting domain by tricking users into opening malicious PDFs with react-pdf.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2024-34342?
CVE-2024-34342 is a high-severity cross-site scripting vulnerability in wojtekmaj react-pdf, published on 7 May 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
react-pdf displays PDFs in React apps. If PDF.js is used to load a malicious PDF, and PDF.js is configured with `isEvalSupported` set to `true` (which is the default value), unrestricted attacker-controlled JavaScript will be executed in the context of the hosting domain. This vulnerability is fixed in 7.7.3 and 8.0.2.
Weakness: CWE-79
Which versions are affected by CVE-2024-34342?
4 open source packages ship an affected version, including react-pdf.
| Package | Affected | Fixed in |
|---|---|---|
react-pdf npm | All versions | 7.7.3 |
react-pdf npm | All versions | 7.7.3 |
react-pdf npm | From 8.0.0 | 8.0.2 |
react-pdf npm | From 8.0.0 | 8.0.2 |
How do I fix CVE-2024-34342?
Upgrade react-pdf to a fixed version for your release line: 7.7.3 or 8.0.2.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2024-34342 being exploited?
There is no known exploitation of CVE-2024-34342 in the wild and no public exploit code.
Sources
Also known as CLSA-2026-1775781167, GHSA-87hq-q4gp-9wr4, ROOT-APP-NPM-CVE-2024-34342.