Detection: GitHub Pull Request from Unknown User

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.

1`github` check_suite.pull_requests{}.id=* 
2| stats count by check_suite.head_commit.author.name repository.full_name check_suite.pull_requests{}.head.ref check_suite.head_commit.message 
3| 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 
4| search NOT `github_known_users` 
5| eval phase="code" 
6| `security_content_ctime(firstTime)` 
7| `security_content_ctime(lastTime)` 
8| `github_pull_request_from_unknown_user_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_pull_request_from_unknown_user_filter search *
github_pull_request_from_unknown_user_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
T1195.001 Compromise Software Dependencies and Development Tools Initial Access
T1195 Supply Chain Compromise Initial Access
KillChainPhase.DELIVERY
NistCategory.DE_AE
Cis18Value.CIS_13
Ember Bear
Sandworm Team

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

You must index GitHub logs. You can follow the url in reference to onboard GitHub logs.

Known False Positives

unknown

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
Vulnerabilities found in packages used by GitHub repository $repository$ 27 30 90
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