Handle security incidents with IR playbooks and procedures. Implement detection, containment, eradication, and recovery processes. Use when responding to security events or building incident response capabilities.
Instrucciones de origen · Vista previa de solo lectura
name
incident-response
description
Handle security incidents with IR playbooks and procedures. Implement detection, containment, eradication, and recovery processes. Use when responding to security events or building incident response capabilities.
license
MIT
metadata
{"author":"devops-skills","version":"1.0"}
Incident Response
Handle security incidents effectively with structured response procedures.
When to Use This Skill
Use this skill when:
Responding to an active security incident (breach, malware, unauthorized access)
Building incident response playbooks and runbooks
Conducting IR tabletop exercises and drills
Setting up evidence collection and forensic capabilities
Establishing communication protocols for security events
Performing post-incident reviews and process improvements
Prerequisites
IR team roster with on-call rotation and escalation paths
Secure communication channel (separate from production systems)
Forensic workstation with analysis tools installed
# --- Disk forensics ---# Create forensic image of a diskddif=/dev/sda of=/evidence/disk.img bs=4M status=progress
sha256sum /evidence/disk.img > /evidence/disk.img.sha256
# Mount forensic image read-only
mount -o ro,loop,noexec /evidence/disk.img /mnt/forensic
# Find recently modified files
find /mnt/forensic -type f -mtime -3 -ls | sort -k11
# Find files by owner
find /mnt/forensic -user www-data -type f -newer /tmp/reference-time -ls# --- Log analysis ---# Search auth logs for brute force
grep "Failed password" /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -rn | head -20
# Search for privilege escalation
grep -E "(sudo|su\[)" /var/log/auth.log | grep -v "session opened"# Search web logs for attack patterns
grep -iE "(union.*select|<script|\.\.\/|%00)" /var/log/nginx/access.log
# Timeline analysis with find
find / -newermt "2025-01-15 00:00" ! -newermt "2025-01-16 00:00" -ls 2>/dev/null | sort -k9
# --- Network forensics ---# Capture network traffic
tcpdump -i eth0 -w /evidence/capture.pcap -c 100000
# Analyze pcap for suspicious connections
tcpdump -r /evidence/capture.pcap -nn 'dst port 4444 or dst port 8888 or dst port 1337'# Check for DNS tunneling
tcpdump -r /evidence/capture.pcap -nn 'udp port 53' | awk '{print $NF}' | sort | -c | -rn | -20
suspicious_file
strings suspicious_file | grep -iE
file suspicious_file
readelf -h suspicious_file 2>/dev/null
Communication Templates
Initial Notification (Internal)
## Security Incident Notification**Incident ID:** INC-YYYY-NNNN
**Severity:** [Critical/High/Medium/Low]
**Status:** Active - Investigating
**Time Detected:** YYYY-MM-DD HH:MM UTC
**Reported By:** [Name/System]
### Summary
[1-2 sentence description of what was detected]
### Impact Assessment-**Systems affected:** [list]
-**Data at risk:** [type and scope]
-**Users impacted:** [count/scope]
-**Business impact:** [description]
### Current Actions- [ ] Evidence preservation in progress
- [ ] Containment measures being applied
- [ ] IR team assembled
### Next Update
Expected at: YYYY-MM-DD HH:MM UTC
### Incident Commander
[Name] - [Contact info]
Stakeholder Update
## Incident Update - INC-YYYY-NNNN**Update #:** N
**Time:** YYYY-MM-DD HH:MM UTC
**Severity:** [unchanged/upgraded/downgraded]
**Status:** [Investigating/Contained/Eradicating/Recovering/Resolved]
### Progress Since Last Update- [Bullet points of actions taken]
### Current Understanding-**Root cause:** [Known/Under investigation]
-**Scope:** [Expanded/Unchanged/Reduced]
-**Threat actor:** [If applicable]
### Active Containment Measures- [List of measures in place]
### Next Steps- [Planned actions with ETA]
### Decisions Needed- [If any decisions required from leadership]
External Breach Notification (if required)
## Notice of Data Security Incident
Dear [Customer/Partner],
We are writing to inform you of a security incident that we detected on
[date]. Upon discovery, we immediately activated our incident response
procedures and engaged external cybersecurity experts.
### What Happened
[Brief, factual description]
### What Information Was Involved
[Types of data affected]
### What We Are Doing
[Remediation steps taken and planned]
### What You Can Do
[Recommended actions for affected parties]
### Contact Information
For questions, please contact: [dedicated contact/hotline]
[Company Name]
[Date]
IR Playbook: Compromised Credentials
playbook:compromised-credentialstrigger:"Alert indicating credential theft, brute force success, or credential dump"steps:1_validate:-Confirmthealertisnotafalsepositive-Identifywhichcredentialsarecompromised-Determinescope(singleuser,serviceaccount,APIkey)2_contain:-Disablecompromisedaccountsimmediately-Revokeactivesessionsandtokens-RotateAPIkeysandserviceaccountcredentials-BlocksourceIPifidentifiedcommands:
Troubleshooting
Problem
Cause
Solution
Evidence collection script fails
Insufficient permissions
Run with sudo/root; pre-authorize IR accounts
Cannot access compromised system
System encrypted by ransomware
Use offline disk imaging; restore from backups
Logs are missing or tampered
Attacker cleared logs
Check centralized log aggregator; restore from log backups
Cannot determine incident scope
Insufficient logging
Enable CloudTrail, VPC flow logs, audit logging for future
Stakeholders demanding immediate answers
Pressure to resolve quickly
Follow IR process; provide regular updates; avoid speculation
False positive triggered full IR
Detection rules too sensitive
Tune alerting thresholds; add validation step before escalation
Evidence integrity questioned
No chain of custody
Hash all evidence immediately; document who accessed what and when
Best Practices
Pre-define and practice playbooks with tabletop exercises quarterly
Maintain separate, secure communication channels for IR (not email or Slack on corporate infra)
Always preserve evidence before making changes to compromised systems
Establish chain of custody for all collected evidence
Engage legal counsel early in any potential data breach
Conduct blameless post-incident reviews within 72 hours
Update detection rules and playbooks based on lessons learned
Pre-authorize common IR actions so responders can act without delay
Keep an IR "go bag" with tools, credentials, and documentation ready
Test backup restoration procedures regularly (not just backup creation)