Skip to main content
green gradient background, "The Future of Application Security Is Already Here." and a read the report button.
1,806 Repos Ran a Payload That Stole CI/CD SecretsIncident
5 min readFor Security Engineers

1,806 Repos Ran a Payload That Stole CI/CD Secrets

A campaign against GitHub repositories used hijacked accounts to open pull requests carrying a malicious script. This script's goal was to extract CI/CD secrets and cloud credentials from build environments and send them elsewhere. The scale of this attack highlights the vulnerabilities in current practices. Here's what's known, where controls failed, and what your team should change.

What Happened

Aikido Security detected and documented the campaign. Attackers used 4,837 compromised GitHub accounts to open probe pull requests across 61,764 repositories. The payload executed in at least 1,806 repositories.

The mechanics matter more than the count. The pull requests injected a malicious script designed to exfiltrate CI/CD secrets and cloud credentials. GitHub's safeguards caught some of the attacks, but others bypassed these using npm hooks, as analyzed by GitGuardian. Some Fly.io tokens were among the leaked secrets.

One more number should worry you: around 92% of the pull requests remain open. Most project owners haven't noticed them. A malicious PR sitting unreviewed is a live risk, not a closed incident.

Timeline

This is a sequence of phases rather than a precise timeline:

  1. Account Compromise: Attackers accessed 4,837 GitHub accounts. The method of compromise isn't clear, so don't assume a single cause.
  2. Probe Pull Requests: Hijacked accounts opened PRs against 61,764 repositories. Using real, aged accounts gave the PRs more credibility than new profiles would.
  3. Execution: The injected script ran in at least 1,806 repositories, harvesting CI/CD secrets and cloud credentials.
  4. Partial Platform Response: GitHub's safeguards stopped some attempts. Attacks using npm hooks bypassed them.
  5. Current State: Roughly 92% of the PRs remain open, indicating most owners haven't reviewed them.

Which Controls Failed or Were Missing

Consider this as a pipeline, as the attack needed several elements to succeed.

Pull Request Code Ran with Access to Secrets: The payload only succeeds if the build environment holds secrets worth stealing. Any workflow that executes untrusted PR content with secrets in scope is a direct path to exfiltration.

Lifecycle Hooks Executed Without Scrutiny: The bypass used npm hooks. Scripts that run automatically during install or build are code execution you didn't explicitly review. Platform-level filtering missed them, so repository-level controls had to catch them and didn't.

Compromised Identities Looked Legitimate: A PR from an established account passes the casual trust check. If your review process leans on "I recognize this contributor," 4,837 hijacked accounts show why that fails.

Detection Depended on the Platform, Not the Owner: With 92% of PRs unreviewed, the owners weren't in the loop. Nobody was watching for unexpected PRs or unusual CI behavior.

Long-Lived Credentials Amplified the Damage: Stolen cloud credentials and tokens are only valuable if they stay valid long enough to use. Static secrets in CI turn a short exposure into a lasting one.

What the Relevant Standards Require

While these frameworks don't mention this campaign, several requirements map directly onto the failures.

NIST 800-53 Rev 5

  • SI-7 (Software, Firmware, and Information Integrity): Covers integrity verification of software, which applies to scripts introduced through contributions and hooks.
  • CM-3 (Configuration Change Control) and CM-5 (Access Restrictions for Change): Apply to who can alter pipeline definitions and build behavior.
  • AC-6 (Least Privilege): Applies to what a build job can reach. A job that runs unreviewed code shouldn't hold broad cloud credentials.
  • IA-5 (Authenticator Management): Covers the lifecycle of credentials, including rotation and protection.
  • SR-3 (Supply Chain Controls and Processes): Addresses supply chain risk across your delivery process.

NIST Cybersecurity Framework (CSF) v2.0

  • The GOVERN function includes cybersecurity supply chain risk management (GV.SC), covering third-party code and contributors.
  • DETECT (DE.CM, continuous monitoring): Expects you to watch for anomalous activity. An unexpected PR wave and abnormal CI behavior fall squarely here.
  • PROTECT (PR.AA, identity management and access control): Covers authenticating the accounts that can change your code.

ISO/IEC 27001:2022 Annex A

  • A.8.4 (Access to Source Code) and A.8.32 (Change Management): Apply to who can modify code and how changes are controlled.
  • A.8.28 (Secure Coding) and A.8.25 (Secure Development Life Cycle): Cover how code is reviewed before it runs.
  • A.5.17 (Authentication Information): Covers handling secrets.

SOC 2 Type II

  • CC6.1 (Logical Access) and CC8.1 (Change Management): Are the criteria an auditor would test against here. Type II means you need evidence the controls operated over the period, not just that they exist.

PCI DSS v4.0.1

  • If your pipelines touch the cardholder data environment, Requirement 6.5.1 (Change Control Procedures) and Requirement 8.6.2 (No Hard-Coded Passwords in Scripts or Code) are relevant. Requirement 6.4.3 applies to payment page scripts, so it's a separate concern from CI, but the same script-integrity thinking applies.

Lessons and Action Items for Your Team

  1. Stop Giving Untrusted PRs Access to Secrets: Audit every workflow triggered by pull requests, especially from forks. Make sure secrets aren't exposed to those runs. Require a maintainer approval step before workflows from outside contributors execute. This maps to AC-6 and CC6.1.

  2. Treat Install Hooks as Code Execution: Review preinstall, postinstall, and similar lifecycle scripts as you would any other code. Where your tooling allows, disable automatic script execution in CI and enable it only for packages you've vetted. This targets the exact bypass used.

  3. Replace Static Cloud Credentials with Short-Lived Ones: Use OIDC-based federation between your CI system and cloud provider so jobs receive credentials that expire quickly. A stolen token that's dead within the hour is a much smaller incident. This supports IA-5 and PCI DSS v4.0.1 Requirement 8.6.2.

  4. Rotate on a Schedule and on Suspicion: Know what every secret in CI is, who owns it, and how to rotate it. If a PR from an unfamiliar or unexpected source triggered a build with secrets in scope, rotate those secrets without waiting for proof of theft.

  5. Check Your Own Repositories Today: Given that most of the PRs are still open, search your repos for unexpected open pull requests, particularly ones touching workflow files, package manifests, or install scripts. Close and investigate anything you can't explain. Review recent CI run logs for unusual outbound connections.

  6. Add Detection That Doesn't Depend on a Human Noticing: Alert on new workflow file changes, new or modified lifecycle scripts, and outbound network calls from build runners to unexpected destinations. Use secret scanning and monitoring to catch leaked tokens early. Automated tooling complements review; it doesn't replace it, but it works at the scale reviewers can't.

  7. Require Stronger Authentication on Contributor Accounts: Enforce MFA and consider requiring signed commits for anyone with write access. A hijacked account shouldn't be able to push trusted-looking changes unchallenged. This maps to PR.AA and A.8.4.

  8. Restrict Who Can Modify Pipeline Definitions: Use code owners and branch protection so workflow and build-config changes need review from a designated team. This addresses CM-5 and A.8.32.

The 1,806 executions are a count of repos where defenses failed. The 92% of PRs still sitting open are a count of repos where nobody has looked yet. Start by looking.

Topics:Incident
Promotional banner for the CUI buildout guide

You Might Also Like