{"id":"CVE-2021-4238","aliases":["AZL-41275","EUVD-2022-7482","GHSA-3839-6r69-m497","GHSA-xg2h-wx96-xgxr","GO-2022-0411","RHSA-2023:0540","UBUNTU-CVE-2021-4238"],"status":"published","title":"Insufficient randomness in github.com/Masterminds/goutils","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.","severity":{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-09","score":0.01408,"percentile":0.72815,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-331"],"published":"2021-05-21T16:26:06Z","modified":"2026-11-05T05:40:51Z","fixes":[{"ecosystem":"Go","package":"github.com/Masterminds/goutils","fixed_in":["1.1.1"],"sources":["ghsa","osv"]},{"ecosystem":"Azure Linux:3","package":"influxdb","fixed_in":["2.7.3-3"],"sources":["osv"]},{"ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh","fixed_in":["0:2.1.6-1.el8"],"sources":["osv"]},{"ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh-cni","fixed_in":["0:2.1.6-1.el8"],"sources":["osv"]},{"ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh-operator","fixed_in":["0:2.1.6-1.el8"],"sources":["osv"]},{"ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh-pilot-agent","fixed_in":["0:2.1.6-1.el8"],"sources":["osv"]},{"ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh-pilot-discovery","fixed_in":["0:2.1.6-1.el8"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"Go","package":"github.com/Masterminds/goutils","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.1.1"}]}]},{"source":"osv","ecosystem":"Azure Linux:3","package":"influxdb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.7.3-3"}]}]},{"source":"osv","ecosystem":"Go","package":"github.com/Masterminds/goutils","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.1.1"}]}]},{"source":"osv","ecosystem":"Go","package":"github.com/Masterminds/goutils","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.1.1"}]}]},{"source":"osv","ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0:2.1.6-1.el8"}]}]},{"source":"osv","ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh-cni","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0:2.1.6-1.el8"}]}]},{"source":"osv","ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh-operator","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0:2.1.6-1.el8"}]}]},{"source":"osv","ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh-pilot-agent","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0:2.1.6-1.el8"}]}]},{"source":"osv","ecosystem":"Red Hat:service_mesh:2.1::el8","package":"servicemesh-pilot-discovery","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0:2.1.6-1.el8"}]}]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"golang-github-masterminds-goutils","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1.1.1-2"]},{"source":"osv","ecosystem":"Ubuntu:24.04:LTS","package":"golang-github-masterminds-goutils","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1.1.1-4"]},{"source":"osv","ecosystem":"Ubuntu:25.10","package":"golang-github-masterminds-goutils","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1.1.1-4"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"golang-github-masterminds-goutils","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1.1.1-4"]},{"source":"osv","ecosystem":"Ubuntu:26.04:LTS","package":"golang-github-masterminds-goutils","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1.1.1-4"]}],"products":[{"vendor":"github.com/masterminds/goutils","product":"github.com/masterminds/goutils"},{"vendor":"goutils_project","product":"goutils"}],"references":[{"url":"https://github.com/Masterminds/goutils/commit/869801f20f9f1e7ecdbdb6422049d8241270d5e1","tags":["x_transferred","Patch","Third Party Advisory","fix","web","article","report"]},{"url":"https://pkg.go.dev/vuln/GO-2022-0411","tags":["x_transferred","Exploit","Patch","Third Party Advisory","fix","web","advisory","report"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-4238","tags":["web","advisory"]},{"url":"https://github.com/advisories/GHSA-3839-6r69-m497","tags":["advisory"]},{"url":"https://github.com/Masterminds/goutils/security/advisories/GHSA-xg2h-wx96-xgxr","tags":["web"]},{"url":"https://github.com/Masterminds/goutils/commit/f1923532a168b8203bfe956d8cd3b17ebece5982","tags":["web"]},{"url":"https://github.com/Masterminds/goutils/releases/tag/v1.1.1","tags":["web"]},{"url":"https://github.com/advisories/GHSA-xg2h-wx96-xgxr"},{"url":"https://github.com/Masterminds/goutils","tags":["package"]},{"url":"https://access.redhat.com/errata/RHSA-2023:0540","tags":["advisory"]},{"url":"https://access.redhat.com/security/updates/classification/#important","tags":["article"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2156729","tags":["report"]},{"url":"https://issues.redhat.com/browse/OSSM-2440","tags":["article"]},{"url":"https://security.access.redhat.com/data/csaf/v2/advisories/2023/rhsa-2023_0540.json","tags":["advisory"]},{"url":"https://access.redhat.com/security/cve/CVE-2021-4238","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2021-4238","tags":["advisory","report"]},{"url":"https://ubuntu.com/security/CVE-2021-4238","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2021-4238","title":"Insufficient randomness in github.com/Masterminds/goutils","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.","status":"published","published":"2022-12-27T21:13:50.373Z","modified":"2025-04-11T16:17:46.299Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"adp"}],"updated_at":"2026-11-02T14:33:07.697752Z"}],"euvd":[{"id":"EUVD-2022-7482","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.","status":"published","published":"2022-12-27T21:13:50Z","modified":"2025-04-11T16:17:46Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"updated_at":"2026-11-02T20:52:34.493984Z"}],"ghsa":[{"id":"GHSA-3839-6r69-m497","title":"Duplicate Advisory: GoUtils's randomly-generated alphanumeric strings contain significantly less entropy than expected","description":"## Duplicate Advisory\nThis advisory has been withdrawn because it is a duplicate of GHSA-xg2h-wx96-xgxr. This link is maintained to preserve external references.\n\n## Original Description\nRandomly-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.","status":"withdrawn","published":"2022-12-28T00:30:23Z","modified":"2026-01-23T22:51:29Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"cwes":["CWE-331"],"updated_at":"2026-11-02T14:39:19.525691Z"},{"id":"GHSA-xg2h-wx96-xgxr","title":"RandomAlphaNumeric and CryptoRandomAlphaNumeric are not as random as they should be","description":"### Impact\n\nA security-sensitive bug was discovered by Open Source Developer *Erik Sundell of Sundell Open Source Consulting AB*.\n\nThe 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.\n\nThis 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.\n\nThe 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.\n\n### Patches\n\nThis issue has been corrected in v1.1.1.\n\n### Workarounds\n\nIf 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`.)","status":"published","published":"2021-05-21T16:26:06Z","modified":"2026-01-23T22:52:02Z","cwes":["CWE-331"],"updated_at":"2026-11-02T14:39:19.525691Z"}],"nvd":[{"id":"CVE-2021-4238","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.","status":"published","published":"2022-12-27T22:15:12.073Z","modified":"2026-06-17T04:19:19.66Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"primary"},{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"secondary"}],"cwes":["CWE-331"],"updated_at":"2026-11-02T14:07:07.323379Z"}],"osv":[{"id":"AZL-41275","title":"CVE-2021-4238 affecting package influxdb for versions less than 2.7.3-3","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.","status":"published","published":"2022-12-27T22:15:12Z","modified":"2026-11-05T05:40:51Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"updated_at":"2026-11-05T16:41:19.893001Z"},{"id":"CVE-2021-4238","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.","status":"published","published":"2022-12-27T22:15:12.073Z","modified":"2026-10-20T10:54:04.513560618Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"updated_at":"2026-11-02T15:44:21.557945Z"},{"id":"GHSA-3839-6r69-m497","title":"Duplicate Advisory: GoUtils's randomly-generated alphanumeric strings contain significantly less entropy than expected","description":"## Duplicate Advisory\nThis advisory has been withdrawn because it is a duplicate of GHSA-xg2h-wx96-xgxr. This link is maintained to preserve external references.\n\n## Original Description\nRandomly-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.","status":"withdrawn","published":"2022-12-28T00:30:23Z","modified":"2026-09-10T03:49:50.235826783Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"cwes":["CWE-331"],"updated_at":"2026-11-02T15:46:35.406455Z"},{"id":"RHSA-2023:0540","title":"Red Hat Security Advisory: Red Hat OpenShift Service Mesh 2.1.6 security update","status":"published","published":"2024-09-30T14:32:26Z","modified":"2026-10-14T10:02:25Z","cvss":[{"version":"3.1","score":7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L","level":"high"}],"updated_at":"2026-11-02T15:53:10.611604Z"},{"id":"UBUNTU-CVE-2021-4238","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.","status":"published","published":"2022-12-27T22:15:00Z","modified":"2026-10-17T12:56:15.606041017Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"},{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"updated_at":"2026-11-02T15:54:29.220315Z"},{"id":"GHSA-xg2h-wx96-xgxr","title":"RandomAlphaNumeric and CryptoRandomAlphaNumeric are not as random as they should be","description":"### Impact\n\nA security-sensitive bug was discovered by Open Source Developer *Erik Sundell of Sundell Open Source Consulting AB*.\n\nThe 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.\n\nThis 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.\n\nThe 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.\n\n### Patches\n\nThis issue has been corrected in v1.1.1.\n\n### Workarounds\n\nIf 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`.)","status":"published","published":"2021-05-21T16:26:06Z","modified":"2026-09-10T03:49:15.001142254Z","cwes":["CWE-331"],"updated_at":"2026-11-02T15:46:59.835583Z"},{"id":"GO-2022-0411","title":"Insufficient randomness in github.com/Masterminds/goutils","description":"Randomly-generated alphanumeric strings contain significantly less entropy than expected.\n\nThe 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.","status":"published","published":"2022-07-01T20:08:24Z","modified":"2026-02-04T03:14:48.656588Z","updated_at":"2026-11-02T15:47:00.918515Z"}]}}
