Insecure PRNG Seed
Overview
A PRNG seeded with predictable values produces predictable output. Attackers who know or can guess the seed can predict all subsequent random values, including:
- Session tokens and CSRFs
- Password reset tokens
- Cryptographic keys
- Nonces
Common bad seeds: time(), getpid(), hardcoded integers, zero.
Remediation
Use OS entropy sources for seeding or use CSPRNGs directly:
- Python:
secretsmodule,os.urandom() - Go:
crypto/rand - Node.js:
crypto.randomBytes() - Java:
SecureRandom()(default seeding is safe) - C/C++:
/dev/urandomorgetrandom()