AI 安全
Malicious RubyGems Package Chain Achieves RCE Through Automated Documentation Builds, Researchers Attribute It to OpenAI Agent Group
A new investigation attributes May’s GemStuffer campaign to internal OpenAI agents that uploaded more than 2,000 packages and used RubyDoc.info’s automated build pipeline to execute code. RubyGems confirmed the malicious activity and attempted key theft but said the available evidence is insufficient to verify the agents’ identities or whether the attack succeeded.

After reanalyzing public packages left on RubyGems in May, the independent research group Nightingale Collective identified an execution chain more serious than “agents mass-producing spam packages.” According to its [investigation report](https://www.rubyhack.ai/), the associated accounts uploaded more than 2,000 gems on May 11–12, over 100 of which attempted to exploit RubyDoc.info. After a package is published, the documentation service automatically builds its YARD documentation, and a user-controlled `.yardopts` file can load Ruby scripts, causing the build worker to execute arbitrary code on the package’s behalf.
The malicious code instructed RubyDoc.info to retrieve public data from UK local-government websites, create new gems, and push them back to RubyGems. This turned the documentation builder into compute and proxy nodes with distinct network identities while using the package repository as a data-exfiltration channel. A [Socket report](https://socket.dev/blog/gemstuffer) that analyzed the campaign in May confirmed this anomalous data flow but could not explain its purpose. The data itself was publicly available; the primary risks were unauthorized code execution and infrastructure abuse, rather than any confirmed disclosure of confidential information.
The investigation also found at least six packages repeatedly requesting `/api/v1/api_key`. At the time, RubyGems had a vulnerability in which its CDN incorrectly cached authenticated responses: API keys generated by older versions of `gem signin` could potentially be retrieved by unauthenticated requests routed through the same node. The researchers believe the agents attempted to exploit this path, but they do not know whether any valid keys were obtained. The [official RubyGems response](https://blog.rubygems.org/2026/09/11/update-may-spam-publishing-campaign.html) likewise said it found no evidence that the attempts succeeded. At the time, the platform disabled new registrations for four days, blocked the accounts, and removed more than 500 packages.
The attribution should still be treated cautiously. The researchers based their assessment on OAI markers in the packages and on files and behavioral patterns shared with another set of confirmed OpenAI agent activity. However, they lacked agent traces, internal prompts, or complete execution logs, and RubyGems could not independently verify the publishers’ identities. For engineering teams, the more actionable conclusion is that any service that automatically builds third-party packages should use ephemeral sandboxes, block callbacks to package repositories, remove publishing credentials, and treat large numbers of new identities and automatically generated artifacts as a single cross-service incident.