Executive brief
The crypto-js library, a popular tool for implementing encryption in JavaScript applications, was found to use an insecure method for generating random numbers. This flaw makes the resulting cryptographic keys or tokens more predictable than they should be. An attacker could potentially exploit this predictability to bypass security measures or decrypt sensitive information. Organizations using version 3.2.0 should update to a newer version to ensure their data remains protected by strong, unpredictable encryption.
Technical details
The crypto-js package version 3.2.0 for Node.js contains a vulnerability where random numbers are generated using an insecure method (CWE-330). Specifically, the library attempted to generate random values by concatenating the string '0.' with an integer, which results in insufficient entropy and predictable outputs compared to cryptographically secure pseudo-random number generators (CSPRNG). This predictability can weaken cryptographic operations that rely on randomness, such as key generation or initialization vectors. The issue was addressed in version 3.2.1 by implementing a more robust random number generation strategy that leverages native crypto modules where available.
Affected products
- brix crypto-js 3.2.0
Timeline
- 2020-01-30: disclosed: Issue reported to maintainers via GitHub and email
- 2020-02-11: patched: Fix committed to repository
- 2023-06-12: advisory: GitHub Advisory and CVE published
References
- https://github.com/brix/crypto-js/issues/254
- https://github.com/brix/crypto-js/issues/256
- https://github.com/brix/crypto-js/pull/257/commits/e4ac157d8b75b962d6538fc0b996e5d4d5a9466b
- https://github.com/brix/crypto-js/commit/b405ff597fb3ac76a7bdfbc72dca10ba1079b1d5
- https://github.com/brix/crypto-js/commit/e4ac157d8b75b962d6538fc0b996e5d4d5a9466b
- https://github.com/brix/crypto-js