This is an ATT&CK-like matrix focus on CI/CD Pipeline specific risk. MITRE ATT&CK® is a knowledge base of adversary tactics and techniques.
To map the threat of CI/CD Pipeline, I use the same classification as the framework.
(Feedback is welcome)
This threat map is published in conjunction to the presentation “Attacking and Securing CI/CD Pipeline” at CODE BLUE 2021 Opentalks.
The purpose of this matrix is to share knowledge on securing CI/CD environments with Cybersecurity community.
This matrix was created by Mercari Security Team, and reviewed by Platform Team.
(Git Repository) Restrict repository admin from pushing to main branch without a review
(CD) Require additional approval from reviewer to kick CD
Access to Secret Manager from CI/CD kicked by different repository
Use a CI/CD system in a different repository to leverage stolen credentials to access secret manager
(Secret Manager) Restrict and separate access from different workloads
Modify Caches of CI/CD
Implant bad code to caches of CI/CD pipeline
(CI, CD) Clean environment on every pipeline run
Implant CI/CD runner images
(Repeated)
Credential Access
Techniques
Description
Mitigation
Dumping Env Variables in CI/CD
Dump Environment Variables in CI/CD
(CI, CD) Don’t use environment variables for storing credentials
(Secret Manager) Use secret manager which has network restriction
(Secret Manager) Enable Audit Logging
(Secret Manager) Security Monitoring to detect malicious activity
(Secret Manager) Rotate credentials regularly or issue temporary tokens only
(CI, CD) Enable Audit Logging
(CI, CD) Security Monitoring using IDS/IPS, and EDR
Access to Cloud Metadata
Access to Cloud Metadata to get access token of Cloud resources
(CI, CD) Restrict metadata access from suspicious processes
(Secret Manager) Use secret manager which has network restriction
(Secret Manager) Enable Audit Logging
(Secret Manager) Security Monitoring to detect malicious activity
(Secret Manager) Rotate credentials regularly or issue temporary tokens only
(CI, CD) Enable Audit Logging
(CI, CD) Security Monitoring using IDS/IPS, and EDR
Read credentials file
Read credentials file mounted in CI/CD pipeline
(CI, CD) Disable or mask contents of files in results of CI/CD
(Secret Manager) Use secret manager which has network restriction
(Secret Manager) Enable Audit Logging
(Secret Manager) Security Monitoring to detect malicious activity
(Secret Manager) Rotate credentials regularly or issue temporary tokens only
(CI, CD) Enable Audit Logging
(CI, CD) Security Monitoring using IDS/IPS, and EDR
Get credential from CI/CD Admin Console
See credential from CI/CD admin console
(CI, CD) Doesn’t use CI/CD services that expose credentials from the system console
Lateral Movement
Techniques
Description
Mitigation
Exploitation of Remote Services
Exploit services from CI/CD Pipeline
(CI, CD) Isolate CI/CD pipeline systems from other services
(Monorepo) Get credential of different folder's context
In monorepo architecture of Git Repository, there are many approvers.
Need to set access controls carefully
(Git Repository) Set approver for each folder
(CI, CD, Secret Manager) Avoid sharing CI/CD environment and credentials between different folders.
(CI, CD) should be isolated by environment folder or context
Privileged Escalation and compromise other CI/CD pipeline
(Repeated)
Exfiltration
Techniques
Description
Mitigation
Exfiltrate data in Production environment
Exfiltrate data in Production environment via stolen credentials
(CI/CD) Doesn’t put data access credential in CI/CD
(Production environment) Network Restriction to Cloud API
(Production environment) Enable Audit Logging
(Production environment) Security Monitoring of data access
(Production environment) Enforce principle of least privilege to issued credentials
(Production environment) Rate limiting
Clone Git Repositories
Exfiltrate data from Git Repositories
(Git Repository) Network Restriction
(Git Repository) Use temporary tokens instead of long life static tokens
(Git Repository) Limit access permission of each developer (e.g. no write permission, limited read permission)
(Git Repository) Enable Audit Logging
(Git Repository) Security Monitoring of data access
(Git Repository) Rate limiting
Impact
Techniques
Description
Mitigation
Denial of Services
Denial of Services of CI/CD pipeline
(CI, CD) Scalable Infrastructure
Common Question
Supply-chain attacks are the only risk of CI/CD pipeline, correct?
Supply-chain attacks are one of the most serious risks. But it is not the only risk for CI/CD Pipelines. The entire attack surface need to be considered. You can check my slide: “Attacking and Securing CI/CD Pipeline” to know risks of CI/CD pipeline