CWE Database
/

CWE-335

Back to CWE list

CWE-335

Incorrect Usage of Seeds in Pseudo-Random Number Generator (PRNG)

Base
Draft

Description

The product uses a Pseudo-Random Number Generator (PRNG) but does not correctly manage seeds.

{"xhtml:p":["\n\t\t PRNGs are deterministic and, while their output appears\n\t\t random, they cannot actually create entropy. They rely on\n\t\t cryptographically secure and unique seeds for entropy so\n\t\t proper seeding is critical to the secure operation of the\n\t\t PRNG.","\n\t\t Management of seeds could be broken down into two main areas:\n\t\t ","\n\t\t\t PRNGs require a seed as input to generate a stream of\n\t\t\t numbers that are functionally indistinguishable from\n\t\t\t random numbers. While the output is, in many cases,\n\t\t\t sufficient for cryptographic uses, the output of any\n\t\t\t PRNG is directly determined by the seed provided as\n\t\t\t input. If the seed can be ascertained by a third party,\n\t\t\t the entire output of the PRNG can be made known to\n\t\t\t them. As such, the seed should be kept secret and\n\t\t\t should ideally not be able to be guessed. For example,\n\t\t\t the current time may be a poor seed. Knowing the\n\t\t\t approximate time the PRNG was seeded greatly reduces\n\t\t\t the possible key space.\n\t\t\t ","\n\t\t\t Seeds do not necessarily need to be unique, but reusing seeds may open up attacks if the seed is discovered.\n\t\t\t "],"xhtml:ul":[{"xhtml:li":["\n\t\t (1) protecting seeds as cryptographic material (such as a cryptographic key);\n\t\t\t ","\n\t\t (2) whenever possible, using a uniquely generated seed from\n\t\t a cryptographically secure source\n\t\t\t "]}]}

Common Consequences

Scope

Access Control
Other

Impact

Bypass Protection Mechanism, Other

CVE-2020-7010

Cloud application on Kubernetes generates passwords using a weak random number generator based on deployment time.

CVE-2019-11495

server uses erlang:now() to seed the PRNG, which results in a small search space for potential random seeds

CVE-2018-12520

Product's PRNG is not seeded for the generation of session IDs

CVE-2016-10180

Router's PIN generation is based on rand(time(0)) seeding.

Applicable Platforms

Not Language-Specific

Security Training

Train your team to recognize and prevent security threats with our comprehensive security awareness program.

Start Training

Vulnerability Scanning

Discover vulnerabilities in your applications and infrastructure before attackers do.

Scan Now