ID | Technique | Tactic |
---|---|---|
T1199 | Trusted Relationship | Initial Access |
Detection: Github Commit Changes In Master
Description
The following analytic detects direct commits or pushes to the master or main branch in a GitHub repository. It leverages GitHub logs to identify events where changes are made directly to these critical branches. This activity is significant because direct modifications to the master or main branch bypass the standard review process, potentially introducing unreviewed and harmful changes. If confirmed malicious, this could lead to unauthorized code execution, security vulnerabilities, or compromised project integrity.
Search
1`github` branches{}.name = main OR branches{}.name = master
2| stats count min(_time) as firstTime max(_time) as lastTime by commit.commit.author.email commit.author.login commit.commit.message repository.pushed_at commit.commit.committer.date repository.full_name
3| rename commit.author.login as user, repository.full_name as repository
4| `security_content_ctime(firstTime)`
5| `security_content_ctime(lastTime)`
6| `github_commit_changes_in_master_filter`
Data Source
Name | Platform | Sourcetype | Source | Supported App |
---|---|---|---|---|
GitHub | AWS | 'aws:firehose:json' |
'github' |
N/A |
Macros Used
Name | Value |
---|---|
github | sourcetype=aws:firehose:json |
github_commit_changes_in_master_filter | search * |
github_commit_changes_in_master_filter
is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
Default Configuration
This detection is configured by default in Splunk Enterprise Security to run with the following settings:
Setting | Value |
---|---|
Disabled | true |
Cron Schedule | 0 * * * * |
Earliest Time | -70m@m |
Latest Time | -10m@m |
Schedule Window | auto |
Creates Risk Event | True |
Implementation
To successfully implement this search, you need to be ingesting logs related to github logs having the fork, commit, push metadata that can be use to monitor the changes in a github project.
Known False Positives
Admin can do changes directly to master branch
Associated Analytic Story
Risk Based Analytics (RBA)
Risk Message | Risk Score | Impact | Confidence |
---|---|---|---|
Suspicious commit by $commit.commit.author.email$ to main branch | 9 | 30 | 30 |
References
Detection Testing
Test Type | Status | Dataset | Source | Sourcetype |
---|---|---|---|---|
Validation | ✅ Passing | N/A | N/A | N/A |
Unit | ✅ Passing | Dataset | github |
aws:firehose:json |
Integration | ✅ Passing | Dataset | github |
aws:firehose:json |
Replay any dataset to Splunk Enterprise by using our replay.py
tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
Source: GitHub | Version: 2