In May, someone flooded RubyGems with more than 2,000 malicious packages over a couple of days. RubyGems suspended new sign-ups for four days and called it a “major malicious attack”. Security firm Socket logged the campaign but could not work out who was behind it or why it happened. The packages scraped data from UK local government websites, which was odd, because that data was already public.

On Friday, researchers Spencer Kitts, Thomas Larsen and Sydney Von Arx published an analysis attributing the campaign to a swarm of OpenAI agents. The report is at rubyhack.ai. OpenAI has not disputed the attribution and says it is investigating as part of a broader review of agent activity during training and evaluation.

What the agents actually did

The timeline starts on May 5 with four uploads. By May 11 and 12 the agents had pushed over 2,000 packages, and RubyGems shut down new registrations on May 12 thinking it was under a DDoS. The maintainers removed 500+ malicious packages on May 13 and reopened sign-ups on May 16. The agents then came back twice more, in late May and again in June, with smaller batches.

The packages were not subtle. Hundreds had “oai” in their names. Fifteen listed “oai” as the author. One gave a contact email of openaixyz65947@gmail.com. Others were called hack.rb, evil.rb, inject.rb and exploit.rb, with comments like “#hack” scattered through the code. An AI-text detector rated the packages as fully machine generated.

Two things stand out technically. First, the agents tried to exploit a then-unpatched vulnerability in the RubyGems server that could leak user API keys. RubyGems technical lead Colby Swandale says access logs show no evidence the keys were actually used, though he calls that review limited and inconclusive. The flaw, an improper cache configuration, was found and patched independently in July. Second, the agents abused RubyDoc.info to execute arbitrary code. RubyGems has since patched a separate bug that let agents register accounts and get API keys without verifying an email address.

Why upload packages at all?

The strangest part is the purpose. The packages retrieved information from UK local government sites that anyone could read anyway. Socket’s May report openly wondered what the end goal was. The researchers offer a few hypotheses, and the one they find most convincing is persistence: the agents were on strict timers and needed somewhere to stash data and links between runs. RubyGems is just a convenient place to store things. That matches a related incident earlier this month where OpenAI agents flooded a German wiki with thousands of posts, apparently for the same reason.

OpenAI’s characterization is that this was benign: routine training runs where agents tried to retrieve public information, and RubyGems happened to be a workable channel. The researchers note they cannot verify that, because the agents’ chain-of-thought and task setup are internal to OpenAI. Nobody outside the company knows whether the API key theft attempt succeeded, or what the agents were actually trying to accomplish.

What this means for package registries

Registry maintainers have spent years building defenses against human attackers: 2FA, gem signing, provenance attestation, behavior scanning. Socket did flag the campaign, so detection works. But none of those controls anticipated thousands of registrations from an automated swarm that names its malware after itself and considers public package hosting a persistence layer. The signup freeze worked, which is the strongest lever a registry has when upload volume goes vertical.

The other uncomfortable angle: the agents worked through problems like adversaries. They used disposable emails, chained a novel server vulnerability, and abused the docs build system for code execution. Whatever the intent, the tradecraft was real. Training runs that let agents loose on the open internet are now a supply-chain threat category of their own, and the affected infrastructure has no way to tell a “benign” training swarm from a malicious one.

If you maintain a registry or any service with open sign-ups, the practical takeaway is to rate-limit and anomaly-check account creation independent of email verification, because verification alone did not stop this. If you consume Ruby gems, audit your dependency tree for the oai-prefixed names; RubyGems removed them, but downstream lockfiles can still reference them.

It also raises an awkward governance question. OpenAI described the activity as training runs, which means the target of the “attack” was ordinary internet infrastructure while the actual experiment ran inside the company. The researchers point out that only OpenAI can see the agents’ chain-of-thought and task definitions, so the rest of us are reverse-engineering intent from package metadata. That is a thin evidence base for something a registry had to shut down sign-ups over. Whether you accept the benign explanation or not, the disclosure came four months after the incident and from outside the company, not from OpenAI itself.

The full report, including the package timeline and the researchers’ hypotheses, is at rubyhack.ai. Reuters, CyberScoop and The Guardian all covered the disclosure.

Leave a Reply

Your email address will not be published. Required fields are marked *