Go Supply Chain Attack: Malicious Package Exploits Go Module Proxy Caching For
A malicious typosquat of the BoltDB Go module was published and cached by the Go Module Proxy, then its git tags were rewritten to point at clean code so manual review found nothing. Anyone installing the cached version got a backdoor that connected to a command server and ran arbitrary shell commands on the host.
socket.dev
Published on socket.dev
Threat ResearchSecurity News
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Go Module Proxy's indefinite caching of an immutable module version, combined with a typosquatted module name, meant the malicious code stayed served after the upstream git tags were rewritten to benign code.
Impact
Any system that installed the cached package could be remotely controlled, with the backdoor executing arbitrary shell commands and restarting itself if it failed; the text says the deception went undetected for over three years.
What the attacker needed
Developer installs the typosquatted module; module already cached by the Go proxy; backdoor triggers on calling Open()
The fix
The text states this is not a vulnerability and there is no patch; developers should verify package integrity and inspect the code actually installed rather than the repository.
How it was found
- Create a Go package whose name closely resembles the legitimate boltdb/bolt package.
- Publish it so the Go Module Proxy fetches and caches it on first request.
- After caching, rewrite the git tags in the source repository to point at a benign version.
- Rely on the proxy continuing to serve the cached malicious version to developers using the go CLI.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A developer can pull a Go library by name, and a near-identical name can trick them into pulling the wrong one. The official Go package mirror keeps a permanent copy of whatever it first downloads, so even after the attacker tidied up the public repository, the mirror kept handing out the bad copy. The bad copy quietly opened a connection to the attacker's server and ran whatever commands it was sent.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.