github_high_number_of_non_public_github_repositories_downloaded
Description
Detects when a user downloads a high number of non-public GitHub repositories. An adversary may attempt to steal the contents of several GitHub repositories after compromising a user account.
Query · yara_l
events:
$github.metadata.vendor_name = "GITHUB" nocase
$github.metadata.product_name = "GITHUB"
$github.metadata.product_event_type = "repo.download_zip"
$github.extracted.fields["public_repo"] = "false"
$github.principal.user.userid = $user_id
$github.target.resource.name = $github_repo_name
match:
$user_id over 30m
outcome:
$github_repo_name_distinct_count = count_distinct($github_repo_name)
$risk_score = max(85)
$mitre_attack_tactic = "Collection"
$mitre_attack_technique = "Data from Information Repositories: Code Repositories"
$mitre_attack_technique_id = "T1213.003"
$event_count = count_distinct($github.metadata.id)
$principal_ip = array_distinct($github.principal.ip)
$principal_user_userid = array_distinct($github.principal.user.userid)
$principal_ip_country = array_distinct($github.principal.ip_geo_artifact.location.country_or_region)
$principal_ip_state = array_distinct($github.principal.ip_geo_artifact.location.state)
$principal_ip_city = array_distinct($github.principal.location.city)
$security_result_summary = array_distinct($github.security_result.summary)
condition:
// Customize GitHub repo count to fit your environment
$github and $github_repo_name_distinct_count > 5