Detection: Circle CI Disable Security Job

Description

The following analytic detects the disabling of security jobs in CircleCI pipelines. It leverages CircleCI log data, renaming and extracting fields such as job names, workflow IDs, user information, commit messages, URLs, and branches. The detection identifies mandatory jobs for each workflow and checks if they were executed. This activity is significant because disabling security jobs can allow malicious code to bypass security checks, leading to potential data breaches, system downtime, and reputational damage. If confirmed malicious, this could result in unauthorized code execution and compromised pipeline integrity.

 1`circleci` 
 2| rename vcs.committer_name as user vcs.subject as commit_message vcs.url as url workflows.* as *  
 3| stats values(job_name) as job_names by workflow_id workflow_name user commit_message url branch 
 4| lookup mandatory_job_for_workflow workflow_name OUTPUTNEW job_name AS mandatory_job 
 5| search mandatory_job=* 
 6| eval mandatory_job_executed=if(like(job_names, "%".mandatory_job."%"), 1, 0) 
 7| where mandatory_job_executed=0 
 8| eval phase="build" 
 9| rex field=url "(?<repository>[^\/]*\/[^\/]*)$" 
10| `security_content_ctime(firstTime)` 
11| `security_content_ctime(lastTime)` 
12| `circle_ci_disable_security_job_filter`

Data Source

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

Macros Used

Name Value
circleci sourcetype=circleci
circle_ci_disable_security_job_filter search *
circle_ci_disable_security_job_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 job $mandatory_job$ in workflow $workflow_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 Passing 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: 2