11---
22title : " Runbook: Build Pipeline Compromise | Security Alliance"
3- description : " Stub runbook. Customize with your CI/CD platform and procedures ."
3+ description : " Example runbook for CI/CD compromise. Review and customize for your platform, release process, and trust boundaries before use ."
44tags :
55 - Security Specialist
66 - Operations & Strategy
@@ -21,7 +21,7 @@ import { TagList, AttributionList, TagProvider, TagFilter, ContributeFooter } fr
2121<TagList tags = { frontmatter .tags } />
2222<AttributionList contributors = { frontmatter .contributors } />
2323
24- > ** Stub runbook.** Customize with your CI/CD platform and procedures .
24+ > ** This is an example runbook.** Review and customize for your CI/CD platform, artifact flow, deployment model, and approval process before use .
2525
2626## Quick Reference
2727
@@ -36,39 +36,149 @@ import { TagList, AttributionList, TagProvider, TagFilter, ContributeFooter } fr
3636
3737### Symptoms
3838
39- - [ ] Unexpected code in deployed artifacts
40- - [ ] CI/CD configuration changed without approval
41- - [ ] Secrets accessed or exfiltrated
42- - [ ] Unauthorized workflow runs
39+ - [ ] Unexpected workflow runs or releases
40+ - [ ] CI/CD configuration changed without expected approval
41+ - [ ] Secrets accessed, exported, or rotated unexpectedly
42+ - [ ] Build artifacts differ from expected source or prior reproducible output
43+ - [ ] Deployments reference an unexpected commit, artifact, or builder identity
4344
44- ### Confirm Compromise
45+ ### Likely Scope Questions
46+
47+ - Is this limited to CI configuration, or were artifacts actually produced from a compromised pipeline?
48+ - Did the pipeline have deploy permissions, signing authority, or production credentials?
49+ - Were any releases, containers, frontend bundles, or packages published during the exposure window?
50+
51+ ### Differentiation
52+
53+ - Unauthorized code merged without pipeline abuse may be a repository compromise first
54+ - Malicious package updates without CI tampering may be a dependency incident first
55+ - A bad deployment from a legitimate commit may be an operational failure rather than compromise
4556
46- - Review CI/CD audit logs
47- - Compare build artifacts to source
48- - Check for config changes in CI/CD platform
4957
5058## Immediate Actions
5159
52- 1 . [ ] Disable compromised pipelines
53- 2 . [ ] Rotate all secrets and tokens
54- 3 . [ ] Take down potentially compromised deployments
55- 4 . [ ] Audit recent builds and deployments
60+ ### Step 1: Freeze the pipeline
61+
62+ ** Why:** Stop additional malicious builds, releases, or secret access.
63+
64+ - [ ] Disable affected workflows/pipelines
65+ - [ ] Revoke or pause auto-deploy jobs
66+ - [ ] Block manual approvals until scope is understood
67+
68+ ### Step 2: Preserve evidence
69+
70+ ** Why:** CI audit logs, workflow definitions, artifact metadata, and deployment history are easy to overwrite.
71+
72+ - [ ] Export CI audit logs
73+ - [ ] Save workflow/job history for the exposure window
74+ - [ ] Record affected commits, workflow files, artifact digests, release IDs, and deployment targets
75+ - [ ] Preserve runner details if self-hosted runners were involved
76+
77+ ### Step 3: Rotate credentials by blast radius
78+
79+ ** Why:** Pipeline compromise often becomes credential compromise.
80+
81+ Prioritize rotation of:
82+ - [ ] CI platform tokens
83+ - [ ] cloud deploy credentials
84+ - [ ] package registry tokens
85+ - [ ] artifact signing keys or release credentials
86+ - [ ] secrets available to self-hosted runners
87+
88+ ### Step 4: Stop trust in recent outputs
89+
90+ ** Why:** Do not assume recent artifacts or deployments are clean.
91+
92+ - [ ] Identify all artifacts built during the exposure window
93+ - [ ] Identify all deployments and releases from those artifacts
94+ - [ ] Quarantine or withdraw suspicious outputs where possible
95+
96+
97+ ## Investigation
98+
99+ ### Key Questions
100+
101+ - [ ] What was the initial access path: CI platform, repository permissions, runner compromise, or stolen token?
102+ - [ ] What permissions did the compromised pipeline actually have?
103+ - [ ] Were secrets exposed only to logs/runtime, or used to publish or deploy?
104+ - [ ] Which environments were reachable: build only, staging, production?
105+ - [ ] Which outputs must now be treated as untrusted?
106+
107+ ### Information to Gather
108+
109+ | Data | Source |
110+ | ------| --------|
111+ | CI audit logs | CI/CD platform |
112+ | workflow/config diffs | repository history |
113+ | release/deployment history | CI/CD platform, cloud provider, registry |
114+ | artifact digests / provenance | registry, signing system, artifact store |
115+ | runner access and execution logs | runner host / CI platform |
116+
117+
118+ ## Containment and Recovery
119+
120+ ### Option A: Rebuild from a known-good commit using a clean pipeline
121+
122+ ** When:** You can identify a trusted commit and re-establish a trusted build path.
123+ ** Impact:** Release cadence slows, but trust is restored more safely.
124+
125+ 1 . Stand up a clean pipeline or isolated builder
126+ 2 . Re-verify repository state and workflow definitions
127+ 3 . Rebuild from a known-good commit
128+ 4 . Compare output metadata against expected source and release intent
129+ 5 . Redeploy only from the rebuilt trusted output
130+
131+ ### Option B: Roll back to last known-good release
132+
133+ ** When:** A trusted prior release exists and rollback is operationally safe.
134+ ** Impact:** Feature loss or temporary service degradation may occur.
135+
136+ 1 . Identify the last trusted artifact and deployment
137+ 2 . Roll back affected services
138+ 3 . Verify rollback success in production
139+ 4 . Continue investigation before resuming normal release flow
140+
141+ ### Option C: Keep service paused until trust is re-established
142+
143+ ** When:** You cannot distinguish clean from compromised outputs.
144+ ** Impact:** Operational disruption, but lower risk of serving malicious artifacts.
145+
146+ 1 . Pause releases/deployments
147+ 2 . Communicate impact internally and externally as needed
148+ 3 . Rebuild trust in source, pipeline, credentials, and artifacts before resuming
149+
150+
151+ ## Verification Before Resuming
152+
153+ Do not resume normal delivery until you can answer these clearly:
154+
155+ - [ ] The initial access path is understood well enough to prevent immediate recurrence
156+ - [ ] Compromised credentials have been rotated or invalidated
157+ - [ ] Untrusted artifacts and releases have been identified and handled
158+ - [ ] Build and deploy permissions are re-scoped appropriately
159+ - [ ] A known-good artifact has been rebuilt or a known-good release has been restored
160+
161+
162+ ## Hardening After the Incident
163+
164+ - [ ] Separate build permissions from deploy permissions
165+ - [ ] Require stronger approval controls for workflow and release changes
166+ - [ ] Use short-lived credentials where possible
167+ - [ ] Reduce secret exposure to only the jobs that need them
168+ - [ ] Restrict or harden self-hosted runners if used
169+ - [ ] Improve artifact provenance, signing, and release verification
170+
56171
57- ## Mitigation
172+ ## Escalation
58173
59- 1 . [ ] Audit CI/CD configuration for unauthorized changes
60- 2 . [ ] Rebuild from trusted commit using clean pipeline
61- 3 . [ ] Implement additional approval requirements
62- 4 . [ ] Review and restrict pipeline permissions
174+ Escalate immediately if:
175+ - [ ] production deployments may have been modified
176+ - [ ] signing keys or release credentials may be exposed
177+ - [ ] user-facing artifacts may have been maliciously published
178+ - [ ] the pipeline had access to broader cloud or infrastructure credentials
63179
64- ## Prevention
180+ See [ Contacts ] ( ../contacts ) and [ Incident Response Policy ] ( ../incident-response-policy ) .
65181
66- - [ ] Require approval for CI/CD config changes
67- - [ ] Use short-lived credentials
68- - [ ] Implement branch protection
69- - [ ] Audit pipeline access regularly
70- - [ ] Use signed commits
71- - [ ] Separate build and deploy permissions
72182
73183## Related
74184
0 commit comments