Containment, Eradication, and Recovery
Apply containment strategies (network isolation, account lockout), remove malware footholds, restore from clean backups, and verify system integrity.
Containment, Eradication, and Recovery is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Three Phases After Detection
Once an incident is confirmed and scoped, the response moves through three consecutive phases: Containment (stop the damage from spreading), Eradication (remove all attacker footholds from the environment), and Recovery (restore systems to normal operation and verify integrity). Each phase has distinct objectives and verification criteria. Moving to recovery before completing eradication is a common error that leads to re-infection from remaining attacker persistence mechanisms.
Short-Term vs Long-Term Containment
Containment happens in two stages. Short-term containment provides immediate stabilization — isolating affected systems from the network, blocking attacker IP addresses at the firewall, disabling compromised accounts — to stop active damage. Long-term containment implements more durable controls that allow the organization to continue operating while investigation and eradication proceed — for example, segmenting the compromised network zone rather than taking it offline entirely.
# Short-term containment actions
# 1. Isolate compromised host from network (EDR isolation):
falconctl -s network_contain --aids=<AID1,AID2>
# 2. Block attacker IP at perimeter firewall:
iptables -I INPUT -s 198.51.100.10 -j DROP
iptables -I OUTPUT -d 198.51.100.10 -j DROP
# 3. Disable compromised Active Directory account:
Disable-ADAccount -Identity 'compromised_user'
# 4. Reset Kerberos tickets (force re-auth):
# Reset krbtgt password TWICE (invalidates all Golden Tickets)Evidence Preservation During Containment
A critical principle: preserve evidence before you remediate. Analysts should capture volatile data (memory dump, running processes, active network connections) and forensic disk images BEFORE taking any action that would alter the system state. Rebooting a system, running malware removal tools, or reimaging without evidence capture destroys the forensic record needed to understand the attack timeline and may also destroy legal evidence needed to prosecute attackers or meet regulatory notification requirements.
# Capture volatile data before containment (Windows PowerShell)
# Running processes
Get-Process | Export-Csv processes.csv
# Active network connections
Get-NetTCPConnection | Export-Csv connections.csv
# Memory dump (using Magnet RAM Capture or WinPmem)
.\winpmem_mini.exe output.raw
# Compute hash before imaging
Get-FileHash output.raw -Algorithm SHA256
# THEN isolate the system from the networkEradication: Removing All Footholds
Eradication removes all attacker presence from the environment. This is more complex than simply deleting malware files. Persistent attackers establish multiple footholds: scheduled tasks, registry run keys, new user accounts, web shells on servers, modified firmware, and rogue OAuth app consents. A complete eradication checklist must address every technique used by the attacker based on evidence from the investigation phase. Incomplete eradication leads to reinfection — often within hours of returning systems to production.
# Eradication checklist example (ransomware incident)
# [ ] Remove all malware files (identified by hash)
# [ ] Delete attacker-created local and AD accounts
# [ ] Remove persistence: scheduled tasks, Run keys, services
# [ ] Delete web shells if web server was compromised
# [ ] Remove unauthorized OAuth app consents
# [ ] Revoke and reissue all certificates if PKI was touched
# [ ] Reset KRBTGT password twice (invalidate Kerberos tickets)
# [ ] Revoke all active sessions for all potentially compromised users
# [ ] Patch the initial access vulnerability used to gain entryReimaging vs Cleaning Compromised Systems
For endpoints compromised by sophisticated malware or rootkits, reimaging (wiping and reinstalling from a known-clean image) is often preferred over attempting to clean the infected system. Rootkits can hide in locations that antivirus cannot reach, and sophisticated malware may have modified system binaries that are difficult to identify and restore. The decision between cleaning and reimaging depends on: the sophistication of the malware, the sensitivity of the data on the system, and the availability of known-clean images for rapid redeployment.
Patching the Vulnerability Used for Initial Access
Eradication must include closing the initial access vulnerability — otherwise the same attacker (or a different one) can re-enter through the same door. Common initial access vulnerabilities include: unpatched software CVEs exploited via internet-facing services, weak or no MFA on remote access systems (VPN, RDP), phishing (requires security awareness training and email filtering improvements), and supply chain compromise (requires vendor security review). Patch and harden before returning systems to production.
Recovery: Restoring Systems Safely
Recovery restores affected systems to normal operation from known-good state. Recovery steps include: restoring from clean backups (verifying backup integrity before restoration), rebuilding systems from golden images, reconfiguring network controls (removing temporary containment restrictions), re-enabling disabled accounts (with password resets), and phasing systems back into production incrementally rather than all at once. Incrementally returning systems allows monitoring for signs of re-infection during each phase.
# Recovery validation checklist
# [ ] Restore from backup taken BEFORE initial compromise date
# [ ] Verify backup integrity (hash comparison, test restore)
# [ ] Apply all patches before connecting to network
# [ ] Change ALL passwords for accounts on restored systems
# [ ] Enable enhanced logging (monitor closely for 30+ days)
# [ ] Run EDR scan immediately after restoration
# [ ] Verify application functionality before production traffic
# [ ] Monitor for attacker IoCs in SIEM for 30+ days post-recoveryBackup Integrity and Ransomware
Ransomware specifically targets backup systems to prevent recovery without paying. Effective backup defense requires: offsite backups not connected to the main network, immutable backups (Object Lock, WORM storage) that cannot be encrypted or deleted, air-gapped backups for critical systems, and tested restore procedures. Backup integrity should be verified regularly — a backup that cannot be restored is not a backup. Organizations should know the last clean backup date to determine the recovery point.
Network Monitoring During Recovery
After eradication and recovery, enhanced monitoring should continue for an extended period (typically 30-90 days). Some sophisticated attackers plant secondary backdoors that activate after their primary access is detected and removed. Enhanced monitoring includes: increased SIEM alert sensitivity for known attacker IoCs, monitoring for DNS queries to domains similar to attacker infrastructure, watching for communication with any IP addressed seen during the incident, and triggering alerts on any activity from newly created accounts.
Communicating During and After an Incident
Communication management during an incident is as critical as the technical response. Internal communication keeps the organization aligned and prevents rumors. External communication to customers, partners, regulators, and potentially the media must be carefully controlled — premature, inaccurate, or legally problematic disclosures create additional liability. All external communications should be reviewed by legal counsel before release. Regulatory notifications (GDPR 72-hour requirement, HIPAA 60-day requirement) have strict deadlines that run from the date of discovery, not the date of confirmation.
Declaring the Incident Closed
An incident is not closed when the immediate crisis passes — it is closed when all verification criteria are met: all known attacker footholds have been removed and verified, the initial access vulnerability has been patched, all affected systems have been restored and verified clean, enhanced monitoring is in place, required regulatory notifications have been sent, and a post-incident review has been scheduled. Premature incident closure is a common mistake that allows low-level attacker persistence to grow into a second incident.
Quick Check
Test your understanding of CompTIA Security+ (SY0-701) concepts from this lesson.
Lesson Recap
In this lesson you learned: containment stops active damage through isolation, firewall blocks, and account disabling, eradication requires removing ALL attacker footholds including persistence mechanisms, not just malware files, and recovery must use backups from before the compromise date and include enhanced monitoring for 30+ days. Next up we explore post-incident review and lessons learned.
Frequently asked questions
Is the “Containment, Eradication, and Recovery” lesson free?
Yes — the full text of “Containment, Eradication, and Recovery” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.
What will I learn in “Containment, Eradication, and Recovery”?
Apply containment strategies (network isolation, account lockout), remove malware footholds, restore from clean backups, and verify system integrity. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cloud & IT Cert Prep?
No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Containment, Eradication, and Recovery” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cloud & IT Cert Prep lesson?
Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Preparation: IR Plans, Playbooks, and Teams
- Detection and Analysis: Identifying Real Incidents
- Containment, Eradication, and Recovery
- Post-Incident Review and Lessons Learned