CVE-2026-71851: Math Random In Crypto Random Generator

Math.random() is not a cryptographically secure random number generator. Using Math.random() in byte or key generation functions produces predictable values. Use crypto.getRandomValues() or crypto.randomBytes() instead.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0JS
greprules fetch cve-2026-71851-math-random-in-crypto-random-generator --engine opengrep

Description

Math.random() is not a cryptographically secure random number generator. Using Math.random() in byte or key generation functions produces predictable values. Use crypto.getRandomValues() or crypto.randomBytes() instead.