Property
Languagego
Severitymedium
CWECWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)
OWASPA02:2021 - Cryptographic Failures
Confidence LevelMedium
Impact LevelMedium
Likelihood LevelMedium

Description#

The code is using Go’s math/rand package to generate random numbers, which is not secure for cryptographic purposes. Instead, crypto/rand should be used to ensure randomness that can’t be easily predicted.

Impact#

If attackers can predict random values (such as session tokens, API keys, or passwords), they could hijack accounts or gain unauthorized access to sensitive data. This weak randomness undermines the security of cryptographic operations and can lead to serious breaches.