CVE-2022-35255: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) (CWE-338) in NodeJS Node
A weak randomness in WebCrypto keygen vulnerability exists in Node.js 18 due to a change with EntropySource() in SecretKeyGenTraits::DoKeyGen() in src/crypto/crypto_keygen.cc. There are two problems with this: 1) It does not check the return value, it assumes EntropySource() always succeeds, but it can (and sometimes will) fail. 2) The random data returned byEntropySource() may not be cryptographically strong and therefore not suitable as keying material.
AI Analysis
Technical Summary
CVE-2022-35255 is a critical vulnerability identified in Node.js, specifically affecting versions 4.0 through 18.0. The flaw arises from the use of a cryptographically weak pseudo-random number generator (PRNG) within the WebCrypto key generation functionality. The root cause lies in the implementation of the EntropySource() function in the SecretKeyGenTraits::DoKeyGen() method located in src/crypto/crypto_keygen.cc. Two primary issues are present: first, the code assumes EntropySource() always succeeds and does not verify its return value, which can lead to the use of insufficient entropy if the function fails; second, the random data produced by EntropySource() may not be cryptographically strong, rendering it unsuitable for generating secure cryptographic keys. This weakness compromises the randomness quality of keys generated by Node.js's WebCrypto API, potentially allowing attackers to predict or reproduce keys. Given that cryptographic keys underpin confidentiality and integrity in secure communications and data protection, this vulnerability can lead to severe security breaches. The CVSS v3.1 score of 9.1 (critical) reflects the high impact on confidentiality and integrity without requiring privileges or user interaction, and the vulnerability is remotely exploitable over the network. Although no known exploits are currently reported in the wild, the vulnerability's nature and severity make it a significant risk for any application relying on Node.js for cryptographic operations, especially those generating keys for encryption, signing, or authentication.
Potential Impact
For European organizations, the impact of CVE-2022-35255 is substantial, particularly for those using Node.js in web services, cloud applications, or backend systems that rely on cryptographic key generation. Weak keys can lead to unauthorized data decryption, impersonation, or tampering, undermining data confidentiality and integrity. This is critical for sectors such as finance, healthcare, government, and telecommunications, where sensitive personal and operational data are processed. The vulnerability could facilitate advanced persistent threats (APTs) or cybercriminals in bypassing cryptographic protections, leading to data breaches, regulatory non-compliance (e.g., GDPR violations), and reputational damage. Since Node.js is widely adopted across Europe for scalable web applications and microservices, the scope of affected systems is broad. The lack of requirement for authentication or user interaction means attackers can exploit this vulnerability remotely, increasing the risk of widespread compromise. Additionally, compromised cryptographic keys could affect secure communications, digital signatures, and authentication mechanisms, potentially disrupting business operations and trust frameworks.
Mitigation Recommendations
European organizations should immediately assess their Node.js deployments to identify affected versions (4.0 through 18.0). Mitigation steps include: 1) Upgrading Node.js to a patched version where this vulnerability is resolved; if no official patch is available, consider applying vendor or community-provided patches or workarounds that enforce proper entropy checks and use cryptographically secure randomness sources. 2) Audit all cryptographic key generation processes to ensure they do not rely on vulnerable Node.js versions or weak PRNGs. 3) Implement additional entropy validation layers or integrate external, proven cryptographic libraries for key generation where feasible. 4) Conduct thorough security testing and code reviews focusing on cryptographic implementations. 5) Monitor network traffic and logs for anomalous activities that could indicate exploitation attempts. 6) Educate development teams about secure cryptographic practices and the importance of entropy quality. 7) For critical systems, consider cryptographic key rotation policies to replace potentially compromised keys generated with weak randomness. 8) Engage with Node.js community and security advisories to stay updated on patches and best practices.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Italy, Spain, Poland, Belgium, Finland
CVE-2022-35255: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) (CWE-338) in NodeJS Node
Description
A weak randomness in WebCrypto keygen vulnerability exists in Node.js 18 due to a change with EntropySource() in SecretKeyGenTraits::DoKeyGen() in src/crypto/crypto_keygen.cc. There are two problems with this: 1) It does not check the return value, it assumes EntropySource() always succeeds, but it can (and sometimes will) fail. 2) The random data returned byEntropySource() may not be cryptographically strong and therefore not suitable as keying material.
AI-Powered Analysis
Technical Analysis
CVE-2022-35255 is a critical vulnerability identified in Node.js, specifically affecting versions 4.0 through 18.0. The flaw arises from the use of a cryptographically weak pseudo-random number generator (PRNG) within the WebCrypto key generation functionality. The root cause lies in the implementation of the EntropySource() function in the SecretKeyGenTraits::DoKeyGen() method located in src/crypto/crypto_keygen.cc. Two primary issues are present: first, the code assumes EntropySource() always succeeds and does not verify its return value, which can lead to the use of insufficient entropy if the function fails; second, the random data produced by EntropySource() may not be cryptographically strong, rendering it unsuitable for generating secure cryptographic keys. This weakness compromises the randomness quality of keys generated by Node.js's WebCrypto API, potentially allowing attackers to predict or reproduce keys. Given that cryptographic keys underpin confidentiality and integrity in secure communications and data protection, this vulnerability can lead to severe security breaches. The CVSS v3.1 score of 9.1 (critical) reflects the high impact on confidentiality and integrity without requiring privileges or user interaction, and the vulnerability is remotely exploitable over the network. Although no known exploits are currently reported in the wild, the vulnerability's nature and severity make it a significant risk for any application relying on Node.js for cryptographic operations, especially those generating keys for encryption, signing, or authentication.
Potential Impact
For European organizations, the impact of CVE-2022-35255 is substantial, particularly for those using Node.js in web services, cloud applications, or backend systems that rely on cryptographic key generation. Weak keys can lead to unauthorized data decryption, impersonation, or tampering, undermining data confidentiality and integrity. This is critical for sectors such as finance, healthcare, government, and telecommunications, where sensitive personal and operational data are processed. The vulnerability could facilitate advanced persistent threats (APTs) or cybercriminals in bypassing cryptographic protections, leading to data breaches, regulatory non-compliance (e.g., GDPR violations), and reputational damage. Since Node.js is widely adopted across Europe for scalable web applications and microservices, the scope of affected systems is broad. The lack of requirement for authentication or user interaction means attackers can exploit this vulnerability remotely, increasing the risk of widespread compromise. Additionally, compromised cryptographic keys could affect secure communications, digital signatures, and authentication mechanisms, potentially disrupting business operations and trust frameworks.
Mitigation Recommendations
European organizations should immediately assess their Node.js deployments to identify affected versions (4.0 through 18.0). Mitigation steps include: 1) Upgrading Node.js to a patched version where this vulnerability is resolved; if no official patch is available, consider applying vendor or community-provided patches or workarounds that enforce proper entropy checks and use cryptographically secure randomness sources. 2) Audit all cryptographic key generation processes to ensure they do not rely on vulnerable Node.js versions or weak PRNGs. 3) Implement additional entropy validation layers or integrate external, proven cryptographic libraries for key generation where feasible. 4) Conduct thorough security testing and code reviews focusing on cryptographic implementations. 5) Monitor network traffic and logs for anomalous activities that could indicate exploitation attempts. 6) Educate development teams about secure cryptographic practices and the importance of entropy quality. 7) For critical systems, consider cryptographic key rotation policies to replace potentially compromised keys generated with weak randomness. 8) Engage with Node.js community and security advisories to stay updated on patches and best practices.
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- hackerone
- Date Reserved
- 2022-07-06T00:00:00.000Z
- Cisa Enriched
- true
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 682d983bc4522896dcbee393
Added to database: 5/21/2025, 9:09:15 AM
Last enriched: 6/22/2025, 2:52:35 PM
Last updated: 7/29/2025, 6:57:00 AM
Views: 11
Related Threats
CVE-2025-9008: SQL Injection in itsourcecode Online Tour and Travel Management System
MediumCVE-2025-9007: Buffer Overflow in Tenda CH22
HighCVE-2025-9006: Buffer Overflow in Tenda CH22
HighCVE-2025-9005: Information Exposure Through Error Message in mtons mblog
MediumCVE-2025-9004: Improper Restriction of Excessive Authentication Attempts in mtons mblog
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.