Predictable Seed in PRNG |
Weakness ID: 337 (Weakness Base) | Status: Draft |
Description Summary
A PRNG is initialized from a predictable seed, e.g. using process ID or system time.
Example 1
In the code snippet below, a statistical PRNG is seeded with the current value of the system clock, which is easily guessable.
(Bad Code)
Example Language: Java
Random random = new Random(System.currentTimeMillis());
int accountID = random.nextInt();
Use non-predictable inputs for seed generation. |
Phase: Implementation Perform FIPS 140-2 tests on data to catch obvious entropy problems. |
Phase: Implementation Consider a PRNG which re-seeds itself, as needed from a high quality pseudo-random output, like hardware devices. |
Nature | Type | ID | Name | View(s) this relationship pertains to |
---|---|---|---|---|
ChildOf | Weakness Class | 335 | PRNG Seed Error | Development Concepts (primary)699 Research Concepts (primary)1000 |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
PLOVER | Externally Mined | |||
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-07-01 | Sean Eidemiller | Cigital | External | |
added/updated demonstrative examples | ||||
2008-07-01 | Eric Dalci | Cigital | External | |
updated Time of Introduction | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Relationships, Taxonomy Mappings | ||||
2009-03-10 | CWE Content Team | MITRE | Internal | |
updated Potential Mitigations | ||||
2009-12-28 | CWE Content Team | MITRE | Internal | |
updated Potential Mitigations |