Tag Archives: CWE- 337

CWE-337 – Predictable Seed in Pseudo-Random Number Generator (PRNG)

Read Time:1 Minute, 11 Second

Description

A Pseudo-Random Number Generator (PRNG) is initialized from a predictable seed, such as the process ID or system time.

The use of predictable seeds significantly reduces the number of possible seeds that an attacker would need to test in order to predict which random numbers will be generated by the PRNG.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-335

 

Consequences

Other: Varies by Context

 

Potential Mitigations

Phase:

Description: 

Use non-predictable inputs for seed generation.

Phase: Architecture and Design, Requirements

Description: 

Use products or modules that conform to FIPS 140-2 [REF-267] to avoid obvious entropy problems, or use the more recent FIPS 140-3 [REF-1192] if possible.

Phase: Implementation

Description: 

Use a PRNG that periodically re-seeds itself using input from high-quality sources, such as hardware devices with high entropy. However, do not re-seed too frequently, or else the entropy source might block.

CVE References

  • CVE-2019-11495
    • server uses erlang:now() to seed the PRNG, which
      results in a small search space for potential random
      seeds
  • CVE-2008-0166
    • The removal of a couple lines of code caused Debian’s OpenSSL Package to only use the current process ID for seeding a PRNG
  • CVE-2016-10180
    • Router’s PIN generation is based on rand(time(0)) seeding.
  • CVE-2018-9057
    • cloud provider product uses a non-cryptographically secure PRNG and seeds it with the current time