EXPLORE
← Back to Explore
elasticmediumTTP

New GitHub Self Hosted Action Runner

This rule detects the registration of a self-hosted GitHub Actions runner by a user and source ASN (autonomous system) pair not seen in the last 5 days. The source IP is resolved to its ASN at query time, so address churn inside the same ISP or cloud provider does not produce new alerts. Adversaries may abuse self-hosted runners to execute workflow jobs on customer infrastructure.

MITRE ATT&CK

initial-access

Detection Query

FROM logs-github.audit-*
| WHERE event.dataset == "github.audit" AND event.category == "configuration"
  AND event.action IN ("repo.register_self_hosted_runner", "org.register_self_hosted_runner", "enterprise.register_self_hosted_runner")
  AND user.name IS NOT NULL AND github.actor_ip IS NOT NULL
| IP_LOCATION asn = github.actor_ip WITH { "database_file": "GeoLite2-ASN.mmdb", "properties": ["asn", "organization_name"] }
| IP_LOCATION geo = github.actor_ip WITH { "properties": ["country_iso_code"] }
| WHERE asn.asn IS NOT NULL
| STATS Esql.event_count = COUNT(*),
        Esql.first_seen = MIN(@timestamp),
        Esql.last_seen = MAX(@timestamp),
        Esql.ip_values = VALUES(github.actor_ip),
        Esql.event_action_values = VALUES(event.action),
        Esql.repo_values = VALUES(github.repo),
        Esql.org_values = VALUES(github.org),
        Esql.country_values = VALUES(geo.country_iso_code),
        Esql.user_agent_values = VALUES(github.user_agent)
  BY user.name, asn.asn, asn.organization_name
// The 5-day history is the rule look-back (from = now-7205m). A user/ASN pair is new when its first
// event falls inside the current interval; the 10m bound allows for the 5m interval plus scheduling drift.
| WHERE DATE_DIFF("minute", Esql.first_seen, NOW()) <= 10
| EVAL Esql.source_as_number = asn.asn, Esql.source_as_organization_name = asn.organization_name
| KEEP user.name, Esql.*

Author

Elastic

Created

2025/11/28

Data Sources

GithubGitHub Audit Logs

Tags

Domain: CloudUse Case: Threat DetectionTactic: Initial AccessData Source: GithubData Source: GitHub Audit LogsResources: Investigation GuideNoise: LowPerformance: FastProfile: RecommendedThreat: Supply ChainRule Type: ES|QLPlatform: GitHubDomain: SaaS
Raw Content
[metadata]
creation_date = "2025/11/28"
integration = ["github"]
maturity = "production"
min_stack_comments = "ES|QL IP_LOCATION requires 9.5.0+."
min_stack_version = "9.5.0"
updated_date = "2026/10/07"

[rule]
author = ["Elastic"]
description = """
This rule detects the registration of a self-hosted GitHub Actions runner by a user and source ASN (autonomous
system) pair not seen in the last 5 days. The source IP is resolved to its ASN at query time, so address churn inside
the same ISP or cloud provider does not produce new alerts. Adversaries may abuse self-hosted runners to execute
workflow jobs on customer infrastructure.
"""
false_positives = [
    "Authorized self-hosted GitHub actions runner.",
]
from = "now-7205m"
interval = "5m"
language = "esql"
license = "Elastic License v2"
name = "New GitHub Self Hosted Action Runner"
note = """## Triage and analysis

### Investigating New GitHub Self Hosted Action Runner

Adversaries who gain the ability to modify or trigger workflows in a linked GitHub repository can execute arbitrary commands on the runner host.

### Possible investigation steps

- Validate the user is authoried to perform this change
- Review the purpose of the self-hosted action runner and what actions will be executed.
- Verify if there is any adjascent  sensitive file access or collection.
- Correlate with other alerts and investiguate if this activity is related to a supply chain attack.

### False positive analysis

- Authorized github self-hosted actions runner.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further unauthorized command execution and potential lateral movement.
- Terminate any suspicious child processes that were initiated by the Github actions runner.
- Conduct a thorough review of the affected system's logs and configurations to identify any unauthorized changes or additional indicators of compromise.
- Restore the system from a known good backup if any unauthorized changes or malicious activities are confirmed.
- Implement application whitelisting to prevent unauthorized execution.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to assess the potential impact on the broader network."""
references = [
    "https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise",
    "https://socket.dev/blog/shai-hulud-strikes-again-v2",
    "https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack"
]
risk_score = 47
rule_id = "40c34c8a-b0bc-43bc-83aa-d2b76bf129e1"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Use Case: Threat Detection",
    "Tactic: Initial Access",
    "Data Source: Github",
    "Data Source: GitHub Audit Logs",
    "Resources: Investigation Guide",
    "Noise: Low",
    "Performance: Fast",
    "Profile: Recommended",
    "Threat: Supply Chain",
    "Rule Type: ES|QL",
    "Platform: GitHub",
    "Domain: SaaS",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
FROM logs-github.audit-*
| WHERE event.dataset == "github.audit" AND event.category == "configuration"
  AND event.action IN ("repo.register_self_hosted_runner", "org.register_self_hosted_runner", "enterprise.register_self_hosted_runner")
  AND user.name IS NOT NULL AND github.actor_ip IS NOT NULL
| IP_LOCATION asn = github.actor_ip WITH { "database_file": "GeoLite2-ASN.mmdb", "properties": ["asn", "organization_name"] }
| IP_LOCATION geo = github.actor_ip WITH { "properties": ["country_iso_code"] }
| WHERE asn.asn IS NOT NULL
| STATS Esql.event_count = COUNT(*),
        Esql.first_seen = MIN(@timestamp),
        Esql.last_seen = MAX(@timestamp),
        Esql.ip_values = VALUES(github.actor_ip),
        Esql.event_action_values = VALUES(event.action),
        Esql.repo_values = VALUES(github.repo),
        Esql.org_values = VALUES(github.org),
        Esql.country_values = VALUES(geo.country_iso_code),
        Esql.user_agent_values = VALUES(github.user_agent)
  BY user.name, asn.asn, asn.organization_name
// The 5-day history is the rule look-back (from = now-7205m). A user/ASN pair is new when its first
// event falls inside the current interval; the 10m bound allows for the 5m interval plus scheduling drift.
| WHERE DATE_DIFF("minute", Esql.first_seen, NOW()) <= 10
| EVAL Esql.source_as_number = asn.asn, Esql.source_as_organization_name = asn.organization_name
| KEEP user.name, Esql.*
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"

[[rule.threat.technique.subtechnique]]
id = "T1195.001"
name = "Compromise Software Dependencies and Development Tools"
reference = "https://attack.mitre.org/techniques/T1195/001/"

[[rule.threat.technique.subtechnique]]
id = "T1195.002"
name = "Compromise Software Supply Chain"
reference = "https://attack.mitre.org/techniques/T1195/002/"

[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"