CVE-2023-46233: Weakness in crypto-js PBKDF2
Summary
CVE-2023-46233: crypto-js PBKDF2 1,000 times weaker than specified in 1993 and 1.3M times weaker than current standard. Affects crypto-js versions < 4.2.0. Fixed in 4.2.0. How to fix ↓
Also tracked for
- cryptojs · Debian:11
The same CVE-2023-46233 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Crypto-js is an open-source JavaScript library that provides cryptographic functionality such as encryption, decryption, and hashing. It is widely used for various security-related operations in web applications. However, the PBKDF2 implementation in crypto-js has a severe vulnerability that makes it significantly weaker than the industry standard. This vulnerability affects all versions of the package.
Vulnerability Detail
The crypto-js PBKDF2 implementation defaults to using the SHA1 hash algorithm, which has been considered insecure since 2005. Additionally, it uses only one iteration, while the current industry standard recommends at least 1,300,000 iterations. These weaknesses significantly reduce the strength and security of the derived keys. An attacker can exploit this vulnerability to create identical cryptographic signatures for different inputs, potentially leading to unauthorized access or data manipulation. The impact is particularly high when this vulnerability is used to protect passwords or generate signatures.
How To Fix
Latest published version: 4.2.0 as of 22 Oct 2026
npm install crypto-js@4.2.0
The newest release already contains this fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to the latest version is not feasible, an alternative workaround is to manually configure the PBKDF2 parameters in the code. Specifically, the hash algorithm should be changed to a more secure one (e.g., SHA256), and the number of iterations should be increased to a value recommended by industry standards (e.g., 1,300,000). Here's an example of how to configure PBKDF2 with SHA256 and 1,300,000 iterations in crypto-js:
const CryptoJS = require('crypto-js');
const password = 'myPassword';
const salt = 'mySalt';
const iterations = 1300000;
const keySize = 256;
const derivedKey = CryptoJS.PBKDF2(password, salt, {
keySize: keySize / 32,
iterations: iterations,
hasher: CryptoJS.algo.SHA256
});
Conclusion
The crypto-js PBKDF2 vulnerability poses a significant risk to applications using this package for cryptographic operations. It is crucial to upgrade to the latest version or apply the recommended workaround to ensure the security of derived keys. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for crypto-js →
FAQ
Crypto-js is an open-source JavaScript library that provides cryptographic functionality for web applications.
PBKDF2 is a key-derivation function used to stretch or squash a password's entropy into a fixed size and reduce the chance of password recovery.
The crypto-js PBKDF2 implementation defaults to using the insecure SHA1 hash algorithm and a low number of iterations, making it significantly weaker than the industry standard.
This vulnerability can lead to unauthorized access or data manipulation, especially when used to protect passwords or generate signatures.
To fix this vulnerability, upgrade to version 4.2.0 or later of the crypto-js package. Alternatively, manually configure PBKDF2 with a more secure hash algorithm and a higher number of iterations.
References
Related vulnerabilities
Recent vulnerabilities recorded for crypto-js.