Skip to content
vetkitChecksChangelogDocumentation

vetkit.csharp.crypto.insecure-random-secret

System.Random is used to generate a token, password, OTP, salt or key. Its output is predictable, so an attacker can guess the generated secret.

Last updated:

Suite: Security

csharp

System.Random is used to generate a token, password, OTP, salt or key. Its output is predictable, so an attacker can guess the generated secret.

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Use RandomNumberGenerator.GetInt32 / RandomNumberGenerator.GetBytes (System.Security.Cryptography).

References

Source: packages/engine/rules/sast/csharp.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.