-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
What is the URL of the page with the issue?
https://pkg.go.dev/gonih.org/xzpoc
What is your user agent?
Mozilla/5.0 (X11; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0
Screenshot
(not super relevant)
What did you do?
I served a go-import meta-tag with vcs mod pointing at a personal proxy from gonih.org/xzpoc. The proxy is serving a valid, but "malicious" version of a package that contains a Greeting function returning the string "gotcha pwned".
It also contains a go-import meta-tag with vcs git pointing at a GitHub repo containing a module with the same package and API, but returning the string Hello world! from that function. The v1.0.0.info file points at the "clean" v1.0.0 tag and commit, even though the code contained in the v1.0.0.zip file does not match the content of that repository.
Here is a playground link to demonstrate what happens when that package is imported.
For your convenience, this is what is served by my "infected" proxy:
What did you see happen?
pkg.go.dev links to the "clean" version in the repository, both from the side-bar and in the individual links for the exported API, giving the impression that the module, when imported, will contain the "clean" code. But if anyone actually depends on that module, they will download and use the "malicious" version (regardless of whether they use the public mirror, or bypass it with GOPROXY=direct, as both will download the module from my "infected" proxy). It is only by inspecting the downloaded code, that they can detect the "malware".
What did you expect to see?
Some kind of indication, that the code in the repository does not accurately reflect the cached version.
