Incident response
About this lesson
Detection tells you something is wrong; incident response is the planned work of stopping it and putting things right. Follow one incident, a staff account taken over with a stolen password, through every phase NIST and CISA describe: preparation, detection and triage, containment, keeping evidence, eradication, recovery and lessons learned. A tiny Python timeline grows by one entry per phase, and the lesson ends with how NIST SP 800-61 Rev. 3 maps the work onto CSF 2.0.
What an incident is
An incident is an event that harms, or is about to harm, the confidentiality, integrity or availability of data or systems, or breaks security policy. Here a criminal has a staff member's password and is signed in to their account.
incident an event that harms (or is about to harm)
confidentiality, integrity or availability,
or breaks the rules (security policy)
here a stolen password: the attacker is signed in
as a staff member, near the company files
response the planned work of stopping and fixing itRead the lesson step by step
What an incident is
An incident is an event that harms, or is about to harm, the confidentiality, integrity or availability of data or systems, or breaks security policy. Here a criminal has a staff member's password and is signed in to their account.
incident an event that harms (or is about to harm) confidentiality, integrity or availability, or breaks the rules (security policy) here a stolen password: the attacker is signed in as a staff member, near the company files response the planned work of stopping and fixing itPreparation comes first
Response starts before any attack. The team writes a playbook (who does what, who to call), keeps logs and monitoring running, keeps clean backups, and has a place to record every action. Here that record is a Python list.
playbook roles, contacts, steps for common incidents monitoring logs collected, alerts set up backups offline copies, restores tested the record line 1 timeline = [] an empty list line 2 def log(time, step): line 3 add the pair (time, step) to the endDetect: an alert arrives
At 09:00 monitoring raises an alert: this account signed in from a new country, minutes after a sign-in at the office. The team opens the incident and logs the first entry. The timeline now holds one item.
alert sign-in from a new country, minutes after one at the office line 4 log("09:00", "detect") timeline [("09:00", "detect")] len 1Triage: is it real, how big?
Analysis, or triage, asks: is this a real incident, what does it touch, and how serious is it? The logs show the account reading and changing files on the server and a hidden rule forwarding its email out. Severity: high.
triage sort by how serious and how urgent real? yes: the user did not sign in from there scope the account, its mailbox, the file server found a hidden rule forwarding email outside severity high · tell the incident lead and managers line 5 log("09:12", "triage") len 2Contain: stop the spread
Containment stops the damage growing. The team disables the account and ends all its signed-in sessions, so the attacker is thrown out, and takes the laptop off the network. Containing first, before cleaning up, limits harm.
contain stop it getting worse, fast account disabled; every session signed out laptop taken off the network (isolated) attacker session ended: no way back in line 6 log("09:20", "contain") len 3Keep the evidence
Before anything is wiped, the team copies the evidence: memory first (it is lost at power-off), then the disk and the sign-in logs. A chain of custody records who handled each copy, and when. Then the facts cannot be lost.
evidence what happened, kept safe for later order memory first (lost at power-off), then the disk, then the logs custody who handled each copy, and when line 7 log("09:35", "evidence") len 4Eradicate: remove the cause
Eradication removes what the attacker left and the weakness they used. The team deletes the forwarding rule, resets the password, and turns on phishing-resistant MFA, so a stolen password alone is not enough again.
eradicate remove every trace and the way in removed the hidden forwarding rule reset the password fixed phishing-resistant MFA switched on line 8 log("11:40", "eradicate") len 5Recover: back to normal
Recovery brings things back safely. Two files the attacker changed are restored from the clean backup, the account is switched back on, and monitoring watches it closely for a while in case the attacker returns.
recover return to normal, carefully files restored from the clean offline backup account switched back on, with MFA watch extra monitoring for a few weeks line 9 log("15:00", "recover") len 6Lessons learned
A few days later everyone involved reviews the timeline: what worked, what was slow, and what to change. The aim is fixing the system, not blaming a person. The fixes go back into the playbook, monitoring and training.
review within a few days, everyone involved asks what worked? what was slow? what next? blameless fix the system, not the person output playbook, alerts and training updated line 10 log("day 3", "lessons") len 7 timeline 7 entries: the full story, in orderThe NIST view
NIST SP 800-61 Rev. 3 ties this to the Cybersecurity Framework 2.0. Govern, Identify and Protect prepare. Detect finds the incident. Respond analyses, contains and removes it. Recover restores. Lessons learned improve all of them.
NIST SP 800-61 Rev. 3 (April 2025), a CSF 2.0 profile Govern · Identify · Protect preparation Detect alert Respond triage, contain, eradicate Recover restore, return to normal Improvement lessons learned, everywhere
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01An alert shows a staff account signing in from a new country. What is the first job of analysis (triage)?
Triage confirms the incident is real, finds its scope and sets its severity, so the team knows how fast and how widely to act. Wiping first would destroy evidence and might miss other affected systems.
02Why do responders contain an incident before they eradicate it?
Containment (disabling the account, ending sessions, isolating the laptop) limits harm quickly. Eradication then removes the cause and the weakness, once the team understands them.
03When collecting evidence from a running computer, what should be copied first?
NIST SP 800-86 says to collect the most volatile data first. Memory is lost when the machine is powered off; the disk keeps its data.
04After running the card's program, what is len(timeline)?
Lines 1 to 3 only create the list and define log(). Each of the seven log() calls on lines 4 to 10 appends one (time, step) pair, so the list ends with 7 entries.
05In NIST SP 800-61 Rev. 3, which CSF 2.0 functions cover the preparation work done before an incident?
Rev. 3 treats preparation as the work of Govern, Identify and Protect. Detect, Respond and Recover handle the incident itself, and lessons learned feed improvement back into all of them.
Glossary
- Incident
- An event that actually or imminently harms the confidentiality, integrity or availability of information or systems, or breaks law or security policy (NIST).
- Playbook
- A written, practised plan for a type of incident: who is in charge, who to call, and the steps to follow.
- Triage
- Sorting alerts by whether they are real, what they affect and how serious they are, so the most urgent work is done first.
- Containment
- Stopping an incident from spreading or doing more harm, for example by disabling an account, ending sessions or taking a computer off the network.
- Chain of custody
- A record of who collected, handled and stored each piece of evidence, and when, so it can be trusted later.
- Eradication
- Removing what the attacker left behind and closing the weakness they used, such as deleting a malicious mail rule and turning on stronger sign-in.
- Recovery
- Returning systems and data to normal safely, for example restoring clean files from a backup and watching closely for the attacker's return.
- Lessons learned
- A review after the incident, focused on fixing processes rather than blaming people, whose results update the playbook, detections and training.
Notes and sources
- The incident and its times are made up to show the order of the work. Real incidents can take hours or months, and teams often go back and forth between analysis, containment and eradication as they learn more.
- The phase names follow NIST SP 800-61 Rev. 2 and CISA's playbooks. Rev. 3 (2025) keeps the same work but files it under the six CSF 2.0 functions instead of one life cycle.
- Evidence handling here is simplified. NIST SP 800-86 covers the order of collection, and legal or regulatory needs can decide what must be kept and who may handle it.
- Many organisations must also report certain incidents to regulators, customers or law enforcement within set times. CISA takes reports at cisa.gov/report.
- This course is about defence. It names the attacker's actions only at the level needed to find and fix them, and never shows how to attack a real system.
- NIST SP 800-61 Rev. 3: Incident Response Recommendations and Considerations for Cybersecurity Risk Management (April 2025)
- NIST SP 800-61 Rev. 2: Computer Security Incident Handling Guide (2012, withdrawn)
- NIST SP 800-86: Guide to Integrating Forensic Techniques into Incident Response
- NIST CSRC Glossary: incident
- NIST CSWP 29: The NIST Cybersecurity Framework (CSF) 2.0
- CISA: Federal Government Cybersecurity Incident and Vulnerability Response Playbooks
- CISA and MS-ISAC: #StopRansomware Guide (response checklist)
- CISA: Report a cyber incident
- OWASP Top 10:2021 A09 Security Logging and Monitoring Failures
- OWASP Logging Cheat Sheet
- Python tutorial: Data Structures (lists, tuples)
Quiz Unlocks after the last step.