react-pdf
react-pdf copied to clipboard
CVE-2023-46233 in crypto-js as part of @react-pdf/[email protected]
The Bug
CVE-2023-46233 describes the PBKDF2 algorithm implemented in crypto-js prior to version 4.2.0 as being 1,000 times weaker according to the spec from 1993 and 1,300,000 weaker than the current industry standard.
To Reproduce Steps to reproduce the behavior including code snippet (if applies):
- Install trivy via the installation docs
- Clone this repo into a folder on your local machine.
- Run
trivy fs .inside that folder. - See that
crypto-jsis installed at version 4.0.0 and is listed as acriticalseverity CVE.
Expected behavior
Expect crypto-js dependency to be upgraded within the pdfkit package to the latest version, 4.2.0.
Desktop (please complete the following information):
- OS: OSX
- Browser: N/A
- React-pdf version: latest (3.0.2)
TL;DR for concerned react-pdf users
If the only crypto-js dependency in your project's manifest is via react-pdf, you're safe enough to dismiss the dependabot alert as Vulnerable code is not actually used
A few comments regarding this:
- It causes dependabot (or whatever SCA tooling one might use) to raise a critical error for users of
react-pdf, due to thecrypto-jsdependency - Since it's such an easy fix, the maintainers of
react-pdfshould certainly update their version ofcrypto-jsto the mitigated version, for everyones' sanity - Important - Users of
react-pdfcan dismiss the dependabot warning- Per https://github.com/diegomura/react-pdf/pull/1607 :
react-pdfonly actually uses themd5algorithm fromcrypto-js,- (I haven't thoroughly reviewed the rest of the codebase, but I assume
md5is used as a convenient hashing algorithm in a non security-critical context, and there's no reason to actually use PBKDF2 or any other crypto function ) - so it's safe enough to assume the vulnerable algorithm is never actually used by
react-pdf, - therefore, assuming the only dependency is via
react-pdf's dependency, a project withreact-pdfin its dependencies is not affected by this CVE, - The developer can dismiss the alert as
Vulnerable code is not actually used
- Per https://github.com/diegomura/react-pdf/pull/1607 :