Dwell time

Attackers once hid for a year; detection cut it to two weeks

Median days an attacker was inside before being found (Google Mandiant)2011416 days201699 days201956 days202121 days202310 days202514 daysIn 2025, 52% of intrusions were first spotted by the victim’s own team, up from 43%. Espionage still hid for 122 days.Attackers once hid for over a year; detection has cut that to about two weeks.Dwell time is how long an intruder operates before anyone notices. Logging, EDR and monitoring teams havedriven it down, though ransomware gangs, who announce themselves, pull the median down too. The quietestattackers, spies, still stay for months, which is why detection has to look for behaviour, not just malware.

Dwell time fell from 416 days (2011) to 14 (2025); 52% of intrusions are now found internally.

Logging

Each log source answers one question; together they tell the story

SourceAnswers the questionAn entry that mattersFirewall, NetFlowwho talked to whom, how much10.1.5.20 → 203.0.113.9:443, 3.2 GBDNSwhich names were looked uplaptop-17 asked for xj3k.exampleAuthenticationwho signed in, from where, howj.lee VPN sign-in, new country, MFA pushEndpoint (EDR)what ran on each machinewinword.exe started powershell.exeWeb and applicationrequests, errors, users312 failed logins to /api/login in 60 sCloud auditevery API call and admin changeDeleteTrail called by role ops-adminLogs only help if clocks agree (NTP), they are kept long enough, and attackers cannot edit or delete them.Each log source answers one question; an investigation needs several of them, on the same clock.Network logs show connections, DNS shows intent, authentication shows who, endpoints show what ran, cloudaudit logs show every change to the infrastructure. Attackers delete logs, so ship them off the host at onceto a store they cannot change, and keep them long enough to cover a dwell time of weeks or months.

Collect network, DNS, authentication, endpoint, application and cloud audit logs, synchronised by NTP and protected from tampering.

Log management · Going deeper

Formats, flows versus packets, key Windows events and retention

Know syslog, NetFlow versus packet capture, Windows event IDs 4624 and 4625, retention and log integrity.

  • Syslog the standard for sending log messages from network devices and Linux systems to a central collector.
  • NetFlow and IPFIX summaries of each connection: addresses, ports, bytes, time. Cheap to keep for months.
  • Packet capture the full content of traffic. Rich evidence, very large, kept for days at most and useless for encrypted payloads.
  • Windows Security log event 4624 is a successful sign-in, 4625 a failed one, 4720 a new account, 1102 the log being cleared.
  • Metadata email headers, file timestamps and authorship, mobile location: often enough to reconstruct events.

Keeping logs trustworthy

Centraliseforward logs off each host at once
Synchroniseevery clock via NTP, in UTC
Protectwrite-once storage, hashing, restricted access
Retainlong enough for investigations and regulations

SIEM

A SIEM joins four quiet signals into one alert worth waking for

02:0002:1002:2002:3002:4002:50Identityj.lee: VPN sign-in, new country, after 9 MFA pushesDirectoryj.lee lists every admin groupFirewalllaptop-17 → 40 servers, SMB, 2 minProxy3.2 GB to a new file-sharing site1 high alertsame user and host4 sources, 30 min“likely accounttakeover and theft”Alone, each event is low priority. Joined by user, host and time, they are one incident.A SIEM joins small signals from many sources into one alert that a person can act on.A security information and event management system collects logs, normalises them and runs correlation rules:here, a risky sign-in, directory reconnaissance, a burst of file-share connections and a large upload by the sameuser within 30 minutes. A SOAR platform can then run the first response steps automatically.

A SIEM collects, normalises and correlates logs; SOAR automates the first response steps.

Security operations · Going deeper · 1 of 2

SIEM, SOAR and UEBA, and how a security operations centre works

A SOC runs the SIEM, triages alerts in tiers and uses SOAR playbooks; UEBA adds behaviour baselines.

  • SIEM collects logs, normalises them into common fields, correlates with rules, stores them for search and reports, and shows dashboards.
  • SOAR security orchestration, automation and response: playbooks that enrich an alert, ask the user, disable an account or isolate a host automatically.
  • UEBA user and entity behaviour analytics: learns normal for each user and machine and scores deviations.
  • Threat intelligence feeds known-bad IPs, domains and hashes matched against logs: cheap, but only as good as their freshness.

Inside a SOC

Analysts work in tiers: tier 1 triages alerts, tier 2 investigates, tier 3 hunts and handles major incidents. Measures that matter are mean time to detect (MTTD) and mean time to respond (MTTR). Many companies outsource part of this to a managed detection and response (MDR) provider.

SIEM · Going deeper · 2 of 2

Abnormal only stands out once you know what normal looks like

Data sent out by one file server each day, for 30 days (gigabytes, to scale)010203040normal: 1.1 GB a day; alert above 1.8 GB (mean + 3σ)day 27: 38 GB, 36× normal, at 03:00day 1day 10day 20day 30You can only spot the abnormal once you know what normal looks like.Baselines record normal behaviour per user, host and service: data volumes, sign-in times, processes. User andentity behaviour analytics (UEBA) learn them automatically and flag outliers that no fixed rule would name, suchas a server that suddenly sends thirty times its usual data in the middle of the night.

A baseline of normal behaviour lets anomaly detection and UEBA flag what no rule names.

Vulnerability scanning

Give a scanner credentials, and it sees what is really installed

Non-credentialed: sees the outsidescannerserverprobes· open ports: 22, 443, 3389· service banners and versions· TLS and protocol settings· default logins it can guessCredentialed: sees the insidescannerserverlogs in· every installed package· missing patches, exactly· local settings, accounts· plus all of the outside viewCredentialed or agent-based scans find far more with fewer false positives. Guard the scan account like an admin account.A scanner sees what an outsider sees; give it credentials, and it sees what is actually installed.Vulnerability scanners match what they find against known CVEs and misconfigurations, on a schedule and afterchanges. A non-credentialed scan shows the attacker’s view from the network. A credentialed scan logs in andreads installed versions, so it reports missing patches accurately. Results are verified, prioritised and tracked.

Non-credentialed scans show the outside view; credentialed scans read installed software and find missing patches accurately.

Running scans · Going deeper

Scan types, false positives and what to do with results

Know agent-based and network scans, false positives, CSPM, and the scan, verify, prioritise, fix, rescan loop.

  • Network scan from a central scanner across address ranges; finds unknown devices too.
  • Agent-based scan software on each host reports continuously, including laptops that are rarely on the office network.
  • Web application scan a DAST tool crawls and tests a running site for injection, XSS and misconfiguration.
  • Cloud configuration (CSPM) checks cloud accounts for public storage, open security groups and missing logging.
  • Container and code scans images and dependencies are scanned in the build pipeline.

From report to fix

Verifyweed out false positives
Prioritiseexploited and exposed first
Fix or acceptpatch, configure, or record an exception
Rescanprove the fix worked
A false positive reports a flaw that is not there; a false negative misses a real one. Credentialed scans reduce both.

Penetration testing

A penetration test proves what an attacker could really do

Planscope and rulesof engagement,written permissionReconnaissancepublic sources (passive),then scanning (active)Exploitationuse flaws to gaina footholdPost-exploitationescalate, movelaterally, within scopeReportfindings, evidence,fixes; then clean upHow much the testers know at the startKnown environmenttesters get docs and access (white box)Partially knownsome information, like an insider (grey box)Unknown environmentnothing, like an outsider (black box)A penetration test proves what an attacker could actually do, with permission and inside agreed limits.A scan lists possible weaknesses; a pen test chains them to show real impact, such as reaching customer data.Without written authorisation and agreed rules of engagement (scope, dates, methods, contacts), the same workis a crime. Tests run yearly, after major changes, and as compliance requires, for example PCI DSS.

A penetration test follows rules of engagement with written permission; environments are known, partially known or unknown.

Testing and exercises · Going deeper · 1 of 2

Red, blue and purple teams, bug bounties and tabletop exercises

Red teams attack, blue teams defend, purple teams learn together; bug bounties pay outside researchers.

  • Red team a long, stealthy campaign against the whole organisation, people and buildings included, to test detection and response, not just find flaws.
  • Blue team the defenders: SOC, incident response, engineering.
  • Purple team red and blue working side by side, replaying techniques and tuning detection after each one.
  • White team referees an exercise and sets its rules.
  • Bug bounty outside researchers are paid for valid findings under published rules; a vulnerability disclosure policy offers safe harbour without pay.

Vulnerability scan

Automated, broad, frequent. Lists likely weaknesses.

Penetration test

Human-led, scoped, periodic. Proves impact.

Red team

Goal-based, stealthy, rare. Tests detection and response.

Penetration testing · Going deeper · 2 of 2

Hunters assume someone is already inside, and go looking

HypothesisSearch the dataFind or rule outImprove detectionassume breachHypothesisstolen credentials used for RDP between workstations (T1021.001)Searchevery workstation-to-workstation RDP session in 90 days of logsFoundtwo machines: one an admin’s approved test, one not, now investigatedImprovea new SIEM rule alerts on it from now onThreat hunting assumes an attacker is already inside and goes looking, instead of waiting for an alert.Hunters start from a hypothesis, often an ATT&CK technique or fresh threat intelligence, and search the data fortraces of it. Whatever they find, the hunt ends with better detection, so the next attacker trips an alert.

Threat hunting is hypothesis-driven: search for an ATT&CK technique, then turn findings into detections.

Lesson complete

You finished “Detecting attacks”

Nicely done.

Open in a new tab