Incident Response
What This Does
Provides a structured incident response playbook for security events — from initial detection through containment, investigation, remediation, and post-incident review. Designed to be followed step-by-step during an active incident, with checklists and decision trees for common scenarios.
Instructions
Phase 1: Detection and Triage (First 15 minutes)
Confirm the incident. Is this a real security event or a false alarm?
- What triggered the alert? (monitoring, user report, external notification)
- What evidence exists? (logs, screenshots, error messages)
- Is it ongoing or historical?
Classify severity.
| Severity |
Criteria |
Response |
| SEV-1 |
Active data breach, production down, ransomware |
All hands, external comms |
| SEV-2 |
Confirmed compromise, no active exfiltration |
Incident team, management notified |
| SEV-3 |
Suspected compromise, limited scope |
On-call engineer investigates |
| SEV-4 |
Low-risk event, needs investigation |
Scheduled review |
Assemble the response team.
- Incident commander (owns the response)
- Technical lead (drives investigation)
- Communications (internal and external)
- Legal (if data breach involves PII/regulated data)
Phase 2: Containment (First 1 hour)
Stop the bleeding. Immediate containment actions:
Priority order:
1. Revoke compromised credentials (API keys, tokens, passwords)
2. Block attacker IP/account if identified
3. Isolate affected systems (disable network access, not shut down)
4. Disable compromised accounts
5. Enable enhanced logging on affected systems
Do NOT:
- Shut down affected servers (preserves evidence in memory)
- Delete or modify logs
- Communicate externally before legal review
- Attempt to "hack back"
Preserve evidence.
- Take disk snapshots of affected systems
- Export relevant logs before rotation
- Screenshot active sessions or indicators
- Record timestamps of all containment actions
- Document the chain of custody for all evidence
Phase 3: Investigation (Hours 1-24)
Determine scope. Answer these questions:
- What systems were accessed?
- What data was potentially exposed?
- How did the attacker gain access? (initial access vector)
- How long has the attacker had access? (dwell time)
- What actions did the attacker take? (lateral movement, exfiltration)
Investigation checklist:
[ ] Review authentication logs for anomalous logins
[ ] Check for new/modified user accounts
[ ] Review API access logs for unusual patterns
[ ] Check for data exports or bulk downloads
[ ] Review system/application logs for errors or anomalies
[ ] Check for modified files or new files on servers
[ ] Review network traffic logs for unusual destinations
[ ] Check for persistence mechanisms (cron jobs, startup scripts)
[ ] Review CI/CD pipeline for unauthorized changes
[ ] Check third-party integrations for compromised tokens
Build the timeline. Reconstruct events chronologically:
YYYY-MM-DD HH:MM - {Event description} - {Source: log/report}
YYYY-MM-DD HH:MM - {Event description} - {Source: log/report}
Phase 4: Remediation (Hours 24-72)
Eradicate the threat.
- Remove all attacker persistence mechanisms
- Patch the vulnerability that enabled access
- Rotate ALL credentials (not just confirmed compromised ones)
- Rebuild affected systems from known-good state
- Update WAF/firewall rules to block the attack vector
Verify remediation.
- Scan for remaining indicators of compromise
- Test that the vulnerability is patched
- Confirm attacker access is fully revoked
- Monitor for signs of re-entry
Phase 5: Recovery and Review (Days 3-14)
Restore services.
- Bring systems back online in order of criticality
- Monitor closely for 48 hours post-restoration
- Verify data integrity
Notifications.
- Internal stakeholders (management, board if severe)
- Affected users (if data was exposed)
- Regulators (GDPR: 72 hours, HIPAA: 60 days, PCI: varies)
- Law enforcement (if criminal activity suspected)
Post-incident review.
- Schedule blameless retrospective within 1 week
- Document: what happened, impact, timeline, root cause, what went well, what didn't
- Create action items to prevent recurrence
- Update incident response procedures based on lessons learned
Output Format
# Incident Response: {Incident Title}
**Severity:** {SEV-1/2/3/4}
**Status:** {Active / Contained / Resolved / Post-Mortem}
**Detected:** {timestamp}
**Contained:** {timestamp}
**Resolved:** {timestamp}
## Summary
{2-3 sentences: what happened, impact, current status}
## Timeline
| Time | Event | Source |
|------|-------|--------|
| {time} | {event} | {source} |
## Affected Systems
| System | Impact | Status |
|--------|--------|--------|
| {system} | {what was affected} | {contained/resolved} |
## Root Cause
{How the attacker gained access and what vulnerability was exploited}
## Remediation Actions
- [x] {Completed action}
- [ ] {Pending action}
## Data Impact
- Records potentially exposed: {count}
- Data types: {PII, financial, credentials, etc.}
- Notification required: {yes/no — which regulations}
## Lessons Learned
- What went well: {list}
- What didn't go well: {list}
- Action items: {list with owners and deadlines}
Tips
- Speed matters: contain first, investigate second — don't let perfect investigation delay stopping the breach
- Never communicate externally without legal review — breach notification laws are specific and penalties are real
- Preserve logs immediately — log rotation can destroy critical evidence within hours
- A blameless post-mortem is essential — if people fear blame, they'll hide information
- Keep a running log during the incident — memory is unreliable under stress
- Practice incident response before you need it — tabletop exercises save real-world time
- After the incident, run
variant-analysis to find similar vulnerabilities elsewhere in the codebase
1---2name: incident-response3description: Security incident response playbook — containment, investigation, remediation, and post-incident review procedures.4---56# Incident Response78## What This Does910Provides a structured incident response playbook for security events — from initial detection through containment, investigation, remediation, and post-incident review. Designed to be followed step-by-step during an active incident, with checklists and decision trees for common scenarios.1112## Instructions1314### Phase 1: Detection and Triage (First 15 minutes)15161. **Confirm the incident.** Is this a real security event or a false alarm?17 - What triggered the alert? (monitoring, user report, external notification)18 - What evidence exists? (logs, screenshots, error messages)19 - Is it ongoing or historical?20212. **Classify severity.**2223 | Severity | Criteria | Response |24 |----------|----------|----------|25 | SEV-1 | Active data breach, production down, ransomware | All hands, external comms |26 | SEV-2 | Confirmed compromise, no active exfiltration | Incident team, management notified |27 | SEV-3 | Suspected compromise, limited scope | On-call engineer investigates |28 | SEV-4 | Low-risk event, needs investigation | Scheduled review |29303. **Assemble the response team.**31 - Incident commander (owns the response)32 - Technical lead (drives investigation)33 - Communications (internal and external)34 - Legal (if data breach involves PII/regulated data)3536### Phase 2: Containment (First 1 hour)37384. **Stop the bleeding.** Immediate containment actions:39 ```40 Priority order:41 1. Revoke compromised credentials (API keys, tokens, passwords)42 2. Block attacker IP/account if identified43 3. Isolate affected systems (disable network access, not shut down)44 4. Disable compromised accounts45 5. Enable enhanced logging on affected systems46 ```4748 **Do NOT:**49 - Shut down affected servers (preserves evidence in memory)50 - Delete or modify logs51 - Communicate externally before legal review52 - Attempt to "hack back"53545. **Preserve evidence.**55 - Take disk snapshots of affected systems56 - Export relevant logs before rotation57 - Screenshot active sessions or indicators58 - Record timestamps of all containment actions59 - Document the chain of custody for all evidence6061### Phase 3: Investigation (Hours 1-24)62636. **Determine scope.** Answer these questions:64 - What systems were accessed?65 - What data was potentially exposed?66 - How did the attacker gain access? (initial access vector)67 - How long has the attacker had access? (dwell time)68 - What actions did the attacker take? (lateral movement, exfiltration)69707. **Investigation checklist:**71 ```72 [ ] Review authentication logs for anomalous logins73 [ ] Check for new/modified user accounts74 [ ] Review API access logs for unusual patterns75 [ ] Check for data exports or bulk downloads76 [ ] Review system/application logs for errors or anomalies77 [ ] Check for modified files or new files on servers78 [ ] Review network traffic logs for unusual destinations79 [ ] Check for persistence mechanisms (cron jobs, startup scripts)80 [ ] Review CI/CD pipeline for unauthorized changes81 [ ] Check third-party integrations for compromised tokens82 ```83848. **Build the timeline.** Reconstruct events chronologically:85 ```86 YYYY-MM-DD HH:MM - {Event description} - {Source: log/report}87 YYYY-MM-DD HH:MM - {Event description} - {Source: log/report}88 ```8990### Phase 4: Remediation (Hours 24-72)91929. **Eradicate the threat.**93 - Remove all attacker persistence mechanisms94 - Patch the vulnerability that enabled access95 - Rotate ALL credentials (not just confirmed compromised ones)96 - Rebuild affected systems from known-good state97 - Update WAF/firewall rules to block the attack vector989910. **Verify remediation.**100 - Scan for remaining indicators of compromise101 - Test that the vulnerability is patched102 - Confirm attacker access is fully revoked103 - Monitor for signs of re-entry104105### Phase 5: Recovery and Review (Days 3-14)10610711. **Restore services.**108 - Bring systems back online in order of criticality109 - Monitor closely for 48 hours post-restoration110 - Verify data integrity11111212. **Notifications.**113 - Internal stakeholders (management, board if severe)114 - Affected users (if data was exposed)115 - Regulators (GDPR: 72 hours, HIPAA: 60 days, PCI: varies)116 - Law enforcement (if criminal activity suspected)11711813. **Post-incident review.**119 - Schedule blameless retrospective within 1 week120 - Document: what happened, impact, timeline, root cause, what went well, what didn't121 - Create action items to prevent recurrence122 - Update incident response procedures based on lessons learned123124## Output Format125126```markdown127# Incident Response: {Incident Title}128**Severity:** {SEV-1/2/3/4}129**Status:** {Active / Contained / Resolved / Post-Mortem}130**Detected:** {timestamp}131**Contained:** {timestamp}132**Resolved:** {timestamp}133134## Summary135{2-3 sentences: what happened, impact, current status}136137## Timeline138| Time | Event | Source |139|------|-------|--------|140| {time} | {event} | {source} |141142## Affected Systems143| System | Impact | Status |144|--------|--------|--------|145| {system} | {what was affected} | {contained/resolved} |146147## Root Cause148{How the attacker gained access and what vulnerability was exploited}149150## Remediation Actions151- [x] {Completed action}152- [ ] {Pending action}153154## Data Impact155- Records potentially exposed: {count}156- Data types: {PII, financial, credentials, etc.}157- Notification required: {yes/no — which regulations}158159## Lessons Learned160- What went well: {list}161- What didn't go well: {list}162- Action items: {list with owners and deadlines}163```164165## Tips166167- Speed matters: contain first, investigate second — don't let perfect investigation delay stopping the breach168- Never communicate externally without legal review — breach notification laws are specific and penalties are real169- Preserve logs immediately — log rotation can destroy critical evidence within hours170- A blameless post-mortem is essential — if people fear blame, they'll hide information171- Keep a running log during the incident — memory is unreliable under stress172- Practice incident response before you need it — tabletop exercises save real-world time173- After the incident, run `variant-analysis` to find similar vulnerabilities elsewhere in the codebase