Arbitrary JavaScript Execution in react-pdf via PDF.js isEvalSupported
CVE-2024-34342 affects react-pdf, a library for rendering PDFs in React applications. When react-pdf uses PDF.js to load a malicious PDF, and PDF.js is operating with isEvalSupported set to true (the default behavior referenced in the advisory), attacker-controlled JavaScript embedded in the PDF can be executed without restriction in the security context of the hosting web application domain. The issue is therefore a script execution flaw triggered by opening a crafted PDF through the vulnerable integration. Fixed releases are 7.7.3 and 8.0.2.
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
Successful exploitation results in unrestricted attacker-controlled JavaScript execution in the origin context of the affected hosting domain. This can enable theft of session data and tokens accessible to client-side code, DOM manipulation, actions on behalf of the user within the application, access to sensitive application data exposed to the browser, and broader compromise equivalent to a same-origin XSS-style execution primitive.
If you can’t patch tonight, do this now.
If immediate upgrade is not possible, explicitly set options.isEvalSupported to false on the react-pdf Document component to disable the vulnerable PDF.js behavior when rendering PDFs. More generally, avoid rendering untrusted PDFs in-browser until the fixed version is deployed.
Patch, then assume compromise.
Upgrade react-pdf to a fixed version: 7.7.3 or later on the 7.x branch, or 8.0.2 or later on the 8.x branch. According to the advisory, the fix forces isEvalSupported to false, eliminating the vulnerable PDF.js execution path.
1 exploit validated by Mallory's analysis.
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
No public activity tracked yet. Mallory keeps watching.
No public activity observed for this vulnerability.