Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulnerability in golang.org/x/text v0.3.0 #419

Closed
alanbernstein opened this issue Mar 4, 2022 · 3 comments
Closed

Vulnerability in golang.org/x/text v0.3.0 #419

alanbernstein opened this issue Mar 4, 2022 · 3 comments

Comments

@alanbernstein
Copy link

I'm trying to resolve a vulnerability with golang.org/x/text, in my project, by eliminating the offending version from my go.sum file (as required by a security scan tool). To understand the reason that I have this transitive dependency, I experimented with removing that go.sum line manually, then running golangci-lint, which showed me this:

$ golangci-lint run
ERRO Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: github.com/rs/zerolog@v1.26.1 requires
	golang.org/x/tools@v0.1.7 requires
	golang.org/x/mod@v0.4.2 requires
	golang.org/x/crypto@v0.0.0-20191011191535-87dc89f01550 requires
	golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3 requires
	golang.org/x/text@v0.3.0: missing go.sum entry; to add it:
	go mod download golang.org/x/text
go: github.com/rs/zerolog@v1.26.1 requires
	golang.org/x/tools@v0.1.7 requires
	golang.org/x/mod@v0.4.2 requires
	golang.org/x/crypto@v0.0.0-20191011191535-87dc89f01550 requires
	golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3 requires
	golang.org/x/text@v0.3.0: missing go.sum entry; to add it:
	go mod download golang.org/x/text

I'm not too familiar with how the go mod system reports or manages these golang.org/x transitive dependencies, but in case this is accurate, I wanted to report this vulnerability in zerolog. I'm happy to help resolve this, with some advice.

From https://nvd.nist.gov/vuln/detail/CVE-2020-14040:

The x/text package before 0.3.3 for Go has 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.

There is a similar issue with the golang.org/x/crypto package: https://nvd.nist.gov/vuln/detail/CVE-2020-29652. This requires v0.0.0-20201203163018-be400aefbc4c or later. Resolving this one may cover the golang.org/x/text one.

(Also, thanks for the great library)

@alanbernstein
Copy link
Author

I've fixed this in my project with e.g. replace golang.org/x/text => golang.org/x/text v0.3.6. Feel free to close with or without resolving.

@drakkan
Copy link
Contributor

drakkan commented Mar 9, 2022

Hi,

I think this was already fixed in #389. So you have to wait for the next release

@alanbernstein
Copy link
Author

That looks right, thanks @drakkan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants