TExcelTAD
Home › Cybersecurity › Incident Response

Incident Response

A security incident is an event that actually or potentially harms the confidentiality, integrity or availability of systems or data: a compromised account, ransomware, a leaked database, a lost unencrypted laptop. Incident response (IR) is the planned, practised way an organisation handles one. Panic and improvisation make incidents worse; a plan makes them shorter and cheaper.

The incident response lifecycle

The widely used NIST SP 800-61 model has four phases:

Phase Goal Examples
1. Preparation Be ready before anything happens IR plan, contact lists, logging, backups, tools, training, tabletop exercises
2. Detection & analysis Notice, confirm and scope the incident Triage alerts, collect evidence, decide severity, start a timeline
3. Containment, eradication & recovery Stop the damage, remove the cause, restore service Isolate hosts, disable accounts, patch, rebuild, restore from backups
4. Post-incident activity Learn and improve Blameless review, root cause, new detections, updated plan

The phases loop: lessons learned feed back into preparation, and new findings during recovery can send you back to analysis. (The SANS model splits the same work into six steps: preparation, identification, containment, eradication, recovery, lessons learned.)

Containment decisions

Containment is a trade-off. Pulling the network cable stops the attacker but also destroys volatile evidence and may tip them off; watching for longer reveals scope but risks more damage. Common short-term containment actions:

  • Isolate affected machines via EDR (keeps them powered on for forensics).
  • Disable or reset compromised accounts and revoke sessions and tokens (a password reset alone doesn't end existing sessions).
  • Block malicious IPs, domains and file hashes at firewalls, proxies and email filters.
  • Rotate secrets that may have been exposed: API keys, service passwords, signing keys.

Note: Preserve evidence before changing things where possible: memory images, disk snapshots, log exports. Record who did what and when; you may need it for insurers, regulators or law enforcement.

Severity classification

Teams classify incidents so that the response (who is paged, who is informed) matches the impact. A simple matrix:

python · try it yourself
def severity(data_sensitivity, systems_affected, ongoing):
    # data_sensitivity: 0 none, 1 internal, 2 personal/confidential
    score = data_sensitivity * 2 + min(systems_affected, 10) // 3 + (2 if ongoing else 0)
    if score >= 6:
        return "SEV-1 critical: page IR lead + CISO, consider legal/regulator notice"
    if score >= 3:
        return "SEV-2 high: IR team engaged during business hours + on-call"
    return "SEV-3 low: handle in the normal queue"

cases = [
    ("phishing email reported, nobody clicked", 0, 0, False),
    ("one laptop with malware, not yet contained", 1, 1, True),
    ("attacker active on 8 servers, customer DB accessed", 2, 8, True),
]
for label, data, systems, ongoing in cases:
    print(f"{label}\n  -> {severity(data, systems, ongoing)}")
phishing email reported, nobody clicked
  -> SEV-3 low: handle in the normal queue
one laptop with malware, not yet contained
  -> SEV-2 high: IR team engaged during business hours + on-call
attacker active on 8 servers, customer DB accessed
  -> SEV-1 critical: page IR lead + CISO, consider legal/regulator notice

Building a timeline

A precise timeline is the backbone of every investigation and report. Events come from many sources with different time zones; normalise everything to UTC and sort:

python · try it yourself
from datetime import datetime, timezone, timedelta

raw = [
    ("email gateway", "2026-05-11 09:12:00", 0, "phishing email delivered to 14 users"),
    ("EDR", "2026-05-11 11:47:30", 2, "macro spawned powershell on PC-0231"),
    ("proxy", "2026-05-11 09:48:10", 0, "PC-0231 contacts unknown domain"),
    ("identity provider", "2026-05-11 05:15:00", -5, "admin login for svc-backup from PC-0231"),
    ("SIEM", "2026-05-12 08:30:00", 0, "alert: svc-backup used interactively"),
    ("IR team", "2026-05-12 09:05:00", 0, "PC-0231 isolated, svc-backup disabled"),
    ("IR team", "2026-05-12 15:40:00", 0, "credentials rotated, systems verified clean"),
]

def to_utc(local, offset_hours):
    t = datetime.strptime(local, "%Y-%m-%d %H:%M:%S")
    return t.replace(tzinfo=timezone(timedelta(hours=offset_hours))).astimezone(timezone.utc)

timeline = sorted((to_utc(t, off), src, what) for src, t, off, what in raw)
for when, src, what in timeline:
    print(f"{when:%m-%d %H:%M} UTC  {src:<17} {what}")
05-11 09:12 UTC  email gateway     phishing email delivered to 14 users
05-11 09:47 UTC  EDR               macro spawned powershell on PC-0231
05-11 09:48 UTC  proxy             PC-0231 contacts unknown domain
05-11 10:15 UTC  identity provider admin login for svc-backup from PC-0231
05-12 08:30 UTC  SIEM              alert: svc-backup used interactively
05-12 09:05 UTC  IR team           PC-0231 isolated, svc-backup disabled
05-12 15:40 UTC  IR team           credentials rotated, systems verified clean

Sorted in UTC, the story becomes clear: the email arrived first, the macro ran, the machine called out, and the stolen service account was used shortly afterwards. The EDR event logged in local time (UTC+2) and the identity provider (UTC−5) would have looked out of order without normalisation.

Measuring response: MTTD and MTTR

From the timeline we can compute the metrics a SOC reports: time to detect (first malicious activity to alert), time to contain, and time to recover:

python · try it yourself
from datetime import datetime

def t(s):
    return datetime.fromisoformat(s)

incidents = [
    {"start": t("2026-05-11T09:12"), "detected": t("2026-05-12T08:30"),
     "contained": t("2026-05-12T09:05"), "recovered": t("2026-05-12T15:40")},
    {"start": t("2026-06-02T14:00"), "detected": t("2026-06-02T14:20"),
     "contained": t("2026-06-02T15:00"), "recovered": t("2026-06-03T10:00")},
    {"start": t("2026-07-19T01:30"), "detected": t("2026-07-21T09:30"),
     "contained": t("2026-07-21T12:30"), "recovered": t("2026-07-23T18:30")},
]

def mean_hours(key_from, key_to):
    total = sum((i[key_to] - i[key_from]).total_seconds() for i in incidents)
    return total / len(incidents) / 3600

print(f"MTTD (start -> detected):     {mean_hours('start', 'detected'):6.1f} h")
print(f"MTTC (detected -> contained): {mean_hours('detected', 'contained'):6.1f} h")
print(f"MTTR (detected -> recovered): {mean_hours('detected', 'recovered'):6.1f} h")
MTTD (start -> detected):       26.5 h
MTTC (detected -> contained):    1.4 h
MTTR (detected -> recovered):   27.9 h

Detection is usually the longest phase. That's the argument for investing in logging, detection rules and threat hunting.

After the incident

A post-incident review (also called a post-mortem) should be blameless: the goal is to find the conditions that made the incident possible, not a person to punish (people stop reporting problems if they fear blame). Typical outputs: root cause, what went well, what didn't, and concrete actions with owners, such as "alert on interactive use of service accounts" or "block Office macros from the internet".

Depending on the data involved, there may be legal obligations: under the GDPR, for example, a personal-data breach must usually be reported to the supervisory authority within 72 hours of becoming aware of it.

Go further: NIST SP 800-61 Rev. 3 and the CSF 2.0 Functions starts the incident-response section of the Malware Analysis, Forensics and IR course.

Test yourself

In the NIST lifecycle, which phase includes writing the IR plan and running tabletop exercises?

  1. Detection & analysis
  2. Containment
  3. Preparation
  4. Post-incident activity

Why should all timeline events be converted to UTC?

  1. UTC is more secure
  2. Sources log in different time zones, so local times sort in the wrong order
  3. Regulators require it
  4. To shorten timestamps

An account is compromised. Why isn't resetting the password alone enough?

  1. Passwords can't be reset
  2. Existing sessions and tokens may stay valid, and the attacker may have added MFA devices or keys
  3. It is too slow
  4. It deletes evidence