Files
splunk-security_content/detections/cloud/github_pull_request_from_unknown_user.yml
T

68 lines
3.1 KiB
YAML

name: GitHub Pull Request from Unknown User
id: 9d7b9100-8878-4404-914e-ca5e551a641e
version: 5
date: '2025-02-10'
author: Patrick Bareiss, Splunk
status: production
type: Anomaly
description: The following analytic detects pull requests from unknown users on GitHub.
It uses a Splunk query to identify pull requests where the user ID is not specified
and cross-references these with a known users lookup table. This activity is significant
because pull requests from unknown users can introduce malicious code or unauthorized
changes to repositories. If confirmed malicious, this could lead to unauthorized
code changes, data breaches, or other security incidents. Immediate steps include
reviewing the author's name, repository, head reference, and commit message, and
investigating any related artifacts and processes.
data_source:
- GitHub
search: '`github` check_suite.pull_requests{}.id=* | stats count by check_suite.head_commit.author.name
repository.full_name check_suite.pull_requests{}.head.ref check_suite.head_commit.message
| rename check_suite.head_commit.author.name as user repository.full_name as repository
check_suite.pull_requests{}.head.ref as ref_head check_suite.head_commit.message
as commit_message | search NOT `github_known_users` | eval phase="code" | `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)` | `github_pull_request_from_unknown_user_filter`'
how_to_implement: You must index GitHub logs. You can follow the url in reference
to onboard GitHub logs.
known_false_positives: unknown
references:
- https://www.splunk.com/en_us/blog/tips-and-tricks/getting-github-data-with-webhooks.html
drilldown_searches:
- name: View the detection results for - "$repository$"
search: '%original_detection_search% | search repository = "$repository$"'
earliest_offset: $info_min_time$
latest_offset: $info_max_time$
- name: View risk events for the last 7 days for - "$repository$"
search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$repository$")
starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime
values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories)
as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic)
as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`'
earliest_offset: $info_min_time$
latest_offset: $info_max_time$
rba:
message: Vulnerabilities found in packages used by GitHub repository $repository$
risk_objects:
- field: repository
type: other
score: 27
threat_objects: []
tags:
analytic_story:
- Dev Sec Ops
asset_type: GitHub
mitre_attack_id:
- T1195.001
product:
- Splunk Enterprise
- Splunk Enterprise Security
- Splunk Cloud
security_domain: network
tests:
- name: True Positive Test
attack_data:
- data:
https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1195.001/github_pull_request/github_pull_request.json
sourcetype: aws:firehose:json
source: github