Browse CTFs New CTF Sign in

Containment Decision-Making: When and How to Stop the Bleeding

incident_response Difficulty 2–3 55 min certifiable

Theory

Prerequisites

  • CIR-K001: The PICERL Lifecycle
  • CIR-K003: Live Response Triage
  • COA-K003: Windows Event Log Investigation (recommended)

Why This Lesson Matters

Containment is the moment where IR stops being an investigation and becomes an intervention. The decisions you make in the next 15 minutes — isolate this server, block this IP, disable this account — directly determine whether a breach stays small or becomes catastrophic. This lesson gives you the frameworks and the hands to make those decisions confidently.


1. What Containment Is (and Isn't)

Containment is: Stopping the attacker from doing more damage right now.

Containment is not: - Fixing the vulnerability that let them in (that is Eradication) - Rebuilding the system (that is Recovery) - Understanding everything that happened (that is the Investigation)

A common mistake is conflating containment with remediation. They happen in sequence, not simultaneously. You can contain an incident in 30 minutes even if the full investigation takes three weeks.


2. The Three Containment Levers

Every containment action falls into one of three categories:

Lever 1 — Network Isolation

Cut the attacker's communication channels.

Methods (escalating disruption):
1. Block specific C2 IPs/domains at the perimeter firewall
   → Least disruptive; attacker may switch to backup C2

2. VLAN reassignment — move the host to an isolated VLAN
   → Host stays reachable for investigation; C2 is cut

3. Physical network disconnect — pull the cable / disable the switchport
   → Absolute isolation; the business service goes offline

4. Host-based firewall rule (last resort if no network access)
   iptables -A OUTPUT -j DROP
   netsh advfirewall set allprofiles firewallpolicy blockinbound,blockoutbound

When to use each: Start with the least disruptive option unless active exfiltration is confirmed — in that case, physical isolation is immediate.

Lever 2 — Account Suspension

Cut the attacker's identity.

# Linux: disable the compromised account
usermod -L alice            # lock (prevents password login)
passwd -l alice             # lock password
# Revoke SSH keys too:
echo "" > /home/alice/.ssh/authorized_keys

# Windows (PowerShell):
Disable-ADAccount -Identity alice
# Reset password to force logout of active sessions:
Set-ADAccountPassword -Identity alice -Reset -NewPassword (ConvertTo-SecureString "Rnd!Pass2026" -AsPlainText -Force)

Important: Disabling one account is not enough if the attacker has created backdoor accounts or stolen credentials for other accounts. Check for new accounts and unusual group memberships.

# Find accounts created in the last 48 hours (Linux)
awk -F: '$3 >= 1000 {print $1, $3}' /etc/passwd
lastlog | grep -v "Never"

# Windows: accounts created recently
Get-ADUser -Filter * -Properties WhenCreated | Where-Object {$_.WhenCreated -gt (Get-Date).AddDays(-2)}

Lever 3 — Process and Service Termination

Kill the attacker's running foothold.

# Kill a malicious process by PID
kill -9 1337

# Remove the binary so the process cannot restart
rm /tmp/.cache_update

# Stop a malicious service (Linux)
systemctl stop WindowsFakeService
systemctl disable WindowsFakeService

# Stop a malicious service (Windows)
Stop-Service -Name "WindowsUpdateHelper"
Set-Service -Name "WindowsUpdateHelper" -StartupType Disabled
sc.exe delete "WindowsUpdateHelper"

3. The Containment Decision Matrix

For each affected system, ask four questions:

Q1: Is active exfiltration happening right now?
    YES → Network isolate immediately (Lever 1, highest disruption)
    NO  → continue

Q2: Is this a critical production system (database, ERP, clinical system)?
    YES → Weigh business impact of isolation vs risk of continued access
          → Prefer VLAN isolation over physical disconnect
          → Engage business owner before acting
    NO  → continue

Q3: Has the attacker established persistence?
    YES → Simple network block is not enough; the malware will reconnect on reboot
          → Must also terminate process (Lever 3) and plan eradication before reconnect
    NO  → continue

Q4: Are there other potentially compromised hosts?
    YES → Apply same containment to all affected hosts simultaneously
          → Sequential containment alerts the attacker (they see one host go offline)
    NO  → Contain this host

3.1 Simultaneous Containment

If multiple hosts are compromised, contain them all at the same time. If you isolate Host A at 14:30 and Host B at 14:35, the five-minute gap may be enough for the attacker (or their C2 automation) to notice and exfiltrate more data, destroy logs, or activate a backup persistence mechanism.

Coordinate with your team: assign one person per host, count down, act at the same moment.


4. Applied Scenario: Pre-Ransomware Containment

A SIEM alert fires at 14:30. The correlated evidence shows:

14:30:02  Event 4625 × 47   Brute force from 185.220.101.5 on WS-042
14:30:48  Event 4624 Type 3  Successful login as alice
14:31:02  Sysmon 1           powershell.exe -EncodedCommand JABm...
14:31:15  Sysmon 3           powershell.exe → 185.220.101.5:443
14:32:41  Event 7045         New service: WindowsUpdateHelper
14:33:10  Event 4624 Type 3  Administrator → SRV-001 (NTLM)

Your containment decisions:

Time Action Reason
T+0 (14:31) Block 185.220.101.5 at firewall Known brute-force source + C2
T+0 Disable alice account Compromised credential
T+2 Isolate WS-042 (VLAN reassignment) Active C2 connection confirmed
T+3 Isolate SRV-001 Lateral movement confirmed; second host compromised
T+5 Alert: check all other hosts for 185.220.101.5 connections Determine full scope before declaring contained
T+10 Declare P1 to management Scope: 2 hosts confirmed, wider scope unknown

What you do NOT do yet: - Delete WindowsUpdateHelper (that is Eradication — investigation first) - Rebuild WS-042 (that is Recovery — imaging and forensics first)


5. Containment Documentation

Every action you take during containment must be documented with:

CONTAINMENT LOG — IR-2026-0608-001

14:31:05 UTC  [Alice Martin]
  Action: Blocked IP 185.220.101.5 at perimeter firewall (rule ID: FW-1042)
  Rationale: Confirmed C2 IP (47 brute-force attempts + active outbound connection)

14:31:45 UTC  [Alice Martin]
  Action: Disabled AD account "alice" (via Disable-ADAccount)
  Rationale: Account used in successful brute-force login at 14:30:48

14:32:20 UTC  [Alice Martin]
  Action: Moved WS-042 to VLAN 999 (quarantine VLAN) via switch port gi1/0/12
  Rationale: Active C2 connection confirmed (Sysmon 3, 14:31:15)
  Business impact: WS-042 offline for user [email protected] — manager notified

This log is legal evidence. Be precise, factual, and complete.


6. Common Mistakes

Mistake 1: Partial containment — blocking one C2 IP when three are present. Malware C2 infrastructure often has multiple failover addresses. Block the domain, not just the IP. Check for other outbound connections from the same host.

Mistake 2: Containing without notifying the system owner. Taking a production server offline without telling the business is a relationship problem waiting to happen. A 30-second message ("We are isolating SRV-001 due to a confirmed security incident — expect 2–4 hours of downtime") prevents a crisis.

Mistake 3: Containing the compromised hosts but not hunting for others. If the attacker was in for 3 days before detection, they may have moved to 10 other systems. Contain the confirmed hosts first, then immediately hunt for others.


7. Practice Exercises

  1. SIEM shows active data exfiltration (large outbound transfer to an unknown IP) from a PCI-scoped database server. You have 3 minutes to decide: network isolation vs account disable vs process kill. Which do you do first and why?

  2. You have confirmed compromise on 4 hosts. You only have permission to isolate 2 at a time due to change management constraints. What is the risk of this constraint? What arguments do you make to get an emergency change approved?

  3. Write a two-sentence containment log entry for this action: "Disabled service WindowsUpdateHelper on SRV-001 at 14:45 UTC because it was identified as attacker persistence in Event 7045."


8. Lab

Assessment mode: flag

challenge_spec_id: 368 — Ransomware initial access

You are given a SIEM JSON log set showing the pre-ransomware kill chain from Section 4 above.

Task: 1. Decode the PowerShell -EncodedCommand payload (UTF-16LE base64) 2. The decoded script reveals the C2 IP and the service name installed for persistence 3. The flag is: PREFIX{c2_ip:service_name}


9. Framework Alignment

Framework Role Competency Confidence
CCSSF-CIR Cyber Incident Responder Containment decision-making High
CCSSF-COA Cyber Security Operations Analyst Alert-to-action escalation High
NICE 2.2.0 Incident Responder (PR-IRP-001) S0054 — Apply access controls during incident High

10. Further Reading

  • CISA Ransomware Guide — https://www.cisa.gov/stopransomware — Containment checklists specific to ransomware
  • NIST SP 800-61 — Section 3.3 covers containment, eradication, and recovery in detail
  • Mandiant IR playbooks — Publicly available playbooks for common incident types

Learning Objectives

["Apply the three-lever containment model (network isolation, account suspension, process termination) to a described incident and select the correct lever with justification", "Use the containment decision matrix to determine whether to isolate or monitor four different host types, accounting for exfiltration status, production criticality, and persistence", "Decode a base64 UTF-16LE PowerShell -EncodedCommand payload and extract a C2 IP and service name from the decoded script"]

Lesson Outline

Prerequisites → Why this matters → Containment vs remediation distinction → Three containment levers (network isolation, account suspension, process termination) with commands → Containment decision matrix (4-question flowchart) → Simultaneous containment → Applied pre-ransomware scenario (event-by-event decision table) → Documentation format → Common mistakes → Practice exercises → Lab (flag, spec 368) → Framework alignment → Further reading

Challenge Lab

Reinforce your learning with a hands-on generated challenge based on this card's competency.