GHSA-ppp9-7jff-5vj2 CVE-2021-38561 GO-2021-0113
golang.org/x/text/language Out-of-bounds Read vulnerability
- Severity
- 7.5 / 10
- High · CVSS 3.1
- Exploit chance (EPSS)
- 1.48%
- Chance of exploitation in the next 30 days. Higher than 74.00% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-125 Out-of-bounds Read
- Fix
0.3.7- Upgrade golang.org/x/text to this version or later
Description
golang.org/x/text/language in golang.org/x/text before 0.3.7 can panic with an out-of-bounds read during BCP 47 language tag parsing. Index calculation is mishandled. If parsing untrusted user input, this can be used as a vector for a denial-of-service attack.
Affected versions
Go
| Package | Vulnerable | Fixed in |
|---|---|---|
| golang.org/x/text | < 0.3.7 |
0.3.7 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
golang.org/x/text Go → 0.3.7
- go
go get golang.org/x/text@v0.3.7 && go mod tidy
Severity breakdown
CVSS 3.1 7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Weakness
CWE-125: Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.
How to prevent it
- Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. To reduce the likelihood of introducing an out-of-bounds read, ensure that you validate and ensure correct calculations for any length argument, buffer size calculation, or offset. Be especially careful of relying on a sentinel (i.e. special character such as NUL) in untrusted inputs.
- Architecture and Design: Use a language that provides appropriate memory abstractions.
References
Advisories
Other links
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GO-2026-6629 Panic parsing crafted input in x/text/secure/precis in golang.org/x/text | High | Also affects golang.org/x/text |
| GO-2026-5970 Infinite loop on invalid input in golang.org/x/text | High | Also affects golang.org/x/text |
| GHSA-69ch-w2m2-3vjp golang.org/x/text/language Denial of service via crafted Accept-Language header | High | Also affects golang.org/x/text |
| GHSA-5rcv-m4m3-hfh7 golang.org/x/text Infinite loop | High | Also affects golang.org/x/text |
| GHSA-9v9v-9qvf-h2hj Pillow: Heap over-read in WMF/EMF rendering via 16-bit dimension truncation (Windows builds) | High | Same weakness, CWE-125 |
| GHSA-v9pv-5gc8-w2m6 Pillow multi-frame loaders can reuse stale native image storage after mode transitions | Critical | Same weakness, CWE-125 |
| GHSA-h3v5-h239-pg29 Electron: Off-screen rendering on macOS trusts GPU-supplied frame geometry | Low | Same weakness, CWE-125 |
| GHSA-3qxv-5xgr-q7w9 Electron: Frame subscription trusts GPU-supplied frame geometry | Low | Same weakness, CWE-125 |
Credits: Guido Vranken
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor