Skip to content

[New Rules] Megalodon GitHub Actions supply chain backdoor — Linux endpoint detection (May 2026)#6218

Open
StuLast wants to merge 2 commits into
elastic:mainfrom
Spyced-Concepts:rules/megalodon-github-actions-may26
Open

[New Rules] Megalodon GitHub Actions supply chain backdoor — Linux endpoint detection (May 2026)#6218
StuLast wants to merge 2 commits into
elastic:mainfrom
Spyced-Concepts:rules/megalodon-github-actions-may26

Conversation

@StuLast

@StuLast StuLast commented May 30, 2026

Copy link
Copy Markdown

Pull Request

Issue link(s): Closes #6217

Two new Linux endpoint detection rules for the Megalodon GitHub Actions supply chain backdoor
campaign (May 2026), which compromised 5,561 GitHub repositories via stolen Personal Access
Tokens pushing malicious workflow files.

Rules added:

File Severity Tactic Risk Score
rules/linux/command_and_control_megalodon_c2_outbound.toml Critical Command and Control, Exfiltration 99
rules/linux/execution_megalodon_base64_exec_ci_runner.toml High Execution, Defense Evasion 73

Intelligence source: SafeDep.io, "Megalodon: Mass GitHub Repository Backdooring via CI
Workflows"
(2026) — https://safedep.io/megalodon-mass-github-repo-backdooring-ci-workflows/

SafeDep.io are the source of all IoC data (C2 IP, workflow filenames). Detection rule logic is
original work by Spyced Concepts Ltd. SafeDep.io have been notified and credited in all rule
references.

Note on AI assistance: Detection rule logic was developed with AI assistance (Claude Sonnet
4.6). IoC intelligence is sourced entirely from SafeDep.io's original research.

Full rule set (YARA + Sigma + test harness with FP/FN scoring):
https://github.com/Spyced-Concepts/detection-rules

Why only Linux endpoint rules: Three GitHub audit log rules were drafted but excluded.
github.head_commit.added, github.head_commit.modified, and github.pull_request.id are not
present in the logs-github.audit-* field mapping, making file-path-based detection impossible
from audit log events. Those rules are retained in the companion repo pending an ECS/integration
enhancement to expose commit-level file path data.

How To Test

C2 outbound rule — query to verify in your stack:
host.os.type:linux and event.category:network and
destination.ip:"216.126.225.129" and destination.port:8443

Base64 exec rule — query to verify in your stack:
host.os.type:linux and event.category:process and
process.command_line:(base64 and ("-d" or "--decode")) and
process.command_line:("| bash" or "| sh" or "|bash" or "|sh") and
not process.parent.executable:(apt or dpkg or snap)

Both rules use standard ECS fields only (destination.ip, destination.port,
process.command_line, process.parent.executable). No custom field mappings required.

Checklist

  • Added a label for the type of pr: Rule: New
  • Secret and sensitive material has been managed correctly
  • Documentation and comments were added for features that require explanation

Contributor checklist

StuLast added 2 commits May 30, 2026 21:26
…(May 2026)

Five rules detecting the Megalodon campaign that backdoored 5,561 GitHub repositories
via stolen PATs pushing malicious workflow files (2026-05-18).

GitHub integration rules (logs-github.audit-*):
  - Megalodon - Known Malicious Workflow Filename Pushed to Repository [critical]
  - Megalodon - Direct Push to Workflow Directory Without Pull Request [high]
  - Megalodon - Push to Workflow Directory Requires Content Review for Dangerous Permissions [medium]

Linux endpoint rules (logs-endpoint.events.*):
  - Megalodon - Outbound Connection to Known C2 Server from CI Runner [critical]
  - Megalodon - Base64-Decoded Shell Execution on CI Runner [high]

Intelligence source: SafeDep.io, "Megalodon: Mass GitHub Repository Backdooring via CI
Workflows" (2026). Detection rule logic by Spyced Concepts Ltd. (https://spycedconcepts.co.uk).
Full rule set with YARA rules and test harness: https://github.com/Spyced-Concepts/detection-rules

Note: IoC data (C2 IP 216.126.225.129:8443, workflow filenames, author identities) sourced
from SafeDep.io original research, credited in rule references.
Remove three GitHub audit log rules — github.head_commit.added/modified and
github.pull_request.id are not available in the logs-github.audit-* integration.
File-path-based detection from audit log events is not currently possible.

Remaining rules submitted:
  - rules/linux/command_and_control_megalodon_c2_outbound.toml [critical]
  - rules/linux/execution_megalodon_base64_exec_ci_runner.toml [high]

The GitHub audit log rules are retained in the companion detection-rules repo
with notes on the field limitation. An ECS/integration enhancement request is
needed to add head_commit file path fields to the GitHub audit log integration.
@StuLast

StuLast commented May 30, 2026

Copy link
Copy Markdown
Author

Could a maintainer please add the Rule: New label? I don't have write access to labels as an external contributor.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two new Linux Elastic Defend endpoint detection rules to identify post-compromise activity associated with the Megalodon GitHub Actions supply-chain backdoor campaign (May 2026), focusing on (1) known C2 egress and (2) the base64-decode-and-execute payload delivery pattern seen in malicious workflows.

Changes:

  • Added an IoC-based endpoint network rule for connections to the reported Megalodon C2 (216.126.225.129:8443).
  • Added a behavior-based endpoint process rule for base64-decoded payloads being piped into bash/sh on CI runners, including investigation guidance and ATT&CK mappings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
rules/linux/command_and_control_megalodon_c2_outbound.toml New Linux endpoint network rule for Megalodon C2 destination IP/port.
rules/linux/execution_megalodon_base64_exec_ci_runner.toml New Linux endpoint process rule for base64 decode → pipe-to-shell execution pattern used by the campaign.

Comment on lines +93 to +96
host.os.type:linux and event.category:process and
process.command_line:(*base64* and (*"-d"* or *"--decode"*)) and
process.command_line:(*"| bash"* or *"| sh"* or *"|bash"* or *"|sh"*) and
not process.parent.executable:(*apt* or *dpkg* or *snap*)
Comment on lines +81 to +82
host.os.type:linux and event.category:network and
destination.ip:"216.126.225.129" and destination.port:8443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New Rules] Megalodon GitHub Actions supply chain backdoor campaign (May 2026)

5 participants