CVE-2022-35255 Overview
A weak randomness vulnerability exists in the WebCrypto key generation functionality of Node.js 18. The vulnerability stems from a problematic change to the EntropySource() function within SecretKeyGenTraits::DoKeyGen() located in src/crypto/crypto_keygen.cc. This implementation flaw introduces two critical problems: the code fails to verify the return value of EntropySource(), incorrectly assuming it always succeeds when it can and sometimes will fail; additionally, the random data returned by EntropySource() may not be cryptographically strong and therefore unsuitable as keying material.
Critical Impact
Attackers could potentially predict or derive cryptographic keys generated using the WebCrypto API, leading to unauthorized access to encrypted data or authenticated sessions in Node.js applications.
Affected Products
- Node.js 18 (multiple versions)
- Siemens SINEC INS (versions up to and including 1.0 SP2)
- Debian Linux 11.0
Discovery Timeline
- 2022-12-05 - CVE-2022-35255 published to NVD
- 2025-04-24 - Last updated in NVD database
Technical Details for CVE-2022-35255
Vulnerability Analysis
This vulnerability represents an Insecure Random Number Generation flaw (CWE-338) in Node.js's cryptographic subsystem. The WebCrypto API is designed to provide secure cryptographic operations for web applications, including key generation for symmetric and asymmetric encryption. When the EntropySource() function fails silently or returns weak random data, the generated keys may be predictable or have reduced entropy, fundamentally undermining the security guarantees that applications rely upon when using these cryptographic primitives.
The implications are severe for applications using WebCrypto for sensitive operations such as session token generation, encryption key derivation, or digital signatures. Keys generated during periods when EntropySource() fails could potentially be reproduced by attackers who understand the failure conditions.
Root Cause
The root cause lies in the implementation of SecretKeyGenTraits::DoKeyGen() in the Node.js source file src/crypto/crypto_keygen.cc. The code calls EntropySource() to obtain random bytes for key generation but does not check whether this function returns successfully. When EntropySource() fails, the key generation continues with potentially uninitialized or predictable data. Furthermore, even when EntropySource() succeeds, the entropy it provides may not meet the cryptographic strength requirements necessary for secure key material.
Attack Vector
The vulnerability is exploitable over the network without requiring authentication or user interaction. An attacker targeting this vulnerability would focus on scenarios where:
- Key Prediction: Identifying conditions under which EntropySource() fails or returns weak entropy, allowing prediction of generated keys
- Cryptographic Downgrade: Exploiting weak keys to decrypt sensitive communications or forge authenticated messages
- Session Compromise: If session tokens or authentication keys are generated using the flawed WebCrypto implementation, attackers could potentially hijack user sessions
The attack does not require local access to the vulnerable system and can be conducted remotely against any service using the affected Node.js WebCrypto API for key generation.
Detection Methods for CVE-2022-35255
Indicators of Compromise
- Unusual patterns in cryptographic key generation logs or entropy pool depletion warnings
- Detection of predictable or duplicate cryptographic keys across different sessions
- Anomalous authentication successes without valid credentials
- Signs of session hijacking or unauthorized access following key generation events
Detection Strategies
- Monitor Node.js application logs for any entropy-related warnings or errors during key generation operations
- Implement key randomness validation in test environments to detect weak key generation
- Deploy network monitoring to identify potential exploitation attempts targeting cryptographic weaknesses
- Audit applications using the WebCrypto API in Node.js 18 for vulnerable key generation patterns
Monitoring Recommendations
- Enable verbose logging for cryptographic operations in Node.js applications
- Implement alerts for entropy pool status on systems running vulnerable Node.js versions
- Review authentication and session management logs for anomalies that could indicate compromised keys
- Consider implementing external entropy source monitoring where applicable
How to Mitigate CVE-2022-35255
Immediate Actions Required
- Upgrade Node.js to a patched version that addresses the EntropySource() issues
- Audit and regenerate any cryptographic keys that were generated using vulnerable Node.js 18 versions
- Review applications for WebCrypto API usage and assess potential exposure
- Apply vendor patches for Siemens SINEC INS and Debian Linux if applicable
Patch Information
Security patches are available through the official Node.js release channels. For affected downstream products:
- Siemens SINEC INS: Refer to Siemens Security Advisory SSA-332410 for patch information
- Debian Linux: Apply updates per Debian Security Announcement DSA-5326
- NetApp Products: Consult NetApp Security Advisory NTAP-20230113-0002
Additional technical details are available in HackerOne Report #1690000.
Workarounds
- If immediate patching is not possible, consider using alternative cryptographic libraries for key generation that do not rely on the vulnerable Node.js WebCrypto implementation
- Implement additional entropy validation checks before accepting generated keys
- Deploy applications with enhanced entropy sources at the operating system level
- Consider temporary migration to Node.js LTS versions that may not be affected by this specific vulnerability
# Check Node.js version for vulnerability assessment
node --version
# Upgrade Node.js to the latest patched version (example using nvm)
nvm install --lts
nvm use --lts
# Verify the upgrade
node --version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

