Executive brief
The cryptiles library, a utility used for cryptography in Node.js applications, contains a flaw in how it generates random numbers. Because the generated digits are not truly random or evenly distributed, an attacker could potentially predict security tokens or keys. This could lead to unauthorized access to user accounts or sensitive data.
Technical details
The cryptiles library (prior to 3.1.3 and 4.1.2) is vulnerable to insufficient entropy (CWE-331) within its randomDigits() method. The root cause is a weak random number generation algorithm that produces digits that are not evenly distributed, making the output predictable. A remote attacker can exploit this lack of randomness to bypass security controls that rely on these values, such as session identifiers or password reset tokens. The vulnerability is exploitable over the network without authentication or user interaction. Users should upgrade to version 4.1.2 or migrate to the maintained @hapi/cryptiles package.
Affected products
- hapijs cryptiles >= 3.1.0, < 3.1.3; >= 4.0.0, < 4.1.2
Timeline
- 2018-07-09: disclosed: NVD publication date
- 2018-09-11: advisory: GitHub Advisory published