CWE-332: Insufficient Entropy in PRNG
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The lack of entropy available for, or used by, a Pseudo-Random Number Generator (PRNG) can be a stability and security threat.
常见后果
影响范围: Availability
技术影响: DoS: Crash, Exit, or Restart
说明: If a pseudo-random number generator is using a limited entropy source which runs out (if the generator fails closed), the program may pause or crash.
影响范围: Access Control Other
技术影响: Bypass Protection Mechanism Other
说明: If a PRNG is using a limited entropy source which runs out, and the generator fails open, the generator could produce predictable random numbers. Potentially a weak source of random numbers could weaken the encryption method used for authentication of users.
潜在缓解措施
阶段: Architecture and Design Requirements
策略: Libraries or Frameworks
描述: Use products or modules that conform to FIPS 140-2 [REF-267] to avoid obvious entropy problems. Consult FIPS 140-2 Annex C ("Approved Random Number Generators").
阶段: Implementation
描述: Consider a PRNG that re-seeds itself as needed from high-quality pseudo-random output, such as hardware devices.
阶段: Architecture and Design
描述: When deciding which PRNG to use, look at its sources of entropy. Depending on what your security needs are, you may need to use a random number generator that always uses strong random data -- i.e., a random number generator that attempts to be strong but will fail in a weak way or will always provide some middle ground of protection through techniques like re-seeding. Generally, something that always provides a predictable amount of strength is preferable.
观察示例
参考: [REF-1374]
Chain: JavaScript-based cryptocurrency library can fall back to the insecure Math.random() function instead of reporting a failure (CWE-392), thus reducing the entropy (CWE-332) and leading to generation of non-unique cryptographic keys for Bitcoin wallets (CWE-1391)
参考: CVE-2019-1715
security product has insufficient entropy in the DRBG, allowing collisions and private key discovery
引入模式
| 阶段 | 说明 |
|---|---|
| Architecture and Design | - |
| Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |
适用平台
编程语言
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| CLASP | - | Insufficient entropy in PRNG | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | MSC02-J | Generate strong random numbers | - |