Detection: Github Commit In Develop

Description

The following analytic detects commits pushed directly to the 'develop' or 'main' branches in a GitHub repository. It leverages GitHub logs, focusing on commit metadata such as author details, commit messages, and timestamps. This activity is significant as direct commits to these branches can bypass the review process, potentially introducing unvetted changes. If confirmed malicious, this could lead to unauthorized code modifications, introducing vulnerabilities or backdoors into the codebase, and compromising the integrity of the development lifecycle.

1`github` branches{}.name = main OR branches{}.name = develop 
2|  stats count min(_time) as firstTime max(_time) as lastTime  by commit.author.html_url commit.commit.author.email commit.author.login commit.commit.message repository.pushed_at commit.commit.committer.date 
3| eval phase="code" 
4| `security_content_ctime(firstTime)` 
5| `security_content_ctime(lastTime)` 
6| `github_commit_in_develop_filter`

Data Source

Name Platform Sourcetype Source
GitHub AWS icon AWS 'aws:firehose:json' 'github'

Macros Used

Name Value
github sourcetype=aws:firehose:json
github_commit_in_develop_filter search *
github_commit_in_develop_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1199 Trusted Relationship Initial Access
KillChainPhase.DELIVERY
NistCategory.DE_AE
Cis18Value.CIS_10
APT28
APT29
GOLD SOUTHFIELD
LAPSUS$
POLONIUM
RedCurl
Sandworm Team
Threat Group-3390
menuPass

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
This configuration file applies to all detections of type anomaly. These detections will use Risk Based Alerting.

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 develop branch

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
Suspicious commit by $commit.commit.author.email$ to develop branch 9 30 30
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.

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: 3