GHSA-5rcv-m4m3-hfh7 CVE-2020-14040 GO-2020-0015
golang.org/x/text Infinite loop
- Severity
- 7.5 / 10
- High · CVSS 3.1
- Exploit chance (EPSS)
- 1.84%
- Chance of exploitation in the next 30 days. Higher than 78.99% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-400 Uncontrolled Resource Consumption
- CWE-835 Loop with Unreachable Exit Condition ('Infinite Loop')
- Fix
0.3.3- Upgrade golang.org/x/text to this version or later
Description
Go version v0.3.3 of the x/text package fixes a vulnerability in encoding/unicode that could lead to the UTF-16 decoder entering an infinite loop, causing the program to crash or run out of memory. An attacker could provide a single byte to a UTF16 decoder instantiated with UseBOM or ExpectBOM to trigger an infinite loop if the String function on the Decoder is called, or the Decoder is passed to golang.org/x/text/transform.String.
Specific Go Packages Affected
golang.org/x/text/encoding/unicode golang.org/x/text/transform
Affected versions
Go
| Package | Vulnerable | Fixed in |
|---|---|---|
| golang.org/x/text | < 0.3.3 |
0.3.3 |
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.3
- go
go get golang.org/x/text@v0.3.3 && 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/E:P/RL:O/RC:C
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- None
- Availability
- High
- Exploit maturity
- Proof of concept
Weakness
CWE-400: Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource.
How to prevent it
- Architecture and Design: Design throttling mechanisms into the system architecture. The best protection is to limit the amount of resources that an unauthorized user can cause to be expended. A strong authentication and access control model will help prevent such attacks from occurring in the first place. The login application should be protected against DoS attacks as much as possible. Limiting the database access, perhaps by caching result sets, can help minimize the resources expended. To further limit the potential for a DoS attack, consider tracking the rate of requests received from users and blocking requests that exceed a defined rate threshold.
- Architecture and Design: Mitigation of resource exhaustion attacks requires that the target system either: recognizes the attack and denies that user further access for a given amount of time, or uniformly throttles all requests in order to make it more difficult to consume resources more quickly than they can again be freed. The first of these solutions is an issue in itself though, since it may allow attackers to prevent the use of the system by a particular valid user. If the attacker impersonates the valid user, they may be able to prevent the user from accessing the server in question. The second solution is simply difficult to effectively institute -- and even when properly done, it does not provide a full solution. It simply makes the attack require more resources on the part of the attacker.
- Architecture and Design: Ensure that protocols have specific limits of scale placed on them.
- Implementation: Ensure that all failures in resource allocation place the system into a safe posture.
CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
References
Advisories
Other links
- github.com/golang/go/issues/39491
- github.com/golang/text/commit/23ae387dee1f90d29a23c0e87ee0b46038fbed0e
- go-review.googlesource.com/c/text/+/238238
- go.dev/cl/238238
- go.dev/issue/39491
- go.googlesource.com/text/+/23ae387dee1f90d29a23c0e87ee0b46038fbed0e
- groups.google.com/forum
- groups.google.com/g/golang-announce/c/bXVeAmGOqz0
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TACQF…
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-ppp9-7jff-5vj2 golang.org/x/text/language Out-of-bounds Read vulnerability | High | Also affects golang.org/x/text |
| GHSA-cggf-277g-3q54 pypdf has possible large memory usage when parsing page tree | High | Same weakness, CWE-400 |
| GHSA-3g3m-2fjr-6pw4 Glob: AbortSignal cancellation bypass allows post-timeout filesystem traversal | Medium | Same weakness, CWE-400 |
| GHSA-42gh-23hr-vphw pypdf has possible long runtimes when retrieving page labels | High | Same weakness, CWE-400 |
| GHSA-4vqv-7265-gm2w pypdf has possible large memory usage for exceptions in strict mode | High | Same weakness, CWE-400 |
Credits: @abacabadabacaba, Anton Gyllenberg
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