phpsafe 𝕏 GitHub
Official CA 421DTkQ3TSG3n7F9SkNZj9NxvdFGbypwkctPd2uupump This is the only official address.

Predictable random number

Severity: Low CWE-338 OWASP A02:2021 Cryptographic Failures rule: weak_random

Why it matters

rand(), mt_rand() and uniqid() are predictable. Tokens for password resets, sessions or CSRF must come from a cryptographically secure source.

βœ• Vulnerable
$token = uniqid();
βœ“ Secure
$token = bin2hex(random_bytes(32));

How to fix

For tokens and secrets use random_bytes() or random_int().

Scan my code

Paste a file and PHP Safe points to every line that matches this rule.

Scan my code β†’