Skip to main content
RubyGems Typosquatting: How 16 Packages Stole CredentialsResearch
4 min readFor Security Engineers

RubyGems Typosquatting: How 16 Packages Stole Credentials

The Challenge

On August 15, 2026, OpenSourceMalware discovered 16 malicious packages in the RubyGems repository, all designed to steal browser credentials and cryptocurrency wallets. The attackers didn't exploit a zero-day or breach RubyGems' infrastructure. They used typosquatting combined with namespace reuse.

The attack succeeded because RubyGems makes a namespace available once all versions of a gem are removed. An attacker monitoring popular packages can wait for a maintainer to remove their gem, then immediately claim that namespace with malicious code. Developers who type gem install poplar-sdk instead of popular-sdk don't get an error. They get credential theft.

The malicious packages used an extconf.rb hook to trigger execution during installation. Your team doesn't need to run the code. Installing the package is enough.

The Environment and Constraints

RubyGems operates in an ecosystem where speed matters more than verification. The platform doesn't validate author fields, so attackers can impersonate legitimate maintainers. There's no mandatory code signing. Package names are first-come, first-served, with no reserved namespace for popular packages.

Your dependency management tools don't help much here. Bundler will install a typosquatted package if it's in your Gemfile. Your CI/CD pipeline won't flag it unless you've implemented specific supply chain controls.

The attack surface is broader than you think. According to OpenSourceMalware research, the malicious packages targeted multiple popular gems, betting that developers would make typos during installation or when updating their Gemfile. Each package contained the same credential-stealing payload, just wrapped in different namespace variations.

The Approach Taken

The RubyGems security team and OpenSourceMalware worked to identify and remove the malicious packages, but this reactive approach only addresses the immediate threat. The underlying vulnerabilities remain:

Namespace reuse: RubyGems' policy of releasing namespaces after yanking creates a window for attackers. The platform could implement a grace period or permanent namespace reservation for packages above a certain download threshold.

Unvalidated author fields: Without verification, attackers can claim to be anyone. GitHub's verified badge system shows one approach, but RubyGems doesn't require maintainers to prove ownership of the email addresses or organizations they claim.

Installation hooks: The extconf.rb mechanism is necessary for native extensions, but it executes arbitrary code during installation. There's no sandboxing, no permission model, and no warning to users.

For your team, detection depends on controls you implement yourself. You can't rely on RubyGems to prevent malicious packages from entering the repository.

Results and Metrics

The 16 packages were removed from RubyGems after discovery, but the attack demonstrates how easily credential theft can be embedded in package management systems. The extconf.rb hook executed during installation, giving attackers access before your team could even run the code.

The campaign tracked as "StubMaker" showed that attackers don't need sophisticated techniques. They need patience and an understanding of how developers work under pressure. A typo during a deployment, a copy-paste error in a Gemfile, or a developer who's installing packages late at night all create opportunities.

What Needs to Change

RubyGems needs structural changes, not just better incident response:

Namespace protection: Popular packages should have permanent namespace reservations. If a gem has more than 10,000 downloads or has been published for over a year, yanking shouldn't release the namespace. Attackers can't typosquat what they can't claim.

Author verification: Require maintainers to verify ownership through GitHub OAuth or domain verification. If a package claims to be from @rails, prove it.

Execution warnings: Installing a package that contains native extensions or installation hooks should trigger a clear warning. Developers need to know when they're about to run arbitrary code.

Typo detection: When you run gem install poplar-sdk, RubyGems could check for similar names and warn you: "Did you mean popular-sdk?" PyPI does this. RubyGems should too.

Takeaways for Your Team

You can't wait for RubyGems to fix these issues. Here's what you can implement now:

Lock your dependencies: Use Gemfile.lock and commit it to version control. This doesn't prevent the initial typo, but it prevents the malicious package from spreading across your team.

Audit installation scripts: Before adding a new gem, check if it contains extconf.rb or other installation hooks. If it does, review the code. Yes, this is tedious. Credential theft is worse.

Implement supply chain scanning: Tools like bundler-audit check for known vulnerabilities, but you need something that flags new packages or namespace changes. If popular-sdk suddenly has a new maintainer, your pipeline should block it.

Monitor your Gemfile: Set up alerts for changes to your dependencies. If someone adds a package at 2 AM, you want to know about it before it reaches production.

Verify package sources: When you're about to install a new gem, check the RubyGems page. Look at the maintainer, the download count, and the last update. A package with 47 downloads and a maintainer who joined yesterday should raise questions.

The RubyGems typosquatting campaign shows that supply chain attacks don't require nation-state resources. They require understanding how developers work and where package management systems fail. Your dependency chain is only as secure as your verification process, and right now, most teams don't have one.

If you're implementing SOC 2 Type II controls, this falls under CC6.1 (logical and physical access controls) and CC7.2 (system monitoring). For ISO 27001 compliance, you're looking at controls in Annex A 8.30 (outsourced development) and A 5.23 (information security for use of cloud services).

The next typosquatting campaign is already being planned. The question is whether your team will catch it before it runs.

Topics:Research

You Might Also Like