Delphi : Weak random number generator
Classification
Overview
Used pseudorandom number generator (PRNG) is not secure, since it generates a predictable sequence. This can be exploited to bypass authentication and capture the user’s session, as well as to carry out the DNS cache poisoning attack.
PRNGs generate chains of numbers based on the initial value referred to as seed. There are two types of PRNGs: statistical and cryptographic. Statistical PRNGs generate predictable sequences that are similar to truly random according to the statistical characteristics. They must not be used for security purposes. On the contrary, it is impossible to predict the output of a cryptographic PRNG, if the seed value is derived from a source with high entropy. Using current time as seed value is insecure due to low entropy.
Delphi functions Random, RandomRange generate predictable sequences and must not be used in information security context.
Sensitive Data Exposure vulnerabilities take the third place in the “OWASP Top 10 2017” web-application vulnerabilities ranking.
References
- OWASP: Insecure randomness
- CWE-330: Use of Insufficiently Random Values
- CERT: MSC02-J. Generate strong random numbers
- Some SecureRandom Thoughts - Alex Klyubin / Android Developers Blog
- Random
- Are there any cryptographically secure PRNG libraries for Delphi?
- OWASP Top 10 2017-A3-Sensitive Data Exposure
- CWE CATEGORY: OWASP Top Ten 2017 Category A6 - Security Misconfiguration
- CWE-338
