Prerequisites
Before using this skill, ensure:
- Access to system and application logs in {baseDir}/logs/
- Network traffic captures or SIEM data available
- Incident response team contact information
- Backup systems operational and accessible
- Write permissions for incident documentation in {baseDir}/incidents/
- Communication channels established for stakeholder updates
Instructions
1. Incident Detection and Triage
Classify the security incident:
- Incident type (ransomware, data breach, DDoS, insider threat, phishing)
- Severity level (Critical, High, Medium, Low)
- Scope assessment (affected systems, data, users)
- Initial timestamp and detection method
- Potential business impact
2. Immediate Containment Actions
Prevent further damage:
- Isolate affected systems from network
- Disable compromised user accounts
- Block malicious IP addresses at firewall
- Preserve system state for forensics
- Activate incident response team
- Document all containment actions with timestamps
3. Evidence Collection Phase
Gather forensic data systematically:
System Evidence:
- Memory dumps from affected systems
- Disk images for forensic analysis
- Running process listings
- Network connection states
- Registry modifications (Windows)
Log Evidence:
- Authentication logs (successful/failed logins)
- Application logs with error patterns
- Network traffic logs (firewall, IDS/IPS)
- Database access logs
- Web server access/error logs
Network Evidence:
- Packet captures (PCAP files)
- DNS query logs
- Proxy server logs
- Network flow data (NetFlow)
4. Investigation and Analysis
Reconstruct the attack timeline:
- Identify initial access vector (how attackers got in)
- Map lateral movement within network
- Determine data exfiltration attempts
- Identify persistence mechanisms
- Assess privilege escalation methods
- Document indicators of compromise (IOCs)
5. Eradication Phase
Remove threat from environment:
- Remove malware and backdoors
- Close exploited vulnerabilities
- Reset compromised credentials
- Apply security patches
- Update firewall rules
- Verify threat elimination
6. Recovery and Restoration
Restore normal operations:
- Restore systems from clean backups
- Rebuild compromised systems from scratch
- Verify system integrity
- Monitor for reinfection attempts
- Gradually restore services
- Validate business operations
7. Post-Incident Documentation
Create comprehensive incident report:
- Executive summary
- Detailed timeline
- Root cause analysis
- Lessons learned
- Remediation recommendations
- Cost impact assessment
Output
The skill produces:
Primary Output: Incident response playbook saved to {baseDir}/incidents/incident-YYYYMMDD-HHMM.md
Playbook Structure:
# Security Incident Response - [Incident Type]
Date: YYYY-MM-DD HH:MM
Severity: CRITICAL
Status: Contained
## Executive Summary
- Incident type: Ransomware attack
- Detection time: 2024-01-15 08:30 UTC
- Affected systems: 15 servers, 200 workstations
- Business impact: Production halted
- Current status: Contained, recovery in progress
## Timeline of Events
08:30 - Initial detection via EDR alert
08:35 - IT team confirms ransomware encryption
08:40 - Network isolation initiated
09:00 - Incident response team activated
[Detailed timeline continues]
## Containment Actions Taken
✅ Isolated affected network segments
✅ Disabled compromised accounts
✅ Blocked C2 server IPs
✅ Preserved forensic evidence
## Evidence Collected
- Memory dumps: 15 systems
- Log files: {baseDir}/incidents/evidence/logs/
- Network captures: {baseDir}/incidents/evidence/pcaps/
- Malware samples: Quarantined
## IOCs (Indicators of Compromise)
- IP addresses: 203.0.113.45, 198.51.100.78
- File hashes: SHA256 values listed
- Domain names: malicious-c2.example
- Registry keys: HKLM\Software\[malware]
## Remediation Plan
Priority 1 (Immediate):
- Remove ransomware from all systems
- Reset all domain credentials
- Patch vulnerable RDP service
Priority 2 (24 hours):
- Deploy endpoint protection updates
- Implement network segmentation
- Enable MFA for all accounts
Priority 3 (1 week):
- Security awareness training
- Update incident response procedures
- Conduct tabletop exercise
## Recovery Status
- Clean backups identified: 2024-01-14 backup
- Systems rebuilt: 5/15 servers complete
- Services restored: Email, file servers online
- Estimated full recovery: 48 hours
## Communication Log
- 08:45 - Executive team notified
- 09:30 - Legal counsel engaged
- 10:00 - Cyber insurance contacted
- 12:00 - Customer notification prepared
Secondary Outputs:
- IOC list for threat intelligence sharing (JSON/STIX format)
- Evidence chain of custody log
- Stakeholder communication templates
- Post-incident review agenda
Error Handling
Common Issues and Resolutions:
Incomplete Log Data
- Error: "Critical logs missing from {baseDir}/logs/"
- Resolution: Work with available data, note gaps in report
- Action: Improve logging for future incidents
Evidence Contamination
- Error: "System state modified before evidence collection"
- Resolution: Document contamination, collect remaining evidence
- Best Practice: Immediately isolate before investigation
Ongoing Active Threat
- Error: "Attacker still has access during investigation"
- Resolution: Prioritize containment over investigation
- Action: Implement emergency containment procedures first
Insufficient Access for Forensics
- Error: "Permission denied accessing system memory"
- Resolution: Escalate to obtain necessary privileges
- Fallback: Use available logs and network data
Backup Corruption
- Error: "Backups also encrypted by ransomware"
- Resolution: Identify offline/air-gapped backups
- Contingency: Assess rebuild from scratch vs ransom payment
Resources
Incident Response Frameworks:
Forensic Tools:
- Memory analysis: Volatility Framework
- Disk forensics: Autopsy, FTK Imager
- Network analysis: Wireshark, tcpdump
- Log analysis: ELK Stack, Splunk
Threat Intelligence:
Communication Templates:
- Breach notification requirements by jurisdiction
- Customer communication guidelines
- Media response templates
- Regulatory reporting formats (GDPR, HIPAA, etc.)
Playbook Templates:
- Ransomware response: {baseDir}/templates/playbook-ransomware.md
- Data breach response: {baseDir}/templates/playbook-breach.md
- DDoS response: {baseDir}/templates/playbook-ddos.md
Legal and Compliance:
- Chain of custody documentation
- eDiscovery preparation
- Cyber insurance claim procedures
- Law enforcement coordination
1---2name: responding-to-security-incidents3description: |4 Guide security incident response, investigation, and remediation processes.5 Use when you need to handle security breaches, classify incidents, develop response playbooks, gather forensic evidence, or coordinate remediation efforts.6 Trigger with phrases like "security incident response", "ransomware attack response", "data breach investigation", "incident playbook", or "security forensics".7allowed-tools:8- Read9- Write10- Edit11- Grep12- Glob13- Bash(log-analysis:*, forensics:*, network-trace:*)14version: 1.0.015license: MIT16---1718## Prerequisites1920Before using this skill, ensure:21- Access to system and application logs in {baseDir}/logs/22- Network traffic captures or SIEM data available23- Incident response team contact information24- Backup systems operational and accessible25- Write permissions for incident documentation in {baseDir}/incidents/26- Communication channels established for stakeholder updates2728## Instructions2930### 1. Incident Detection and Triage3132Classify the security incident:33- Incident type (ransomware, data breach, DDoS, insider threat, phishing)34- Severity level (Critical, High, Medium, Low)35- Scope assessment (affected systems, data, users)36- Initial timestamp and detection method37- Potential business impact3839### 2. Immediate Containment Actions4041Prevent further damage:42- Isolate affected systems from network43- Disable compromised user accounts44- Block malicious IP addresses at firewall45- Preserve system state for forensics46- Activate incident response team47- Document all containment actions with timestamps4849### 3. Evidence Collection Phase5051Gather forensic data systematically:5253**System Evidence**:54- Memory dumps from affected systems55- Disk images for forensic analysis56- Running process listings57- Network connection states58- Registry modifications (Windows)5960**Log Evidence**:61- Authentication logs (successful/failed logins)62- Application logs with error patterns63- Network traffic logs (firewall, IDS/IPS)64- Database access logs65- Web server access/error logs6667**Network Evidence**:68- Packet captures (PCAP files)69- DNS query logs70- Proxy server logs71- Network flow data (NetFlow)7273### 4. Investigation and Analysis7475Reconstruct the attack timeline:76- Identify initial access vector (how attackers got in)77- Map lateral movement within network78- Determine data exfiltration attempts79- Identify persistence mechanisms80- Assess privilege escalation methods81- Document indicators of compromise (IOCs)8283### 5. Eradication Phase8485Remove threat from environment:86- Remove malware and backdoors87- Close exploited vulnerabilities88- Reset compromised credentials89- Apply security patches90- Update firewall rules91- Verify threat elimination9293### 6. Recovery and Restoration9495Restore normal operations:96- Restore systems from clean backups97- Rebuild compromised systems from scratch98- Verify system integrity99- Monitor for reinfection attempts100- Gradually restore services101- Validate business operations102103### 7. Post-Incident Documentation104105Create comprehensive incident report:106- Executive summary107- Detailed timeline108- Root cause analysis109- Lessons learned110- Remediation recommendations111- Cost impact assessment112113## Output114115The skill produces:116117**Primary Output**: Incident response playbook saved to {baseDir}/incidents/incident-YYYYMMDD-HHMM.md118119**Playbook Structure**:120```121# Security Incident Response - [Incident Type]122Date: YYYY-MM-DD HH:MM123Severity: CRITICAL124Status: Contained125126## Executive Summary127- Incident type: Ransomware attack128- Detection time: 2024-01-15 08:30 UTC129- Affected systems: 15 servers, 200 workstations130- Business impact: Production halted131- Current status: Contained, recovery in progress132133## Timeline of Events13408:30 - Initial detection via EDR alert13508:35 - IT team confirms ransomware encryption13608:40 - Network isolation initiated13709:00 - Incident response team activated138[Detailed timeline continues]139140## Containment Actions Taken141✅ Isolated affected network segments142✅ Disabled compromised accounts143✅ Blocked C2 server IPs144✅ Preserved forensic evidence145146## Evidence Collected147- Memory dumps: 15 systems148- Log files: {baseDir}/incidents/evidence/logs/149- Network captures: {baseDir}/incidents/evidence/pcaps/150- Malware samples: Quarantined151152## IOCs (Indicators of Compromise)153- IP addresses: 203.0.113.45, 198.51.100.78154- File hashes: SHA256 values listed155- Domain names: malicious-c2.example156- Registry keys: HKLM\Software\[malware]157158## Remediation Plan159Priority 1 (Immediate):160- Remove ransomware from all systems161- Reset all domain credentials162- Patch vulnerable RDP service163164Priority 2 (24 hours):165- Deploy endpoint protection updates166- Implement network segmentation167- Enable MFA for all accounts168169Priority 3 (1 week):170- Security awareness training171- Update incident response procedures172- Conduct tabletop exercise173174## Recovery Status175- Clean backups identified: 2024-01-14 backup176- Systems rebuilt: 5/15 servers complete177- Services restored: Email, file servers online178- Estimated full recovery: 48 hours179180## Communication Log181- 08:45 - Executive team notified182- 09:30 - Legal counsel engaged183- 10:00 - Cyber insurance contacted184- 12:00 - Customer notification prepared185```186187**Secondary Outputs**:188- IOC list for threat intelligence sharing (JSON/STIX format)189- Evidence chain of custody log190- Stakeholder communication templates191- Post-incident review agenda192193## Error Handling194195**Common Issues and Resolutions**:1961971. **Incomplete Log Data**198 - Error: "Critical logs missing from {baseDir}/logs/"199 - Resolution: Work with available data, note gaps in report200 - Action: Improve logging for future incidents2012022. **Evidence Contamination**203 - Error: "System state modified before evidence collection"204 - Resolution: Document contamination, collect remaining evidence205 - Best Practice: Immediately isolate before investigation2062073. **Ongoing Active Threat**208 - Error: "Attacker still has access during investigation"209 - Resolution: Prioritize containment over investigation210 - Action: Implement emergency containment procedures first2112124. **Insufficient Access for Forensics**213 - Error: "Permission denied accessing system memory"214 - Resolution: Escalate to obtain necessary privileges215 - Fallback: Use available logs and network data2162175. **Backup Corruption**218 - Error: "Backups also encrypted by ransomware"219 - Resolution: Identify offline/air-gapped backups220 - Contingency: Assess rebuild from scratch vs ransom payment221222## Resources223224**Incident Response Frameworks**:225- NIST Computer Security Incident Handling Guide: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-61r2.pdf226- SANS Incident Handler's Handbook: https://www.sans.org/white-papers/33901/227- CISA Incident Response Guide: https://www.cisa.gov/incident-response228229**Forensic Tools**:230- Memory analysis: Volatility Framework231- Disk forensics: Autopsy, FTK Imager232- Network analysis: Wireshark, tcpdump233- Log analysis: ELK Stack, Splunk234235**Threat Intelligence**:236- MITRE ATT&CK Framework: https://attack.mitre.org/237- AlienVault OTX: https://otx.alienvault.com/238- VirusTotal: https://www.virustotal.com/239240**Communication Templates**:241- Breach notification requirements by jurisdiction242- Customer communication guidelines243- Media response templates244- Regulatory reporting formats (GDPR, HIPAA, etc.)245246**Playbook Templates**:247- Ransomware response: {baseDir}/templates/playbook-ransomware.md248- Data breach response: {baseDir}/templates/playbook-breach.md249- DDoS response: {baseDir}/templates/playbook-ddos.md250251**Legal and Compliance**:252- Chain of custody documentation253- eDiscovery preparation254- Cyber insurance claim procedures255- Law enforcement coordination