VBA : Weak random number generator
Classification
Overview
Used pseudorandom number generator (PRNG) is not secure since it generates predictable sequence. This can be exploited to bypass authentication and hijack the user’s session, as well as to carry out the DNS cache poisoning attack.
PRNGs generate number sequences based on the initial value of the seed. There are two types of PRNG: statistical and cryptographic. Statistical PRNGs generate predictable sequences, which are similar to random according to the statistical characteristics. They must not be used for security purposes. The result of the cryptographic PRNG, on the contrary, is impossible to predict if the value of seed is derived from a source with high entropy. The value of the current time has a small entropy and is also insecure as a seed.
Operator Random and function Rnd() classes generate predictable sequences and must not be used for information security purposes.
References
- SecureRandom - docs.oracle.com
- SecureRandom - developer.android.com
- 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
- OWASP Top 10 2017-A3-Sensitive Data Exposure
- CWE CATEGORY: OWASP Top Ten 2017 Category A6 - Security Misconfiguration
- CWE-338
