Incident response and writing it up
Stage 5 · Lesson 6 · 20 minutes · Requires all previous Stage 5 lessons
The one-line answer
Response runs in a fixed order — contain, eradicate, recover — and the write-up matters as much as the response, because an investigation nobody can read is an investigation that did not happen.
Why you should care
Everything so far has been about finding things. This lesson is what happens next, and it is where new analysts most often go wrong — not through lack of knowledge, but through acting in the wrong order under pressure.
The instinct when you find a compromised machine is to fix it immediately. Reboot it, delete the file, run a scan. Every one of those instincts destroys evidence, and at least one of them tells the attacker they have been seen.
It is also where your writing matters more than your tooling. The analyst who finds something and cannot explain it clearly has produced nothing anyone can act on. In a role where you hand your work to someone else several times a shift, this is the skill that decides how quickly you stop being L1.
How it actually works
The six phases
The widely used model (NIST SP 800-61) has six phases. In an L1 role you will mostly live in three.
1. PREPARATION before anything happens — tooling, access, playbooks
2. DETECTION the alert, the triage, the confirmation
3. CONTAINMENT stop it spreading
4. ERADICATION remove the attacker's access and tools
5. RECOVERY restore normal service, monitor closely
6. LESSONS LEARNED what do we change so this is less likely next timeThe order of 3, 4 and 5 is the part to internalise.
- Clean one machine while the attacker still holds three others, and you get reinfected. Containment first.
- Restore service before eradication, and you restore the compromise along with it. Eradication before recovery.
Preparation is the phase that silently decides how well the others go. Whether you have the access, the logs, and a documented contact for the system owner is settled long before the incident.
Lessons learned is the phase most often skipped and the only one that reduces the next incident.
Containment: isolate, do not power off
When you have a compromised host, the instinct is to shut it down. Don't.
Powering off destroys volatile evidence — running processes, open network connections, loaded modules, encryption keys, anything in memory. On a living-off-the-land intrusion where nothing was written to disk, memory may hold the only trace of what ran.
Instead:
| Do | Why |
|---|---|
| Isolate it from the network (EDR containment, or unplug the cable) | Cuts the attacker off, preserves state |
| Leave it powered on | Memory survives |
| Record what you observed and when | The timeline starts now |
| Preserve logs before they rotate | Evidence expires |
Modern EDR can isolate a host remotely — it stays running, still talks to the EDR console, and talks to nothing else. That is the ideal.
Also do not: reboot, run a quick antivirus scan to "check", delete the suspicious file, or log in with a domain administrator account. That last one is a genuinely common and serious mistake — it puts fresh privileged credentials onto a machine the attacker controls.
Eradication and recovery
Eradication means removing everything the attacker established, which is more than the obvious malware:
- The web shell, the implant, the scheduled task
- Accounts they created (4720 from Lesson 3)
- Group memberships they added (4732)
- Services they installed (7045)
- Mail forwarding rules (Lesson 5)
- SSH keys, API tokens, OAuth grants
- Every credential that was exposed on that host
That last one is the most commonly missed. If an attacker had administrative access to a machine, assume every credential used on it is compromised and rotate it.
For a seriously compromised host, rebuilding from a known-good image is usually faster and more trustworthy than cleaning. You can never fully prove a cleaned machine is clean.
Recovery is restoring service — with monitoring turned up, because attackers return to networks they know.
Chain of custody
If evidence may ever be used in a dispute, a disciplinary process, an insurance claim or a court, how it was handled must be accountable.
Record, for each item:
- What it is (host, disk image, log export, memory capture)
- Who collected it, when, and how
- Where it has been stored since
- A hash of the file, taken at collection, so alteration is detectable
sha256sum evidence-20260314-web01-auth.log > evidence-20260314-web01-auth.log.sha256Evidence whose handling cannot be accounted for can be challenged as altered. Most incidents never reach a court — and you cannot know which ones will at the moment you are collecting.
Writing it up
Two documents matter, and they are different.
The escalation note — written mid-incident, to hand over or get a decision. Short, structured, and ends with a question:
What happened: web01 (10.2.4.11) shows a successful SSH root login from 203.0.113.44 at 02:11 UTC, after four failed attempts in nine seconds.
Confirmed:
Accepted password for rootin auth.log. Source IP has no prior history in 30 days of logs. Root SSH login is enabled on this host.Ruled out: not our scanner (different source range, confirmed with infra). Not a known maintenance window.
Done so far: host isolated via EDR at 02:48. auth.log and syslog exported and hashed. Host left powered on.
Need from you: approval to rotate all credentials on web01, and confirmation of who owns this host.
Five headings. A reader can act in a minute.
Compare with what new analysts often send — a forwarded alert with "looks suspicious, please advise". That makes the recipient redo all your work.
The incident report — written afterwards, for people who were not there. It adds:
- Timeline — every event with a UTC timestamp and its source
- Impact — what was accessed, what was lost, who is affected
- Root cause — how they got in, honestly
- Remediation — what was done, and what should change
Writing the timeline as you go
The single most useful habit in this lesson: keep a running timeline from the first minute.
02:48 Isolated web01 via EDR console (analyst: A. Thomas)
02:52 Exported /var/log/auth.log, sha256 recorded
03:05 Confirmed 203.0.113.44 absent from 30d of proxy logs
03:20 Escalated to L2 — awaiting approval for credential rotationTwo hours in, with five half-explored leads, you will not remember what you checked. The timeline is not paperwork produced afterwards — it is the investigation, written down as it happens. It prevents re-checking the same thing twice, it survives a shift change, and it is most of the final report already written.
Honesty in the write-up
Write what you know, what you inferred, and what you could not determine — and label which is which.
"We could not determine whether data was exfiltrated, because netflow is only retained for seven days" is a far more useful sentence than a confident guess. It also tells the organisation exactly what to fix.
Never quietly omit something that makes the team look bad. The missed alert, the agent that had been offline for a month, the expired certificate — those are the findings that actually prevent the next incident.
See it yourself
You do not need a real incident to practise. Take the scenario from Lesson 3:
09:14:02 4625 spatel Type 3 from 198.51.100.9
09:14:06 4625 amenon Type 3 from 198.51.100.9
09:14:09 4624 dsingh Type 3 from 198.51.100.9
09:14:11 4672 dsingh
09:15:40 4688 powershell.exe -enc JABj...
09:16:02 4720 new account svc_backup2Now write the escalation note. Five headings, under 200 words:
- What happened
- Confirmed
- Ruled out (and what you could not rule out)
- Done so far
- Need from you
Then answer: what do you contain, in what order, and what do you deliberately not do?
Do this once a week on any scenario and you will write better incident notes than most people two years into the job.
How attackers abuse this
They rely on the panicked reboot. It destroys memory evidence and tells them they were noticed. A clean, quiet isolation is far worse for them.
They leave more than one way back. An account, a scheduled task, a service, an SSH key, an OAuth grant. Eradicating only the obvious implant means they return next week — and you will have told them which detection fired.
They wait out the recovery. Some dwell deliberately after an incident is "closed", knowing monitoring attention drops after a fortnight.
They watch the response. If they hold a mailbox or a chat account, they can read the incident channel discussing them. This is why serious incidents move to out-of-band communication — a different platform, phones, in person.
They return to known networks. An organisation that was compromised once is a known-good target with a known layout. Recovery is not the end of monitoring, it is the start of heightened monitoring.
Common mistakes
Rebooting the compromised host. The most common instinct and among the most damaging.
Logging in with domain administrator credentials. You have just handed fresh privileged credentials to a machine the attacker controls.
Eradicating before containing. Cleaning machine one while they still hold machines two and three.
Recovering before eradicating. Restoring service restores the compromise.
Rotating only the obviously compromised password. If they had admin on that host, every credential used there is exposed.
Writing the report afterwards from memory. You will have forgotten the detail that mattered. Write the timeline live.
Reporting without the decision you need. An escalation that ends "please advise" wastes the recipient's time. End with a specific question.
Hiding the uncomfortable part. Skipping the agent that was offline for a month means it will still be offline during the next incident.
Check yourself
- You find an active intrusion on a production database server. Your manager says "take it offline and rebuild it tonight". What concerns do you raise, and in what order would you act?
- An incident is closed after removing a web shell from a server. Two weeks later the same attacker is back. Name three things that were probably missed.
- Why does an escalation note need a "ruled out" section? Is it not enough to say what you found?
Answers
- Rebuilding destroys the evidence needed to understand scope — and on a database server, the most important question is what data was accessed, which you may be legally required to answer. Raise: have we captured memory and disk images first; do we know whether this host is the only one affected; are there regulatory notification obligations. Act: isolate from the network (powered on), preserve memory and logs with hashes, determine scope across other hosts, rotate every credential used on that machine, then rebuild from a known-good image and restore with monitoring raised. Isolation stops the bleeding immediately, so there is no need to trade evidence for speed.
- Most likely: another persistence mechanism was left behind — a created account, a scheduled task, an installed service, or an SSH key. Credentials exposed on the host were not rotated, so the original ones still work. And the root cause — how they got in initially — was never fixed, so the same door is open. Removing the web shell addressed the symptom, not the access.
- Because it stops the recipient repeating your work. Without it they do not know whether you already checked that it was the vulnerability scanner, or a maintenance window, so they check again. "Ruled out" also forces you to state your reasoning, which is where you most often notice you have not actually ruled something out — you assumed it. Saying what you could not rule out is equally valuable, because it tells them where the uncertainty is.
Your lab
Challenge 09 — Log file investigation
Work the lab, then write the escalation note for what you find. Five headings, under 200 words, ending with a specific question.
→ Open Stage 1 labs
Summary in your language
हिन्दी सारांश (Hindi summary)
Incident response और उसे लिखना
छह चरण (NIST):
1. तैयारी कुछ होने से पहले — tools, access, playbooks
2. पहचान alert, triage, पुष्टि
3. Containment फैलने से रोकिए
4. Eradication हमलावर की पहुँच और औज़ार हटाइए
5. Recovery सेवा बहाल कीजिए, कड़ी निगरानी के साथ
6. सीख अगली बार कम संभावना के लिए क्या बदलें3, 4, 5 का क्रम सबसे ज़रूरी है:
- एक मशीन साफ़ की और हमलावर के पास तीन और हैं → फिर से संक्रमण। पहले containment।
- Eradication से पहले recovery → compromise भी वापस आ जाएगा।
Containment: अलग कीजिए, बंद मत कीजिए
मशीन बंद करने से memory का सबूत नष्ट हो जाता है — चल रहे processes, connections, keys। Living-off-the-land हमले में जहाँ disk पर कुछ लिखा ही नहीं गया, memory ही इकलौता सबूत हो सकती है।
| कीजिए | क्यों |
|---|---|
| Network से अलग कीजिए (EDR या केबल) | हमलावर कट जाता है, स्थिति बची रहती है |
| चालू रहने दीजिए | Memory बची रहती है |
| Logs rotate होने से पहले सुरक्षित कीजिए | सबूत ख़त्म हो जाते हैं |
मत कीजिए: reboot, "जाँचने" के लिए antivirus scan, संदिग्ध file delete, और सबसे ज़रूरी — उस मशीन पर domain administrator से login मत कीजिए। यह हमलावर को ताज़ा privileged credentials दे देता है।
Eradication में सिर्फ़ malware नहीं: बनाए गए accounts (4720), जोड़ी गई group memberships (4732), install की गई services (7045), mail forwarding rules, SSH keys, API tokens — और उस host पर इस्तेमाल हुआ हर credential बदलिए। यही सबसे ज़्यादा छूटता है।
गंभीर रूप से compromised मशीन के लिए साफ़ करने से बेहतर है known-good image से rebuild करना।
Escalation note — पाँच शीर्षक:
क्या हुआ: web01 पर 02:11 UTC को 203.0.113.44 से सफल root SSH login, नौ सेकंड में चार असफल कोशिशों के बाद।
पुष्टि: auth.log में
Accepted password for root। 30 दिन के logs में यह IP पहले कभी नहीं।ख़ारिज किया: हमारा scanner नहीं। कोई maintenance window नहीं।
अब तक किया: 02:48 पर EDR से host isolate। Logs export और hash किए। Host चालू रखा।
आपसे चाहिए: web01 के सभी credentials बदलने की मंज़ूरी, और इस host के मालिक की पुष्टि।
"Looks suspicious, please advise" लिखने से सामने वाले को आपका सारा काम दोबारा करना पड़ता है।
सबसे उपयोगी आदत: पहले मिनट से timeline लिखिए। दो घंटे बाद आपको याद नहीं रहेगा कि क्या जाँचा था। Timeline कागज़ी काम नहीं — वही जाँच है, लिखी हुई।
ईमानदारी: जो नहीं पता चला उसे लिखिए। "हम यह तय नहीं कर सके कि data बाहर गया या नहीं, क्योंकि netflow सिर्फ़ 7 दिन रखा जाता है" — यह अनुमान से कहीं बेहतर वाक्य है, और संगठन को बताता है कि क्या ठीक करना है।
தமிழ் சுருக்கம் (Tamil summary)
Incident response மற்றும் அதை எழுதுவது
ஆறு கட்டங்கள் (NIST):
1. தயாரிப்பு எதுவும் நடப்பதற்கு முன் — tools, access, playbooks
2. கண்டறிதல் alert, triage, உறுதிப்படுத்தல்
3. Containment பரவுவதைத் தடுக்கவும்
4. Eradication தாக்குபவரின் அணுகலையும் கருவிகளையும் அகற்றவும்
5. Recovery சேவையை மீட்டெடுக்கவும், கூர்ந்த கண்காணிப்புடன்
6. பாடங்கள் அடுத்த முறை குறைவாக நடக்க என்ன மாற்றுவது3, 4, 5-இன் வரிசைதான் மிக முக்கியம்:
- ஒரு இயந்திரத்தைச் சுத்தம் செய்தீர்கள், தாக்குபவரிடம் மேலும் மூன்று உள்ளன → மீண்டும் தொற்று. முதலில் containment.
- Eradication-க்கு முன் recovery → compromise-உம் திரும்பி வரும்.
Containment: தனிமைப்படுத்துங்கள், அணைக்காதீர்கள்
இயந்திரத்தை அணைத்தால் memory-இல் உள்ள ஆதாரம் அழியும் — இயங்கும் processes, connections, keys. Disk-இல் எதுவும் எழுதப்படாத living-off-the-land தாக்குதலில், memory மட்டுமே ஒரே ஆதாரமாக இருக்கலாம்.
| செய்யுங்கள் | ஏன் |
|---|---|
| Network-இலிருந்து தனிமைப்படுத்துங்கள் | தாக்குபவர் துண்டிக்கப்படுகிறார் |
| இயங்கிக்கொண்டே இருக்கட்டும் | Memory பாதுகாக்கப்படும் |
| Logs rotate ஆவதற்கு முன் சேமியுங்கள் | ஆதாரம் காலாவதியாகும் |
செய்யாதீர்கள்: reboot, "சரிபார்க்க" antivirus scan, சந்தேகமான file-ஐ நீக்குவது, மற்றும் மிக முக்கியமாக — அந்த இயந்திரத்தில் domain administrator-ஆக login செய்யாதீர்கள்.
Eradication-இல் malware மட்டுமல்ல: உருவாக்கப்பட்ட accounts (4720), சேர்க்கப்பட்ட group memberships (4732), நிறுவப்பட்ட services (7045), mail forwarding rules, SSH keys — மற்றும் அந்த host-இல் பயன்படுத்தப்பட்ட ஒவ்வொரு credential-ஐயும் மாற்றுங்கள்.
கடுமையாக compromise ஆன இயந்திரத்தை சுத்தம் செய்வதை விட known-good image-இலிருந்து rebuild செய்வது சிறந்தது.
Escalation note — ஐந்து தலைப்புகள்:
என்ன நடந்தது: web01-இல் 02:11 UTC-க்கு 203.0.113.44-இலிருந்து வெற்றிகரமான root SSH login, ஒன்பது வினாடிகளில் நான்கு தோல்விகளுக்குப் பிறகு.
உறுதிப்படுத்தப்பட்டது: auth.log-இல்
Accepted password for root. 30 நாள் logs-இல் இந்த IP இல்லை.நிராகரிக்கப்பட்டது: நமது scanner அல்ல. maintenance window இல்லை.
இதுவரை செய்தது: 02:48-க்கு EDR மூலம் host தனிமைப்படுத்தப்பட்டது. Logs export, hash செய்யப்பட்டன.
உங்களிடமிருந்து தேவை: web01-இன் அனைத்து credentials-ஐயும் மாற்ற அனுமதி.
"Looks suspicious, please advise" என்று எழுதினால், பெறுபவர் உங்கள் வேலை முழுவதையும் மீண்டும் செய்ய வேண்டியிருக்கும்.
மிகப் பயனுள்ள பழக்கம்: முதல் நிமிடத்திலிருந்தே timeline எழுதுங்கள். இரண்டு மணி நேரத்தில் என்ன சரிபார்த்தீர்கள் என்பது நினைவில் இருக்காது.
நேர்மை: தெரியாததை எழுதுங்கள். "data வெளியே சென்றதா என்பதை எங்களால் தீர்மானிக்க முடியவில்லை, ஏனெனில் netflow 7 நாட்கள் மட்டுமே வைக்கப்படுகிறது" — இது ஊகத்தை விடச் சிறந்த வாக்கியம்.
Want this summary in Malayalam, Telugu, Kannada or another language? Tell us — the most requested languages get added next.
What's next
That is Stage 5. You can read logs from Linux and Windows, work a SIEM, analyse a phishing email, and run and write up an incident.
Next comes proving it to an employer — which is Stage 6, and is mostly about what you can show rather than what you know.
→ Stage 6: Turning labs into a public portfolio