Every CVE Search/ Get API key

CVE-2021-4238

Insufficient randomness in github.com/Masterminds/goutils

9.1 CriticalFix available

Randomly-generated alphanumeric strings contain significantly less entropy than expected. The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
None
Availability
High

Exploit likelihood

1.41%Up 0.5 points since Dec 28, 2022
90%50%10%1%

What each source reports

NVD Score used 9.1

Randomly-generated alphanumeric strings contain significantly less entropy than expected. The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Record
CVE-2021-4238
CVSS 3.1
9.1 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Weakness
CWE-331
Updated
2026-11-02
CVE List 9.1

Insufficient randomness in github.com/Masterminds/goutils

Randomly-generated alphanumeric strings contain significantly less entropy than expected. The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Record
CVE-2021-4238
CVSS 3.1
9.1 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Updated
2026-11-02
EUVDEUVD-2022-7482 9.1

Randomly-generated alphanumeric strings contain significantly less entropy than expected. The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Record
EUVD-2022-7482
CVSS 3.1
9.1 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-3839-6r69-m497 9.1

Duplicate Advisory: GoUtils's randomly-generated alphanumeric strings contain significantly less entropy than expected

Duplicate Advisory

This advisory has been withdrawn because it is a duplicate of GHSA-xg2h-wx96-xgxr. This link is maintained to preserve external references.

Original Description

Randomly-generated alphanumeric strings contain significantly less entropy than expected. The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Record
GHSA-3839-6r69-m497
CVSS 3.1
9.1 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Weakness
CWE-331
Updated
2026-11-02
GitHub AdvisoriesGHSA-xg2h-wx96-xgxr No score

RandomAlphaNumeric and CryptoRandomAlphaNumeric are not as random as they should be

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 around the issue by calling RandomAlphaNumericCustom(N, true, true)|CryptoRandomAlphaNumericCustom(N, true, true) instead. (Where N is the desired length, and true is the literal boolean true.)

Record
GHSA-xg2h-wx96-xgxr
Weakness
CWE-331
Updated
2026-11-02
OSVAZL-41275 9.1

CVE-2021-4238 affecting package influxdb for versions less than 2.7.3-3

Randomly-generated alphanumeric strings contain significantly less entropy than expected. The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Record
AZL-41275
CVSS 3.1
9.1 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Updated
2026-11-05
Show 6 moreShow less
OSV 9.1

Randomly-generated alphanumeric strings contain significantly less entropy than expected. The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Record
CVE-2021-4238
CVSS 3.1
9.1 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Updated
2026-11-02
OSVGHSA-3839-6r69-m497 9.1

Duplicate Advisory: GoUtils's randomly-generated alphanumeric strings contain significantly less entropy than expected

Duplicate Advisory

This advisory has been withdrawn because it is a duplicate of GHSA-xg2h-wx96-xgxr. This link is maintained to preserve external references.

Original Description

Randomly-generated alphanumeric strings contain significantly less entropy than expected. The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Record
GHSA-3839-6r69-m497
CVSS 3.1
9.1 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Weakness
CWE-331
Updated
2026-11-02
OSVRHSA-2023:0540 7.0

Red Hat Security Advisory: Red Hat OpenShift Service Mesh 2.1.6 security update

Record
RHSA-2023:0540
CVSS 3.1
7.0 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L
Updated
2026-11-02
OSVUBUNTU-CVE-2021-4238 9.1

Randomly-generated alphanumeric strings contain significantly less entropy than expected. The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Record
UBUNTU-CVE-2021-4238
CVSS 3.1
9.1 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Updated
2026-11-02
OSVGHSA-xg2h-wx96-xgxr No score

RandomAlphaNumeric and CryptoRandomAlphaNumeric are not as random as they should be

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 around the issue by calling RandomAlphaNumericCustom(N, true, true)|CryptoRandomAlphaNumericCustom(N, true, true) instead. (Where N is the desired length, and true is the literal boolean true.)

Record
GHSA-xg2h-wx96-xgxr
Weakness
CWE-331
Updated
2026-11-02
OSVGO-2022-0411 No score

Insufficient randomness in github.com/Masterminds/goutils

Randomly-generated alphanumeric strings contain significantly less entropy than expected.

The RandomAlphaNumeric and CryptoRandomAlphaNumeric functions always return strings containing at least one digit from 0 to 9. This significantly reduces the amount of entropy in short strings generated by these functions.

Record
GO-2022-0411
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
github.com/Masterminds/goutils
Go
before 1.1.1
1.1.1
influxdb
Azure Linux:3
before 2.7.3-3
2.7.3-3
servicemesh
Red Hat:service_mesh:2.1::el8
before 0:2.1.6-1.el8
0:2.1.6-1.el8
servicemesh-cni
Red Hat:service_mesh:2.1::el8
before 0:2.1.6-1.el8
0:2.1.6-1.el8
servicemesh-operator
Red Hat:service_mesh:2.1::el8
before 0:2.1.6-1.el8
0:2.1.6-1.el8
servicemesh-pilot-agent
Red Hat:service_mesh:2.1::el8
before 0:2.1.6-1.el8
0:2.1.6-1.el8
servicemesh-pilot-discovery
Red Hat:service_mesh:2.1::el8
before 0:2.1.6-1.el8
0:2.1.6-1.el8
golang-github-masterminds-goutils
Ubuntu:22.04:LTS
All versions, plus listed versions
1.1.1-2
None known
golang-github-masterminds-goutils
Ubuntu:24.04:LTS
All versions, plus listed versions
1.1.1-4
None known
golang-github-masterminds-goutils
Ubuntu:25.10
All versions, plus listed versions
1.1.1-4
None known
golang-github-masterminds-goutils
Ubuntu:26.10
All versions, plus listed versions
1.1.1-4
None known
golang-github-masterminds-goutils
Ubuntu:26.04:LTS
All versions, plus listed versions
1.1.1-4
None known

History

History
RecordedChangedSources
factsOSV
affected
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-4238 is a critical vulnerability (CVSS 9.1) in Github.com/masterminds/goutils, published May 21, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.41%, the 72nd percentile. Fixed in github.com/Masterminds/goutils 1.1.1.

References

Show 11 moreShow less
MoveEnter Open