Supply Chain Attacks in the Golang Open-Source Ecosystem

  • By David Abram
Supply Chain Attacks in the Golang Open-Source Ecosystem

A Wake-Up Call for Go Developers: Supply Chain Attacks in the Open-Source Ecosystem

If you’ve been paying attention to software security news lately, you’ve probably heard about the Go Module Mirror serving a backdoored package for over three years.

Yeah, you read that right… three years. The attack leveraged a typo-squatted package and a fundamental flaw in how Go’s module proxy caches dependencies.

Thanks to Socket’s excellent article, we can dig a bit deeper into this attack.

The Anatomy of the Attack

Here’s what went down:

Attackers created a typo-squatted package named boltdb-go/bolt instead of the legitimate and widely used boltdb/bolt, deceiving thousands of developers. They then uploaded a malicious version of this package to GitHub, embedding a hidden remote access mechanism. The Go Module Mirror, designed for caching packages , inadvertently cached and stored the malicious version.

After ensuring the malicious package was cached, the attackers quietly rebased the repository back to a clean version, misleading manual reviewers into believing everything was safe. Developers continued unknowingly installing the compromised version because the Go Module Mirror never verified subsequent updates to cached packages, allowing the attack to be undetected for years.

This is a textbook case of a supply chain attack. It’s an attack that poisons the well that many developers drink from. The attacker injects malicious code at the package level and waits for unsuspecting developers to install it.

The Trust in Open Source

The core issue here is that our entire industry is built on the assumption that package managers and mirrors will “just work” safely.

But here’s the uncomfortable truth: we’re outsourcing trust to systems that weren’t built with security as a first-class concern.

Go’s module proxy is designed for performance and availability, not security. Once a package version is cached, it stays available, even if the original source is later modified or removed. That’s great for reliability but terrible when an attacker exploits it to persist malicious code for years.

This isn’t just a Go problem. We’ve seen similar attacks across npm, PyPI, and Cargo. The pattern is the same: developers rely on third-party dependencies, package managers optimize for performance over security, and attackers take advantage of it.

What you can do right now

It’s easy to say “just audit your dependencies,” but let’s be real, no one is manually checking every package they install. So, what practical steps can we take?

  • Go’s default module proxy has no built-in malware scanning. Consider using tools like Socket, deps.dev, or any other dependency analysis tools.

  • Instead of relying on latest package version, explicitly define which version you should be using. This won’t prevent all attacks, but it limits exposure.

  • Run automated dependency analysis like govulncheck, npm audit, or pip-audit. These tools won’t catch everything but provide an extra layer of defense.

  • Use checksums and signature verification where possible. If your build pipeline supports it, enforce checksum verification on dependencies.

The Bigger Picture

This incident is another wake-up call for the entire software industry.

We can’t blindly trust third-party code, even when it’s hosted on official mirrors.

Supply chain security is a real-world problem that has already led to major breaches and compromises.

Google has since removed the malicious package and added it to the Go vulnerability database, but the damage is already done. This attack reminds us that while Go, Rust, Python, and JavaScript all have safeguards to prevent classic memory safety issues, the real risk is in the dependencies we import without question.

Just because a package is widely used doesn’t mean it’s safe. It’s on us, developers, to be more proactive about security.

Stay safe out there, and check your dependencies before shipping.

Supply Chain Attacks in the Golang Open-Source Ecosystem
David Abram

Spends his time untangling software architectures and doing DevOps. Likes to build stuff.
Connect with David on X and LinkedIn. You can also Book a meeting with David.

Recommended posts

  1. GitOps: Is it the Right Choice for Your DevOps in 2023?

    GitOps: Is it the Right Choice for Your DevOps in 2023?

  2. What is cycle time in Software Development?

    What is cycle time in Software Development?

  3. No, you shouldn't measure developer productivity..

    No, you shouldn't measure developer productivity..