SiteShadow
Back to vulnerability library

CWE-334 Small Space of Random Values

What this means

SiteShadow flagged random values that come from too small a space (too few possibilities) or are generated in a predictable way. This is common with short numeric codes, small-token IDs, or PRNGs not meant for security.

Why it matters

Small or predictable random values can be guessed.

Safer examples

1) Use cryptographically secure random generators

import secrets

token = secrets.token_urlsafe(32)  # ~256 bits
import { randomBytes } from "crypto";

const token = randomBytes(32).toString("base64url");

2) If you use short codes, compensate

Short codes (e.g., 6 digits) need strong rate limits, expiry, and attempt caps.

3) Ensure enough entropy for the use case

Session/auth tokens should be high entropy (e.g., 128–256 bits), not "8 chars".

How SiteShadow detects it (high level)

References

---

← Back to Vulnerability Library

Request access View coverage