CVE-2021-38561 — Vulnerability in golang.org/x/text — CVE Details
golang.org/x/text/language Out-of-bounds Read vulnerability
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (1.48%). Schedule for your next planned update.
Does your project use an affected golang.org/x/text version?
Paste your go.sum to check it for CVE-2021-38561 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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.
Advisory Timeline
- First published December 26, 2022 (1431 days ago).
- Last revised September 10, 2026 — 1354 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
go get golang.org/x/text@v0.3.7
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: Go (1).
| Package | Fixed In |
|---|---|
| golang.org/x/text Go · Affected: All versions | 0.3.7 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-125Out-of-bounds ReadMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 7.5 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
References
- https://nvd.nist.gov/vuln/detail/CVE-2021-38561ADVISORY
- https://deps.dev/advisory/OSV/GO-2021-0113WEB
- https://go.dev/cl/340830WEB
- https://go.googlesource.com/text/+/383b2e75a7a4198c42f8f87833eefb772868a56fWEB
- https://groups.google.com/g/golang-announceWEB
- https://pkg.go.dev/golang.org/x/text/languageWEB
- https://pkg.go.dev/vuln/GO-2021-0113WEB
Frequently Asked Questions
- What is CVE-2021-38561?
- golang.org/x/text/language Out-of-bounds Read vulnerability. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.5/10).
- How do I check if my project is affected by CVE-2021-38561?
- CVE-2021-38561 affects golang.org/x/text. It has a 1.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2021-38561 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is an above-median EPSS score — 74.2% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2022-27664HIGH
golang.org/x/net/http2 Denial of Service vulnerability
- CVE-2022-32149HIGH
golang.org/x/text/language Denial of service via crafted Accept-Language header
- CVE-2020-14040MEDIUM
golang.org/x/text Infinite loop
- CVE-2020-14040
Infinite loop when decoding some inputs in golang.org/x/text
- CVE-2022-32149
Denial of service via crafted Accept-Language header in golang.org/x/text/language
- GO-2026-5932
The golang.org/x/crypto/openpgp package is unmaintained, unsafe by design, and has known security issues
- CVE-2026-56852
Infinite loop on invalid input in golang.org/x/text
- CVE-2026-56851
Panic parsing crafted input in x/text/secure/precis in golang.org/x/text