Skip to content
Tutorials Center
My learning

Topics

Lesson 34 of 37 ยท Design and Operations

Network Incident Response

Learn the incident response lifecycle for network security events: preparation, detection, triage, containment, eradication, recovery and lessons learned, with a timeline builder and playbook.

Sooner or later a control fails or a user clicks the wrong link. What separates a bad day from a catastrophe is how quickly and calmly the team detects, understands and contains the problem. Incident response (IR) is the prepared, practiced way of doing that. A good IR process is boring: roles are known, tools are ready, decisions follow a playbook, and evidence is kept.

This lesson walks through the lifecycle with a network focus, covering containment options, evidence handling and communication, and then builds a timeline from raw events and a simple triage scoring function in Python. All incidents and addresses are invented.

The lifecycle

flowchart LR
    P["1. Prepare"] --> D["2. Detect and analyze"]
    D --> C["3. Contain"]
    C --> E["4. Eradicate"]
    E --> R["5. Recover"]
    R --> L["6. Lessons learned"]
    L --> P

This follows the widely used NIST model (with detection and analysis as one phase). The SANS model splits the same ground into six named steps: preparation, identification, containment, eradication, recovery, lessons learned.

1. Prepare

Most of the work happens before an incident.

  • People and roles: an incident commander, technical leads, a communications owner, legal and management contacts, 24/7 on-call details.
  • Playbooks for common cases (phishing, malware outbreak, DDoS, lost laptop, compromised account, ransomware).
  • Tools and access: log search (SIEM), packet capture, EDR, ability to isolate hosts and block addresses quickly, a clean forensic workstation, out-of-band communication (when email is compromised).
  • Baselines and inventory so you know what is normal (anomaly detection) and who owns what.
  • Backups that are tested, offline or immutable.
  • Exercises: tabletop discussions and simulations. A plan that has never been rehearsed fails under stress.

2. Detect and analyze

An alert is not yet an incident. Triage decides: is it real, how bad, what is affected, who needs to know? Questions to answer quickly:

  • What triggered it, and can I reproduce or corroborate it with a second source?
  • Which assets, accounts and data are involved?
  • Is the activity still going on?
  • What is the potential impact (data loss, outage, regulatory duty)?

Assign a severity and a priority, open a ticket, and start a written timeline. Record every action with time and author; this record is invaluable later.

3. Contain

Stop the spread without destroying evidence and without causing more damage than the attack. Network containment tools:

  • Isolate the host (EDR network quarantine, move to a quarantine VLAN, disable the switch port).
  • Block indicators at the firewall, proxy and DNS: malicious IPs, domains, URLs.
  • Disable or reset compromised accounts, revoke sessions and tokens, rotate exposed keys.
  • Segment off an affected zone; cut a specific link rather than the whole site where possible.
  • Short-term versus long-term containment: first stop the bleeding (isolate), then build clean temporary workarounds so the business can operate.

Do not simply power off a compromised machine if you may need memory contents; follow your forensic procedure. Also do not "clean up" before capturing evidence.

4. Eradicate

Remove the cause: delete malware, close the exploited vulnerability (patching), remove attacker accounts and persistence mechanisms (scheduled tasks, startup entries, rogue keys), rebuild from known-good images when you cannot trust a system. Check every place the attacker touched; missing one means they return.

5. Recover

Restore services from clean backups or rebuilds, return systems to production in stages, and monitor closely for signs of the attacker coming back. Confirm that credentials and keys were rotated. Communicate status to stakeholders.

6. Lessons learned

Hold a blameless review within a couple of weeks: What happened? What worked? What slowed us down? Which detection or control would have caught it earlier? Turn answers into concrete tasks with owners (new detection rules, a firewall change, training, an updated playbook).

Evidence handling

  • Work on copies (disk images, exported logs) and compute hashes so you can show they were not altered.
  • Keep a chain of custody: who collected what, when, from where, and who has handled it since.
  • Collect volatile data first (memory, active connections, running processes) since it disappears at reboot.
  • Preserve logs from firewalls, proxies, DNS, VPN and authentication systems; set legal holds so they are not rotated away.
  • Involve legal counsel early: breach notification laws can impose deadlines (some as short as 72 hours after becoming aware).

Building a timeline from events

Logs from different systems must be merged in time order. The program merges events (already normalized to UTC) from several sources and prints the story of a suspected compromise.

Python Merge events into an incident timeline

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Read as a story: a download, a script launching PowerShell, outbound contact, persistence, then attempts to move sideways to file servers that the firewall denied. That sequence tells the team to isolate PC-17, reset alice's credentials, block 198.51.100.77, and check whether any other host contacted that address.

Triage scoring

Teams often use a consistent rubric so that severity is not decided by whoever shouts loudest. The stand-in below scores an incident from a few yes/no questions and maps the total to a response level.

Python A simple severity rubric

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Numbers like these are calibration aids, not laws: a smaller incident involving regulated data can still need legal involvement immediately.

Communication

  • Internal: a single channel and a single source of truth; short, factual updates on a schedule.
  • External: customers, regulators, partners and the press are handled by designated people only. Draft templates in advance.
  • Need to know: attackers may read your email. Use out-of-band channels for sensitive coordination during serious incidents.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What is the main purpose of containment?

    Containment limits impact first; cleanup and recovery come after the problem is bounded.
  2. 2. Which evidence should be collected first?

    Volatile data is lost at reboot or shutdown, so it is captured before disks and archives.
  3. 3. Why keep a written timeline during an incident?

    A timeline supports decisions, hand-offs and the post-incident review.
  4. 4. What is a blameless post-incident review for?

    Blameless reviews encourage honest information, which produces real fixes.
  5. 5. Why does eradication require checking every place the attacker touched?

    Leaving any foothold allows re-entry, so eradication must be complete and verified.

Summary

  • Incident response is a cycle: prepare, detect and analyze, contain, eradicate, recover, learn.
  • Preparation (roles, playbooks, tools, backups, exercises) determines how well the rest goes.
  • Triage separates real incidents from noise and sets severity; keep a written timeline.
  • Network containment: isolate hosts, block indicators, disable accounts, segment off zones, without destroying evidence.
  • Preserve evidence with copies, hashes and chain of custody; involve legal early.
  • Finish with a blameless review and concrete improvements.

Next: Project: A Network Log Analyzer