TL;DR: A covert storage and retrieval layer was used in the GemStuffer campaign, with 155 RubyGems package artifacts, hardcoded RubyGems API keys, and valid .gem archives carrying scraped data from UK council portals, according to Corgea. The pattern matters because package registries can be abused for outbound exfiltration and publishing abuse, not just dependency delivery.
At a glance
What this is: GemStuffer is a RubyGems registry-abuse campaign that used valid package archives as a covert exfiltration and storage layer for scraped web data.
Why it matters: It matters because package registries are bidirectional trust surfaces, so IAM, secrets, and release-governance controls must cover publishing as well as package consumption.
Context
GemStuffer is not a normal software supply-chain compromise. The issue is not simply malicious code hidden in a dependency, but the use of a trusted package registry as a storage and retrieval layer for scraped content, which changes how defenders should think about egress, publishing privileges, and audit trails.
For identity and access teams, the relevant boundary is between install-time trust and publish-time trust. RubyGems API keys, CI release permissions, and workstation credentials all become part of the control surface when a registry can be used to move data out as well as deliver code.
Key questions
Q: What breaks when package registries are used as exfiltration channels?
A: The trust model breaks because defenders often monitor package consumption, not package publication. When an attacker can wrap scraped data inside a valid archive and push it through a registry, outbound transfer can look like routine release activity. Controls must therefore cover publishing identity, archive inspection, and non-release egress from build or runtime systems.
Q: Why do hardcoded publishing tokens create more risk than simple secret leakage?
A: A hardcoded publishing token is not just an exposed secret, it is an identity with write access to a trusted distribution channel. If that token can be reused from a script that also collects data, the attacker can turn the registry into a covert transport path. The risk is the combination of privilege and context, not the token alone.
Q: What are the signs that registry publishing is being abused?
A: Look for gem uploads from non-release hosts, temporary credential files in /tmp, HOME overrides before gem push, and package contents that contain scraped text or other data unrelated to software delivery. Those signals show that the publish path is being used for something other than controlled release management.
Q: Should teams treat package registry publishing like a privileged data-exit workflow?
A: Yes. Registry publishing should be governed like any other controlled export path because it can move data, not just code. That means allowlisted publishers, scoped API keys, audit logs, and separate controls for consumption and publication. If a team only secures installs, it misses the abuse path this campaign exploits.
Technical breakdown
How RubyGems publishing became a covert data channel
The campaign uses ordinary package mechanics for an abnormal purpose. Ruby scripts collect page content, write the results into a package tree, build a valid .gem archive, and then push it to RubyGems. Because the archive is structurally legitimate, the registry can store the exfiltrated content without needing a separate drop site. That makes the package itself the carrier, while the registry becomes the retrieval mechanism. This is a supply-chain abuse pattern, not a classical malware drop, and it is especially hard to spot when defenders only inspect install-time threats.
Practical implication: Treat package publishing as a monitored data-exit path, not just a software-release function.
Why hardcoded API keys and temporary credential files matter
The samples show two credential-handling patterns that expand abuse potential. Some create a temporary credentials file under /tmp, place a hardcoded RubyGems token in it, and override HOME so the gem CLI reads attacker-controlled credentials. Others embed the token directly in the HTTP Authorization header and bypass the CLI entirely. In both cases, the identity artifact is not just a secret, it is a publishing capability. Once that capability is available in a script, the registry trust boundary is already broken.
Practical implication: Scope and monitor RubyGems API keys as publishing credentials, and flag any use outside approved release workflows.
Registry abuse changes how egress and release controls should work
A registry endpoint can look benign in network telemetry because developer workstations and CI systems normally talk to it. GemStuffer exploits that familiarity. The harder problem is distinguishing legitimate gem publication from data exfiltration hidden inside package contents. Controls that only gate dependency installation miss this pattern because the attacker is not consuming packages, they are producing them. That makes release-policy enforcement, logging, and abnormal publish detection essential control layers for registry governance.
Practical implication: Require allowlisted publishing workflows and alert on any non-release process that contacts the gem push API.
Threat narrative
Attacker objective: The objective is to move scraped web content out through a trusted registry channel while hiding the transfer inside legitimate package artifacts.
- Entry begins when a Ruby script fetches public ModernGov pages and processes them as source material for package creation.
- Credential access occurs when the script uses a hardcoded RubyGems API token, sometimes through a temporary /tmp credentials file and a HOME override.
- Exfiltration happens when the collected responses are packaged into valid .gem archives and uploaded to RubyGems for later retrieval.
Breaches seen in the wild
- LiteLLM PyPI package breach: LiteLLM PyPI supply chain attack, credentials stolen from users.
- Sisense breach 2024: A credential in Sisense's GitLab reportedly opened S3 buckets of customer tokens, passwords and certificates; CISA urged a full reset.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Gem registries are now bidirectional trust surfaces: defenders still tend to think of package registries as delivery infrastructure, but GemStuffer shows they can also function as covert outbound channels. That matters because the security model changes once publishing is treated as a data-flow event rather than a release-only event. Practitioners should govern registry writes with the same scrutiny applied to privileged data exports.
The named concept here is registry exfiltration abuse: a package registry is used to move data out by wrapping it in a valid archive and exploiting normal publish pathways. This is distinct from typosquatting or dependency poisoning because the attacker is not relying on a developer to install the package. Security teams should design detections around publish behaviour, not just package consumption.
Hardcoded publishing tokens are governance failures, not just secret hygiene issues: once a script can mint or reuse a publishing identity, the registry becomes an extension of that identity's trust boundary. The real gap is allowing release credentials to exist in contexts that can also scrape, stage, and publish arbitrary content. Teams should classify registry API tokens as high-risk publishing credentials and bind them to tightly scoped workflows.
Install-path controls are insufficient when the abuse path is upload-side: many supply-chain programmes focus on dependency scanning, malicious packages, and consumption risk. GemStuffer shows that registry governance also needs controls on who can publish, from where, and with what egress profile. Practitioners should widen their supply-chain lens to include outbound registry API calls and archive-content inspection.
Operational noise can hide targeted abuse: the article notes broader spam-publishing activity around RubyGems, which creates a useful smokescreen for registry misuse. That means anomaly detection has to separate high-volume platform noise from the small number of publish actions that actually matter. Security operations should monitor for rare publishing patterns from non-release systems as a distinct signal.
What this signals
Registry exfiltration abuse: security teams need to treat package publication as a potential data-loss path, especially when the archive format itself can conceal scraped or staged content. That shifts the control question from "can this package be installed safely" to "can this identity publish safely from this environment?"
RubyGems, PyPI, npm, and similar registries all share the same governance weakness when publishing is under-monitored: the same trust that supports software delivery can be repurposed for covert transfer. The practical response is to align release approval, credential scoping, and outbound network policy around publishing behaviour, not just dependency risk.
For practitioners
- Constrain gem publishing to approved release workflows Allow gem push only from controlled release pipelines and block registry publishing from application runtimes, scrapers, and ad hoc CI jobs.
- Monitor RubyGems API use as a privileged action Alert on POST requests to the RubyGems gem upload API from hosts that do not publish packages and investigate any publish event from a non-release context.
- Hunt for temporary credential staging Search for /tmp-based .gem credentials files, HOME overrides, and other evidence that a script is redirecting the gem CLI to attacker-controlled credentials.
- Review package artefacts for embedded exfiltration content Inspect newly published gems for unexpected text payloads, scraped HTML, or other data that should never appear inside a release archive.
- Scope registry credentials to minimum publish rights Limit RubyGems API keys to the smallest possible package set and rotate them whenever they are exposed outside the intended release boundary.
Key takeaways
- GemStuffer shows that a package registry can be used as an exfiltration layer, not only as a software distribution channel.
- The abuse worked because valid gem archives and hardcoded publishing credentials made the transfer look operationally normal.
- Teams that only monitor package installation miss the larger risk, which sits in publishing rights, release workflows, and registry egress.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Hardcoded RubyGems API keys and temporary credential files are the core abuse mechanism in this article. |
| NHI-07 — Long-Lived Secrets | The campaign depends on reusable publishing credentials that outlive a single controlled release action. | |
| Recommendation — Search for exposed registry credentials and revoke any token found outside approved publishing workflows. Replace reusable registry tokens with tightly scoped, short-lived publishing credentials wherever possible. | ||
| MITRE ATT&CK | TA0006;TA0010 — Credential Access; Exfiltration | The attack uses credential handling to reach the publish API and then moves data out through that channel. |
| Recommendation — Map suspicious package publishing to TA0006 and TA0010 and investigate any non-release upload path. | ||
| CIS Controls v8 | CIS-5 — Account Management | Registry publishing relies on tightly managed accounts and service credentials with clear ownership. |
| Recommendation — Review account ownership and disable any registry publisher that is not tied to a named release process. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | RubyGems API keys are authenticators that need lifecycle control, rotation, and revocation. |
| Recommendation — Apply IA-5 to manage registry tokens with rotation, revocation, and strict scope limits. | ||
Key terms
- Registry Exfiltration: Registry exfiltration is the abuse of a software package registry as a storage or transport channel for stolen or scraped data. Instead of only delivering code, the registry carries attacker-controlled content inside valid artifacts, making the traffic look like normal publishing activity while hiding the real payload.
- Publishing Credentials: Publishing credentials are the authentication secrets that allow a person or system to release software to a package registry. They are high-value non-human or human-access secrets because compromise can let an attacker distribute malicious updates under a trusted project name.
- Bidirectional Trust Surface: A bidirectional trust surface is a system that must be trusted both for incoming consumption and outgoing publication. Package registries fit this model because they receive dependencies and also accept uploads, which means defenders must govern read and write paths with different controls and monitoring signals.
- Release Workflow Boundary: The operational boundary that separates approved software publication from ordinary development, testing, or runtime activity. When this boundary is weak, non-release systems can inherit publish privileges, which turns routine automation into a potential covert transfer path or supply-chain abuse channel.
Deepen your knowledge
The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, and secrets management in practical operational terms. It helps identity and security practitioners apply those controls to release workflows, service credentials, and modern automation.
Published by the NHIMG editorial team on August 21, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org