Hunting for Secondary Compromise
The hosts you've confirmed are rarely all the hosts the attacker touched. Secondary compromise — the spread beyond the initial foothold that occurred before you knew you were compromised — is the difference between an incident you understand and an incident you only partially understand.
A financial institution confirms ransomware on 14 servers in their European datacenter. EDR isolation is applied. The IR team identifies the initial access: a VPN credential compromise 17 days before the ransomware deployment. Seventeen days. During that dwell time, the attacker authenticated from the initial VPN foothold to 340 unique hosts across four datacenter regions. They dumped credentials from 12 domain controllers. They accessed a code signing server. They read email from the CISO, the CFO, and the General Counsel. They exfiltrated 2.4TB of data from file servers the IR team didn't know existed. The "ransomware incident" was the last 4 hours of a 17-day operation. The IR team that declares the incident over after cleaning the 14 initially identified ransomware hosts is not closing an incident — they are closing a door on a burning building and walking away. The scope of secondary compromise, discovered only through systematic hunting across the full dwell period, determined the actual scope of the investigation: who to notify, what data was affected, and whether the attacker was truly gone.
Lateral Movement Detection Methodology
Lateral movement is the process by which an attacker moves from their initial foothold to other systems in the environment. Detecting it retrospectively — reconstructing the attacker's movement path from logs after the fact — requires combining multiple evidence sources because no single source provides a complete picture.
Lateral Movement Evidence Sources
══════════════════════════════════════════════════════════════════════
WINDOWS EVENT LOGS (DC-centric)
─────────────────────────────────────────────────────────────────
Event ID 4624 (Logon Success) on target host:
• Logon Type 3 (network logon): SMB, file shares, DCOM
• Logon Type 10 (remote interactive): RDP
• Fields: Account Name, Source Network Address, Logon Process
Query: all successful logons from a confirmed compromised host's IP
to any other host during the compromise window.
Event ID 4769 (Kerberos Service Ticket Request) on DC:
• Shows which service on which host the account requested a ticket for
• Attacker doing lateral movement via Kerberos generates a flood of 4769
events from the same source within a short window
• Look for: volume anomaly (10+ unique service ticket requests from
one IP in under 5 minutes), tickets requested for unusual services
Event ID 4648 (Logon using explicit credentials):
• Fires when a process passes explicit credentials (as in runas
or Pass-the-Hash with explicit credential specification)
• On the SOURCE host — shows that explicit credential passing occurred
EDR PROCESS AND NETWORK TELEMETRY
─────────────────────────────────────────────────────────────────
Network connections: attacker tools connecting to new hosts
Process tree: unusual parent-child process relationships indicating
remote execution (e.g., wmiprvse.exe spawning cmd.exe — WMI remote
execution; services.exe spawning attacker binary — PSExec service)
NETFLOW / IPFIX
─────────────────────────────────────────────────────────────────
Lateral movement paths show as: new connections from confirmed
compromised host IP to other hosts on internal ports (445, 3389,
5985, 135). High connection volume to many hosts = scanning/discovery.
High byte count from a host to a single target = data staging.
Timeline Correlation
Timeline correlation is the process of building a unified chronological view of attacker activity across all evidence sources. It is the foundation of understanding what happened in a multi-host incident. Each individual evidence source shows a fragment; the timeline shows the full picture.
Building the Incident Timeline ══════════════════════════════════════════════════════════════════════ INPUT SOURCES (normalize all timestamps to UTC) ───────────────────────────────────────────────────────────────── Windows event logs → convert to UTC, export to structured format EDR telemetry → already timestamped in UTC Firewall/proxy logs → normalize timestamps Email gateway logs → normalize timestamps Cloud audit logs (CloudTrail, Entra ID) → already UTC NetFlow data → normalize timestamps Forensic file system timestamps (MACB: Modified, Accessed, Changed, Born) TIMELINE CONSTRUCTION METHODOLOGY ───────────────────────────────────────────────────────────────── Start from the earliest confirmed attacker activity and work forward. Group events into phases: Phase 1: Initial Access Time: first external connection from attacker IP to your perimeter Evidence: firewall/proxy logs, email gateway (for phishing) Phase 2: Execution (first code execution) Time: first malicious process on first compromised host Evidence: EDR process creation, Windows Event ID 4688 Phase 3: Discovery (attacker exploring the environment) Time: first reconnaissance commands (net group, whoami, ipconfig, systeminfo, nltest, BloodHound queries) Evidence: EDR command-line telemetry, Sysmon Event ID 1 Phase 4: Lateral Movement Time: first connection from initial foothold to second host Evidence: Event ID 4624 on second host, NetFlow, EDR Phase 5: Privilege Escalation Time: first use of DA or elevated credentials Evidence: Event ID 4672, 4769 with DA account from new source Phase 6: Objectives (exfiltration, staging, persistence) Time: when attacker began achieving their goals Evidence: NetFlow large outbound bytes, EDR file access events, WMI subscription creation, scheduled task creation TIMELINE ARTIFACTS (automated tools) ───────────────────────────────────────────────────────────────── Timesketch: open-source timeline analysis platform that ingests multiple data sources and allows timeline searching/visualization Plaso (log2timeline): parses dozens of artifact types into a normalized super-timeline Velociraptor notebook: in-platform timeline correlation against collected artifacts
EDR Fleet Hunting Queries
EDR fleet hunting means running a detection query across all endpoints simultaneously to find evidence of attacker activity beyond the initially confirmed hosts. This is how the IR team discovers secondary compromise at scale.
| Hunt objective | Query approach | What it finds |
|---|---|---|
| Find all hosts that ran the same malware hash | EDR hash search: all process creation events with SHA-256 = [attacker binary hash] across all endpoints in the time range | Every host that executed the specific malware binary — even hosts not yet on the confirmed list |
| Find all hosts with a connection to attacker C2 IP | EDR network telemetry: all outbound connections to [attacker C2 IP] across all endpoints | All hosts that were beaconing to the attacker — even those without a primary detection alert |
| Find hosts where LSASS was accessed by non-system processes | EDR: process access events where target = lsass.exe and source process is not in the whitelist of known legitimate security products | All hosts where credential dumping was attempted — not just the confirmed compromised ones |
| Find all scheduled tasks created in the compromise window | EDR or Windows event telemetry: Task Scheduler Event ID 4698 (task created) from [start of dwell] to [current time] | All new scheduled tasks across the fleet, which can be compared against the baseline to find attacker-created tasks |
| Find all hosts that connected to confirmed compromised hosts | NetFlow or EDR network telemetry: all connections to/from confirmed compromised host IPs during the compromise window | The full lateral movement graph — every host that communicated with known-compromised hosts |
| Find attacker discovery commands (BloodHound collection) | EDR command-line telemetry: process command lines containing "-CollectionMethod", "SharpHound", "bloodhound", or LDAP queries for "samaccounttype=805306368" | Hosts from which the attacker ran Active Directory reconnaissance |
An alert fires on Day 17. If you look forward from the alert — investigating what happened after the alert — you understand the last few hours of a 17-day intrusion. If you look backward from patient zero — finding the first compromised host and reconstructing forward from that initial access point — you understand the entire intrusion. The difference between these two investigation directions determines whether you close the incident with accurate scope or false confidence. Looking backward requires identifying patient zero (the first compromised host), which requires working with the full dwell period. For attacker activity before the first EDR alert, the evidence is often in: Windows authentication logs on the domain controller (the attacker authenticated before they were blocked), NetFlow logs showing scanning or data access before the malware was deployed, email gateway logs if initial access was via phishing. The IR team that only investigates from the alert forward will systematically undercount the scope of every intrusion with significant dwell time.
Active Directory Logs as a Lateral Movement Map
Domain controllers are the chokepoint for Kerberos authentication across the entire Windows domain. Every lateral movement attempt that uses domain credentials passes through the DC's event logs. This makes DC logs the single highest-value evidence source for reconstructing lateral movement at scale in a Windows environment — assuming they were forwarded to SIEM and not just stored locally on the DC.
DC Authentication Events as a Lateral Movement Map
══════════════════════════════════════════════════════════════════════
HOW TO READ THE MAP:
─────────────────────────────────────────────────────────────────
Event ID 4768 (Kerberos Authentication Service Request):
→ Account Name requested a TGT from [DC]
→ Source IP: where the request originated
→ Map: which IPs requested TGTs for which accounts
Event ID 4769 (Kerberos Service Ticket Request):
→ Account Name requested access to Service Name on Target Host
→ Source IP: the requesting host
→ Map: which hosts requested access to which other hosts
ATTACKER PATTERNS IN DC LOGS:
─────────────────────────────────────────────────────────────────
Credential stuffing via Kerberos:
→ Many 4768 failures for multiple accounts from one IP (password spraying)
→ Then 4768 success for one account → lateral movement begins
Horizontal sweep (attacker discovering all hosts):
→ Many 4769 events for different target hosts (CIFS/SMB tickets) from
one source IP within a few minutes
→ This is the attacker's network discovery: they requested service
tickets for every host name they found in DNS
High-value access:
→ 4769 for service tickets to DCs, backup servers, file servers containing
sensitive data → shows which high-value targets the attacker targeted
BUILDING THE LATERAL MOVEMENT GRAPH FROM DC LOGS:
─────────────────────────────────────────────────────────────────
Nodes = hosts (identified by IP and hostname from 4769 events)
Edges = authentication attempts between hosts during the dwell period
Color = confirmed compromised (red) vs. unconfirmed (yellow) vs. clean (green)
Weight = number of connections (high weight = high-value target to attacker)
The graph shows: where the attacker went, what they targeted, and
which "clean" hosts received connections from confirmed compromised
hosts (these are candidates for secondary compromise investigation)
Cloud Lateral Movement
Lateral movement in cloud environments takes different forms than in on-premises Windows environments. Understanding the cloud-specific patterns prevents an IR team from missing significant lateral movement that would be obvious in a Windows event log but leaves no Kerberos tickets.
| Cloud lateral movement technique | Evidence source | What to look for |
|---|---|---|
| AWS: IAM role assumption from compromised EC2 instance | CloudTrail: AssumeRole API calls | Instance metadata service (IMDS) credential use followed by API calls from the instance's role — especially API calls to resources outside the instance's normal scope |
| AWS: Cross-account role assumption using compromised credentials | CloudTrail in each account (all accounts must have CloudTrail enabled) | AssumeRole calls crossing account boundaries; calls to sts:AssumeRole for role ARNs in different accounts |
| Azure: Managed identity abuse | Azure Activity Log, Entra ID Sign-in logs | API calls using a managed identity from an unusual source or for resources outside the VM's normal access pattern |
| Entra ID: Service principal privilege escalation | Entra ID Audit Logs | Role assignments made to service principals during the compromise window; service principal client secret additions |
| Kubernetes: lateral movement via pod service account | Kubernetes audit log | API calls from a pod's service account to Kubernetes API resources it shouldn't access; creation of new pods, execution into existing pods |
Blast Radius Expansion Loop
The blast radius of an incident is the full set of systems, accounts, and data that the attacker accessed. During IR, the blast radius almost always expands as investigation deepens — each newly confirmed compromised host reveals new authentication events that reveal new potentially-compromised hosts. Managing this expansion loop is fundamental to knowing when the investigation is complete.
Blast Radius Investigation Loop
══════════════════════════════════════════════════════════════════════
START: confirmed compromised host list (Day 1)
─────────────────────────────────────────────────────────────────
Initial confirmed: 14 hosts (ransomware deployment hosts)
LOOP ITERATION 1: Find all hosts confirmed compromised hosts talked to
─────────────────────────────────────────────────────────────────
Query: DC logs + NetFlow for connections from 14 known hosts
New findings: 47 additional hosts received connections from
the confirmed 14 during the dwell period
Add to investigation queue: 47 hosts
LOOP ITERATION 2: Triage the 47 hosts
─────────────────────────────────────────────────────────────────
For each of the 47 hosts: check EDR telemetry for evidence of
malware execution, credential dumps, persistence installation,
new C2 connections
Finding: 23 of 47 have evidence of attacker tool execution
→ Confirmed compromised; add to confirmed list
24 of 47: received connections but no evidence of compromise
→ Lower confidence; monitor but do not add to confirmed list yet
LOOP ITERATION 3: Find all hosts the new 23 talked to
─────────────────────────────────────────────────────────────────
Query: repeat for the newly confirmed 23 hosts
New findings: 8 additional hosts discovered
Of these: 3 confirmed compromised; 5 unconfirmed
LOOP EXIT CONDITIONS:
─────────────────────────────────────────────────────────────────
The loop exits when:
→ A full iteration produces no newly confirmed compromised hosts
(the blast radius has stopped expanding)
→ The attacker's movement path has been traced to its boundaries
(patient zero has been identified, full path is mapped)
→ Confidence level: >95% of the blast radius is understood
(100% is rarely achievable; the goal is a defensible scope)
WHAT THE LOOP PRODUCES:
─────────────────────────────────────────────────────────────────
A scope statement: "The attacker accessed X hosts, Y accounts,
and Z data repositories, over N days, with confidence level HIGH/
MEDIUM based on available telemetry coverage."
This statement drives notification decisions, regulatory disclosure,
and the final incident report.
The most common IR scope error: declaring that "14 hosts were affected" based on where ransomware was deployed, without investigating the dwell period activity. Ransomware deployment is the attacker's final action, not their only action. The question is not "where did ransomware deploy?" but "where did the attacker go during the 17-day dwell period?" Those are fundamentally different questions with dramatically different answers. The blast radius loop — starting from confirmed compromised hosts and working outward through lateral movement evidence — is the methodology that bridges these two questions. An IR engagement that fails to run this loop before declaring scope complete is producing an incomplete investigation, regardless of how well it handled the technical containment and eradication work.
Q & A
How do you determine the dwell time — when the attacker actually first entered the environment?
Dwell time determination starts from patient zero (the first compromised host) and works backward through logs to find the earliest attacker-controlled activity. The starting point is the initial detection: the first EDR alert, the first SIEM correlation, the first IOC match. From there, work backward: when did the malicious process first execute? When did the user account used for initial access first authenticate in an unusual way? When did the C2 IP first appear in firewall logs? Each backward step extends the dwell time estimate. For a credential-compromise initial access, the earliest evidence may be an unusual authentication event in the domain controller logs from a VPN IP that doesn't match historical patterns. For a phishing initial access, the earliest evidence may be a macro execution in the email gateway logs. Dwell time matters for regulatory notifications (breach notification timelines count from when the attacker first had access to personal data, not from when you detected them), for understanding the full scope of data access, and for improving detection controls (a 17-day dwell before detection means detection controls failed for 17 days — what should have triggered earlier?)
What is BloodHound and why does finding evidence of it in EDR telemetry indicate a serious intrusion?
BloodHound is an open-source tool that maps Active Directory attack paths: it collects data about AD objects (users, groups, computers, GPOs, ACLs) and visualizes the paths an attacker can take from any compromised account to Domain Admin. Running BloodHound is a deliberate reconnaissance action — it indicates that the attacker is actively planning their privilege escalation path to domain dominance. The implication for scope: if BloodHound collection occurred, the attacker has a detailed map of your AD environment and knows which accounts and systems to target to reach the highest privileges. They have likely used that map to execute lateral movement toward DA credentials. Finding BloodHound evidence in EDR telemetry changes the investigation priority: assume DA credentials were targeted, check for LSASS dumps on the DC, run the KRBTGT double-reset, and assume the blast radius is much broader than the initially confirmed host list. BloodHound collection is an early-stage action — evidence of it typically means the dwell time was substantial and the attacker was systematic in their approach.
If EDR telemetry only covers 60% of hosts, how do you hunt for secondary compromise on the uncovered 40%?
The uncovered 40% requires alternative evidence sources. Primary alternatives: (1) DC authentication logs — these cover every Windows host that authenticates to the domain, regardless of whether they have EDR. Unusual authentication patterns from unmanaged host IPs during the compromise window are indicators of attacker access on those hosts. (2) NetFlow — covers all hosts at the network layer, regardless of agent deployment. Connections from confirmed attacker IPs to uncovered hosts are strong indicators of access. (3) SIEM with OS-level log forwarding — if Windows Event Log forwarding was configured to SIEM for hosts without EDR, those logs provide similar coverage to EDR for key events (4624, 4769, 4688 if process auditing is enabled). (4) Physical access or local examination — if a specific uncovered host is suspected based on network evidence, physical access to run Autoruns and collect artifacts is required since no remote forensic channel exists. For the subset of uncovered hosts that appear in the lateral movement graph (received connections from confirmed compromised hosts), in-person investigation or network isolation is warranted.
How long does a thorough secondary compromise hunt take in a 1,000-host environment?
A thorough secondary compromise hunt in a 1,000-host environment is typically a multi-week project for an experienced IR team with full tooling. The constraint is analyst time for triage and interpretation — automated tools (EDR fleet queries, Velociraptor hunts) can collect data quickly, but the analysis of what the data means requires human judgment. A rough breakdown: initial EDR fleet queries and triage to identify confirmed secondary hosts — 2–3 days. DC log analysis to reconstruct lateral movement graph — 2–5 days depending on log volume and SIEM capability. Deep investigation of each confirmed secondary host (Autoruns comparison, artifact collection, timeline correlation) — 1–4 hours per host. For 50 confirmed secondary hosts, that's 50–200 analyst hours of investigation work. Organizations without a SIEM with 1-year retention, without EDR fleet query capability, and without Velociraptor or equivalent may take significantly longer because the evidence collection itself is slow. This is why Preparation investments (SIEM retention, EDR deployment coverage, Velociraptor) directly reduce the duration and cost of every significant IR engagement.
When is it appropriate to call the scope investigation "done enough" and move to eradication?
Scope investigation is complete "enough" when additional investigation is producing diminishing marginal returns: the blast radius loop has completed an iteration without discovering new confirmed compromised hosts, the full lateral movement path has been traced from initial access to all known endpoints, and the confidence level in the scope is high enough to support the organization's notification and remediation decisions. Perfect scope certainty is not achievable in most IR engagements — there will always be uncertainty about hosts with incomplete telemetry coverage. The practical threshold is: do we understand the attacker's full operational path well enough to be confident that we can eradicate their presence by cleaning everything we've identified? If the answer is yes, proceed to eradication. If the answer is "we think there might be a lot more we haven't found," extend the scope investigation phase. The consequences of incomplete scope are severe enough — re-intrusion through a host you didn't clean, incorrect regulatory notification — that the threshold for "done enough" should be set high. When in doubt, extend.