C#

C#

Made by DeepSource

Audit required: Insecurely generated random number CS-A1008

Security
Critical
a02 cwe-326 cwe-338 cwe-330 cwe-1241 sans top 25 owasp top 10

Random is a pseudo-random number generator, which is an algorithm that produces a sequence of numbers that meet certain statistical requirements for randomness. Because the number generated is not random enough for sensitive operations, consider using RandomNumberGenerator from System.Security.Cryptography namespace instead.

Bad Practice

var random = new Random();

Recommended

var randomGenerator = RandomNumberGenerator.Create();

Reference