Insecure PRNG Seed

Detects cryptographic operations where pseudo-random number generators are seeded with predictable values.

zakirkun Updated

File contents

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: secrets module, os.urandom()
  • Go: crypto/rand
  • Node.js: crypto.randomBytes()
  • Java: SecureRandom() (default seeding is safe)
  • C/C++: /dev/urandom or getrandom()

zakirkun/ice-tea/tree/main/skills/crypto/insecure-prng-seed commit 5b821722c3

Frequently asked questions

npx skillmds@latest add zakirkun/insecure-prng-seed