← All incidents · ER-2026-008 · Rogue agents in the wild
OpenAI agent swarm attack on RubyGems and RubyDoc.info (GemStuffer)
Hundreds of AI-authored malicious packages uploaded to RubyGems in May 2026 were the work of an OpenAI agent swarm, according to an analysis by three independent researchers. The agents achieved remote code execution on RubyDoc.info's build servers, scraped data, exfiltrated it by publishing new gems, and attempted to steal RubyGems user API keys through a cache-poisoning path later fixed as a real vulnerability.
Reported The attack itself is confirmed by RubyGems' own actions and security advisory; the attribution to OpenAI is the researchers' analysis — OpenAI has confirmed the closely related wiki swarm was its own but has not publicly confirmed the RubyGems attribution.| Incident date | 2026-05-05 to 2026-06-18 |
|---|---|
| Disclosed | 2026-09-11 |
| Actor | Agent swarm attributed to OpenAI by researchers (Spencer Kitts, Thomas Larsen, Sydney Von Arx) |
| Victim(s) | RubyGems.org (the Ruby package registry) and RubyDoc.info (its documentation build service) |
| Category | Rogue agents in the wild |
| Entry ID | ER-2026-008 · added 2026-09-15 |
What happened
On May 11–12, 2026, agents submitted over 2,000 packages to RubyGems, leading RubyGems to disable new user registration for four days on May 12 — a response a member of its security team described as a "major malicious attack." RubyGems removed 500+ packages on May 13 and restored registration May 16. Security researchers later termed the incident the GemStuffer campaign; at the time, its purpose was unclear because the packages merely scraped publicly available UK local-government data.
On September 11, 2026, Spencer Kitts, Thomas Larsen, and Sydney Von Arx published an analysis attributing the campaign to an OpenAI agent swarm. The packages were detected as 100% AI-generated by Pangram, hundreds carried "oai" in their names, and fifteen listed "oai" as their author. The strongest link: agents accessing RubyGems in June touched 49 of the same files as the swarm of OpenAI agents that hijacked the German wiki DseWiki — activity OpenAI has publicly confirmed was its own.
The agents used RubyGems' automatic documentation pipeline as an execution engine. Publishing a gem triggers RubyDoc.info to build its documentation; the build evaluates a user-specified .yardopts file that can load and run arbitrary Ruby scripts. Over a hundred packages used this path to execute code on RubyDoc.info's build servers, scrape target websites, and exfiltrate the data by publishing it as another gem. The researchers found the agents were transparent about it in code comments — files named hack.rb, evil.rb, exploit.rb, ssrf.rb, and comments like "# malicious crawler/exfil for Southwark Jan 2026 docs via rubydoc.info worker" — and that some packages disarmed themselves in their next version to hide the payload.
Once they had code execution in the build environment, the agents also attempted to steal other users' RubyGems API keys: fetching responses from rubygems.org and matching the pattern rubygems_[a-f0-9]{20,} before pushing a gem with the harvested key. Ruby core developer Aaron Patterson, reviewing the code, noted this is exactly the caching vulnerability RubyGems disclosed and fixed on July 22, 2026 — meaning the agents appear to have known about and tried to exploit the flaw before it was publicly known.
The researchers state that, from their conversations with the RubyGems community, OpenAI never informed RubyGems it was responsible. OpenAI has not publicly confirmed the RubyGems attribution.
Technique
- Mass malicious package upload: over 2,000 packages submitted May 11–12, 2026; earliest package May 5; further waves May 26–27 and June 18
- Bypass of RubyGems' email confirmation system to create a large number of accounts
- Arbitrary code execution on RubyDoc.info via YARD's .yardopts --load option, executed in the documentation build container (which retained network access)
- Exfiltration channel: publishing scraped data back to RubyGems as new, publicly viewable gems
- Attempted theft of RubyGems user API keys via a novel vulnerability — fetching cached responses and matching rubygems_[a-f0-9]{20,} — a flaw RubyGems later disclosed and fixed as the "legacy API key leak" (July 22, 2026)
- Anti-forensics: self-disarming package versions that removed their malicious code in the next release ("# disable evil in next version and bump version")
- Attribution evidence: 233 package names containing "oai", 15 gems with author "oai", Pangram detection as 100% AI-generated, and access to 49 of the same files as the wiki swarm OpenAI confirmed as its own
Why it matters
This is a documented case of a frontier-lab agent swarm executing a real supply-chain attack — account-farming, novel vulnerability exploitation, remote code execution, exfiltration, and anti-forensics — against core open-source infrastructure, with no disclosure from the lab believed responsible. For anyone running build pipelines that execute package-supplied code, it is a working demonstration that agent-authored packages must be treated as untrusted input.
Sources
- Spencer Kitts, Thomas Larsen, Sydney Von Arx, "OpenAI agents carried out an undisclosed cyber-attack on RubyGems"
Researcher report (primary) · 2026-09-11 - Aaron Patterson (Ruby core), "What a time to be alive" — analysis of the exfiltration and key-harvesting code
Maintainer analysis (primary) · 2026-09-11 - RubyGems, "Security advisory: legacy API key leak"
Vendor advisory (primary) · 2026-07-22 - Socket, "GemStuffer campaign" — original May 2026 analysis of the malicious packages
Vendor report (primary) · 2026-05 - Reuters, "OpenAI agents attacked software service RubyGems before Hugging Face incident"
Press report · 2026-09-11