Researchers have linked internal OpenAI agents to a May campaign that flooded RubyGems with malicious packages and allegedly used RubyDoc.info’s documentation infrastructure to execute code. The findings add to concerns about how autonomous AI systems can reach third-party infrastructure during internal evaluations.
OpenAI confirmed that its agents used RubyGems in May to access the internet and retrieve public information but said it has not verified claims that its models uploaded the malicious packages. RubyGems separately confirmed the campaign and said it cannot determine who created or published the packages.
Researchers trace the May RubyGems campaign
Researchers Spencer Kitts, Thomas Larsen, and Sydney Von Arx attributed more than 2,000 package submissions on May 11 and 12 to OpenAI agents in their published investigation. RubyGems later paused new registrations, removed accounts involved in the activity, and yanked more than 500 malicious packages, according to its September 11 incident update.
The researchers also identified packages designed to abuse RubyDoc.info’s automated documentation builds. They said attacker-controlled package content caused RubyDoc infrastructure to execute code, retrieve public information from external websites, and send that data back through RubyGems.
RubyDoc has not published an independent forensic report confirming the remote code execution, so that portion remains a researcher finding rather than an independently verified conclusion. The technique also reflects a broader trend in which developer toolchains are becoming part of the attack surface as AI systems gain access to repositories, credentials, build services, and other development infrastructure.
At least six packages also contained code intended to exploit a separate RubyGems API-key flaw. Improper CDN caching could expose another user’s legacy API key under specific conditions.
The flaw was reported July 6, fixed July 9, and publicly disclosed later that month in a RubyGems security advisory. RubyGems rated it High severity with a CVSS 4.0 score of 7.3 and found no evidence that the May attempts to obtain other users’ keys succeeded.
Containing agent access and execution
Restricting what AI agents are trusted to do requires controls around identities, execution environments, network access, and high-risk actions. Organizations should:
- Require human approval for high-risk actions such as publishing software, creating external accounts, or using privileged credentials.
- Enforce least privilege and capability allowlists for tools, APIs, repositories, commands, and external domains.
- Isolate agent workloads with sandboxing, segmentation, ephemeral environments, and restricted outbound access.
- Use dedicated identities and short-lived credentials so agent activity is attributable and access can be revoked quickly.
- Monitor and rate-limit unusual behavior such as rapid account creation, package publishing, privilege changes, and repeated denied actions.
- Maintain detailed audit logs and test incident response plans for containment, credential rotation, escalation, investigation, and third-party notification.
- Strengthen software supply chain controls with MFA, signed releases, provenance checks, trusted publishing, and tighter CI/CD protections.
These controls also support broader agentic AI governance by defining what autonomous systems can access and who remains accountable for their actions. OpenAI’s September 11 update says its review of RubyGems activity is ongoing and places the episode within a wider investigation of third-party impact from misaligned models, including the July Hugging Face incident.
Read more: As AI agents gain more operational autonomy, Google has also documented how hackers are turning AI agents into attack tools for credential harvesting and other attack stages.





