A Pseudo-Random Number Generator (PRNG) uses the same seed each time the product is initialized.
Given the deterministic nature of PRNGs, using the same seed for each initialization will lead to the same output in the same order. If an attacker can guess (or knows) the seed, then the attacker may be able to determine the random numbers that will be produced from the PRNG.
Threat Mapped score: 0.0
Industry: Finiancial
Threat priority: Unclassified
CVE: CVE-2022-39218
SDK for JavaScript app builder for serverless code uses the same fixed seed for a PRNG, allowing cryptography bypass
N/A
N/A
Phase | Note |
---|---|
Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |
Intro: The following code uses a statistical PRNG to generate account IDs.
Body: Because the program uses the same seed value for every invocation of the PRNG, its values are predictable, making the system vulnerable to attack.
private static final long SEED = 1234567890; public int generateAccountID() { Random random = new Random(SEED); return random.nextInt(); }
Intro: This code attempts to generate a unique random identifier for a user's session.
Body: Because the seed for the PRNG is always the user's ID, the session ID will always be the same. An attacker could thus predict any user's session ID and potentially hijack the session.
function generateSessionID($userID){ srand($userID); return rand(); }