UnratedGoPublished
RandomAlphaNumeric and CryptoRandomAlphaNumeric are not as random as they should be
CVE-2021-4238 · GHSA-xg2h-wx96-xgxr
- Affected
- Go github.com/Masterminds/goutils < 1.1.1
- Fixed in
- 1.1.1· Vendor fix available
- Issue
- Impact A security-sensitive bug was discovered by Open Source Developer Erik Sundell of Sundell Open Source Consulting AB. The functions RandomAlphaNumeric(int) and CryptoRandomAlphaNumeric(int) are not as random as they should be. Small values of int in the functions above will return a smaller subset of results than they should. For example, RandomAlphaNumeric(1) will always return a digit in the 0-9 range, while RandomAlphaNumeric(4) will return around ~7 million of the ~13M possible permutations. This is considered a security release because programs that rely upon random generators for passwords are at an increased risk of brute force-style password guessing. There is also a higher probability of collision. The problem was the result of a mistaken regular expression that only accepted random strings if they contained a digit from [0-9]. That restriction has been removed. Patches This issue has been corrected in v1.1.1. Workarounds If you cannot upgrade to v1.1.1, you can work…
Recommended action: Upgrade to 1.1.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.