Detection: Circle CI Disable Security Step

EXPERIMENTAL DETECTION

This detection status is set to experimental. The Splunk Threat Research team has not yet fully tested, simulated, or built comprehensive datasets for this detection. As such, this analytic is not officially supported. If you have any questions or concerns, please reach out to us at research@splunk.com.

Description

The following analytic detects the disablement of security steps in a CircleCI pipeline. It leverages CircleCI logs, using field renaming, joining, and statistical analysis to identify instances where mandatory security steps are not executed. This activity is significant because disabling security steps can introduce vulnerabilities, unauthorized changes, or malicious code into the pipeline. If confirmed malicious, this could lead to potential attacks, data breaches, or compromised infrastructure. Investigate by reviewing job names, commit details, and user information associated with the disablement, and examine any relevant artifacts and concurrent processes.

 1`circleci` 
 2| rename workflows.job_id AS job_id 
 3| join job_id [ 
 4| search `circleci` 
 5| stats values(name) as step_names count by job_id job_name ] 
 6| stats count by step_names job_id job_name vcs.committer_name vcs.subject vcs.url owners{} 
 7| rename vcs.* as * , owners{} as user 
 8| lookup mandatory_step_for_job job_name OUTPUTNEW step_name AS mandatory_step 
 9| search mandatory_step=* 
10| eval mandatory_step_executed=if(like(step_names, "%".mandatory_step."%"), 1, 0) 
11| where mandatory_step_executed=0 
12| rex field=url "(?<repository>[^\/]*\/[^\/]*)$" 
13| eval phase="build"  
14| `security_content_ctime(firstTime)` 
15| `security_content_ctime(lastTime)` 
16| `circle_ci_disable_security_step_filter`

Data Source

Name Platform Sourcetype Source
CircleCI N/A 'circleci' 'circleci'

Macros Used

Name Value
circleci sourcetype=circleci
circle_ci_disable_security_step_filter search *
circle_ci_disable_security_step_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
T1554 Compromise Host Software Binary Persistence
KillChainPhase.INSTALLATION
NistCategory.DE_AE
Cis18Value.CIS_13
APT5

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 CircleCI logs.

Known False Positives

unknown

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
Disable security step $mandatory_step$ in job $job_name$ from user $user$ 72 80 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.

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Not Applicable N/A N/A N/A
Unit Passing Dataset circleci circleci
Integration ✅ Passing Dataset circleci circleci

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