← Back to Explore
elasticlowTTP
GitHub Activity on a Private Repository from an Unusual ASN
Detects when a GitHub user pushes to or clones a private repository from an autonomous system (ASN) not previously seen for that user in the last 7 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 access private repositories from unfamiliar ASNs to exfiltrate sensitive code or data, potentially indicating a compromise or unauthorized access.
Detection Query
FROM logs-github.audit-*
| WHERE event.dataset == "github.audit" AND event.action IN ("git.push", "git.clone")
AND github.repository_public == false
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_count = COUNT_DISTINCT(github.actor_ip),
Esql.ip_values = VALUES(github.actor_ip),
Esql.repo_values = VALUES(github.repo),
Esql.event_action_values = VALUES(event.action),
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 7-day history is the rule look-back (from = now-10085m). 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/12/16
Data Sources
GithubGitHub Audit Logs
References
Tags
Domain: CloudUse Case: Threat DetectionTactic: ImpactTactic: Initial AccessTactic: PersistenceData Source: GithubData Source: GitHub Audit LogsResources: Investigation GuideNoise: HighPerformance: FastProfile: AggressiveThreat: Supply ChainRule Type: ES|QLPlatform: GitHubDomain: SaaS
Raw Content
[metadata]
creation_date = "2025/12/16"
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 = """
Detects when a GitHub user pushes to or clones a private repository from an autonomous system (ASN) not previously
seen for that user in the last 7 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 access private repositories from unfamiliar
ASNs to exfiltrate sensitive code or data, potentially indicating a compromise or unauthorized access.
"""
false_positives = [
"""
Developers travelling or switching between home, mobile and corporate networks will appear from a new ASN the first
time each is used. CI runners and cloud build services appear once per cloud provider ASN; add exceptions for known
automation identities if the volume is high.
""",
]
from = "now-10085m"
interval = "5m"
language = "esql"
license = "Elastic License v2"
name = "GitHub Activity on a Private Repository from an Unusual ASN"
references = [
"https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack",
"https://trigger.dev/blog/shai-hulud-postmortem",
"https://posthog.com/blog/nov-24-shai-hulud-attack-post-mortem",
]
risk_score = 21
rule_id = "daf2e0e0-0bab-4672-bfa1-62db0ee5ec22"
severity = "low"
tags = [
"Domain: Cloud",
"Use Case: Threat Detection",
"Tactic: Impact",
"Tactic: Initial Access",
"Tactic: Persistence",
"Data Source: Github",
"Data Source: GitHub Audit Logs",
"Resources: Investigation Guide",
"Noise: High",
"Performance: Fast",
"Profile: Aggressive",
"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.action IN ("git.push", "git.clone")
AND github.repository_public == false
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_count = COUNT_DISTINCT(github.actor_ip),
Esql.ip_values = VALUES(github.actor_ip),
Esql.repo_values = VALUES(github.repo),
Esql.event_action_values = VALUES(event.action),
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 7-day history is the rule look-back (from = now-10085m). 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.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[[rule.threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[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/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1213"
name = "Data from Information Repositories"
reference = "https://attack.mitre.org/techniques/T1213/"
[[rule.threat.technique.subtechnique]]
id = "T1213.003"
name = "Code Repositories"
reference = "https://attack.mitre.org/techniques/T1213/003/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"