Incident Response
Incident response is the difference between a bad week and an existential event. When something goes wrong at 2am, the difference in outcome comes almost entirely from preparation: who is on call, who can approve containment, where the logs live, and what the company is allowed to say to customers and regulators. This lesson follows the lifecycle as it actually happens, including the judgment calls that no checklist can make for you.
What counts as an incident
A security incident is an event that jeopardizes confidentiality, integrity or availability of systems or data — as opposed to a problem, which is the underlying cause, or a change, which is planned work. Ransomware is an incident; the unpatched server that let it in is the problem. Defining the term in advance matters because it triggers obligations: a defined incident starts the clock on containment, on executive notification, and in some jurisdictions on regulatory reporting.
| Severity | Typical trigger | Response time | Who is engaged |
|---|---|---|---|
| Critical | Confirmed data breach, active ransomware, domain compromise | Immediate, 24/7 | Incident commander, executives, legal, PR |
| High | Malware on a server, unauthorized admin access | Within 1 hour | IR lead, system owners |
| Medium | Single-endpoint infection, policy violation with exposure | Within 4 hours | SOC, IT operations |
| Low | Scanning noise, contained phishing with no click | Within 24 hours | SOC, tracked in queue |
Severity drives response time, and response time drives which humans you can wake. Agree the matrix with business leadership before an incident, because negotiating severity at 3am while systems are down is how containment gets delayed. Classification should also consider data sensitivity and regulatory exposure: an incident involving health or payment data carries notification duties that a same-technique incident on a test system does not, and the severity matrix should reflect that difference explicitly rather than leaving it to whoever picks up the phone.
The lifecycle: detection through lessons learned
The NIST model — preparation, detection and analysis, containment, eradication, recovery, lessons learned — is not a waterfall. Detection overlaps analysis, containment decisions happen throughout, and recovery begins while eradication is still underway on other hosts. What the model provides is a shared vocabulary so that a team under stress knows which phase it is in and what that phase requires.
Preparation is where most of the outcome is decided: documented roles, an on-call rota, retained tooling, tabletop exercises, and evidence-collection kits ready to run. Teams that practice respond in hours; teams that improvise respond in days.
Detection and analysis turn signals into a confirmed incident. The hard part is triage — distinguishing an intrusion from a broken deployment — and then scoping: which accounts, which hosts, what time range, what data was touched.
# First fifteen minutes: establish scope from authentication and process evidence
sudo tail -200 /var/log/auth.log | grep -E 'Accepted|Failed' | awk '{print $1,$2,$3,$9,$11}' | sort | uniq -c
sudo last -n 50 -F | head -30
sudo journalctl --since "24 hours ago" | grep -iE 'sudo|session opened|failed' | tail -50
# Is anything talking to infrastructure it never talks to?
sudo ss -tnp established
sudo ps auxf | head -40
sudo find / -xdev -mmin -180 -type f -size +1M 2>/dev/null | grep -vE '^/(proc|sys|usr|var/lib)' | head -30
# Centralized check: the same question across every host in the estate
# (Splunk) index=main earliest=-24h | stats count by src_ip, dest, action | sort -count desc
Analysis must separate facts from hypotheses and write both down. "At 03:14 a service account authenticated from an unfamiliar address" is a fact; "this is a stolen VPN credential" is a hypothesis to test against MFA logs and device posture. Investigators who blur the two build confident timelines full of errors.
Containment: choosing the least-damaging brake
Containment protects evidence and limits spread, but it is a business decision with a cost. Isolating a server stops the attacker and stops the order pipeline. Cutting off an account may lock out the attacker and the employee who owns it. Two containment strategies coexist: short-term (network isolation, account disablement, blocking an indicator at the perimeter) to stop the bleeding, and long-term (segment rebuild, credential rotation across the estate) while you still have the attacker's playbook.
# Short-term isolation without powering the host off (powering off destroys memory evidence)
sudo nft add rule inet firewall input saddr 198.51.100.7 drop
sudo nft add rule inet firewall output daddr 198.51.100.7 drop
# Freeze an account without deleting it, preserving attribution
sudo usermod -L suspectsvc # lock the password
sudo chage -l suspectsvc # record current state for the timeline
# Capture volatile memory BEFORE rebuilding anything, then hash the image
sudo dd if=/dev/mem bs=1M status=progress | gzip -c > /evidence/$(date +%s)-mem.img.gz
sha256sum /evidence/*.img.gz | tee /evidence/HASHES.txt
The sequencing rule that gets broken most often: collect volatile evidence before eradication. Memory contains injected code, running implants and decrypted material that no amount of later analysis can recover from a rebuilt disk. If your policy is to wipe immediately, you have also chosen to lose the root cause.
Eradication and recovery with verification
Eradication removes the attacker's foothold — malware, persistence mechanisms, rogue accounts, scheduled tasks, poisoned SSH keys — and patches the entry point. Recovery restores service and then verifies it: watch for re-infection, confirm monitoring is working, and hold heightened vigilance for at least one full business cycle.
# Persistence sweep before declaring the host clean
sudo grep -R "PermitRootLogin yes" /etc/ssh /etc/ssh/sshd_config.d 2>/dev/null
sudo crontab -l; for u in $(cut -f1 -d: /etc/passwd); do echo "== $u"; crontab -u "$u" -l 2>/dev/null; done
sudo find / -xdev -name "*.so" -mmin -2880 -newer /etc/os-release 2>/dev/null | head
# Verify integrity against a known-good baseline rather than by eye
sudo rpm -Va 2>/dev/null | head -20 # dpkg --verify on Debian systems
# Recovery gate: does normal operation resume without new alerts?
sudo systemctl status --failed
journalctl -p err --since "1 hour ago" | tail -20
Declaring recovery is a decision with criteria: the entry point is closed, credentials and keys that could have been exposed are rotated, monitoring covers the technique used, and no new indicators have appeared for a defined window. Write the criteria down so the declaration is not a mood.
Evidence, chain of custody and the legal track
If a matter may reach court or a regulator, evidence handling decides whether your findings survive scrutiny. Chain of custody records who collected each item, when, where, with what tool, and every transfer since — a gap means an opposing expert will argue the item could have been altered.
Chain of custody — minimum fields for every item
Evidence ID: INC-2026-014 / item 003
Source: web02.internal, /var/log/auth.log (copy, original untouched)
Collected by: A. Rivera, 2026-03-14 09:41 UTC
Method: dd + sha256, write blocker where hardware was involved
Original hash: 9f2c...e41b (recorded at collection)
Verified hash: 9f2c...e41b (re-verified at each transfer)
Transfers: 09:41 Rivera -> evidence store; 11:02 store -> legal hold
Storage: encrypted, access-logged, retention under legal hold
Collect only what you are authorized to collect, respect privacy laws and works-council agreements, and remember that logs about employees are personal data too.
Communication: the part nobody rehearses
Incidents generate audiences with different needs: the technical team needs facts, executives need business impact and decisions required, customers need plain language and a timeline, and regulators need specific disclosures within statutory deadlines. Pre-draft templates for each and nominate a single spokesperson, because contradictory public statements do more damage than the original breach.
Internal communication should be factual and time-stamped on a single channel reserved for the incident, with speculation clearly labeled. Externally, never speculate about cause, never promise what legal has not approved, and never minimize — a statement you must walk back compounds the incident. When notification is legally required, the clock usually starts at discovery, not at confirmation, so legal counsel belongs in the room from the first hour.
Lessons learned: the only phase that improves the next incident
A blameless post-incident review within two weeks asks four questions: what happened, why was it possible, why did we find it when we did, and what changes prevent recurrence. Assign each action an owner and a date; "we should improve monitoring" is a sentiment, not an action.
Timeline (facts only)
03:14 First anomalous authentication, service account, foreign ASN
03:51 Alert raised by failed-login threshold rule
04:10 IR lead paged; containment approved
04:38 Account locked, egress blocked, memory captured
06:05 Persistence mechanism identified and removed
09:30 Entry point confirmed: credential reuse from a 2024 third-party breach
Actions
[P1] Enforce MFA on all service accounts that can authenticate interactively — owner: platform, due 7 days
[P1] Alert on first-seen ASN for privileged logins — owner: SOC, due 14 days
[P2] Credential-exposure scanning for all staff accounts — owner: IT, due 30 days
Track the actions to completion. Organizations that skip this phase respond to the next incident with the same gaps, and the second breach is invariably more expensive than the first.
Common Mistakes
Powering off the compromised host immediately to stop the attacker
Fix: Isolate at the network layer and capture volatile memory first; a powered-off machine takes its evidence with it.
Negotiating severity while systems are down
Fix: Agree the severity matrix and escalation contacts in advance so response time is automatic.
Deleting attacker artifacts during eradication
Fix: Copy and hash them for analysis, then remove; you will need them for scoping and for the next detection.
Letting everyone discuss the incident in general chat channels
Fix: Use one dedicated, access-restricted channel and a single approved spokesperson.
Closing the incident as soon as service is restored
Fix: Keep the incident open until root cause is identified, actions have owners, and the retest window passes.
Best Practices
- Run a tabletop exercise twice a year with technical, legal and communications roles in the same room.
- Pre-build evidence kits: imaging tools, hashed media, chain-of-custody forms, and a documented collection order.
- Define containment criteria and delegable authority so the on-call responder can act without waiting for an executive.
- Keep a single time-stamped incident timeline; reconstructing it from memory later is how disputes start.
- Measure mean time to detect and mean time to respond after every incident, then track the trend.
Key Takeaways
- Preparation — roles, rota, tooling, practice — determines response quality far more than any single tool.
- Triage separates facts from hypotheses; a timeline built on assumptions fails under cross-examination.
- Containment is a business trade-off: choose the least-damaging brake and plan both short-term and long-term moves.
- Collect volatile evidence and hash it before eradication, or the root cause disappears with the rebuild.
- Communication needs pre-drafted templates, one spokesperson and legal in the room from hour one.
- A blameless review with dated, owned actions is the only phase that makes the next incident cheaper.