Agent Foskett Academy • Microsoft Sentinel • Module 7 • Lesson 64

Lesson 64 — Detecting Lateral Movement with KQL

Hunt for potential lateral movement using Windows logon events, source-to-destination patterns, privileged activity and corroborating evidence—without confusing normal administration for an attack.

Module 7 — Advanced Threat Hunting and Investigation • Lateral Movement Hunting
Agent Foskett lateral movement threat hunting Microsoft Sentinel
What you will learn

Follow movement between systems without assuming every remote logon is malicious.

✓ Validate Windows event collection
✓ Interpret remote logon types
✓ Hunt account-to-host patterns
✓ Build defensible movement timelines

Agent Foskett case file — The account that visited six servers

A privileged account authenticates to six servers within a short period. There is no confirmed malware alert. Is it an administrator performing routine maintenance, an automated management task, or an attacker moving laterally? Agent Foskett examines source systems, destinations, logon types and changes in privilege before making a determination.

Learning objectives

  • Explain lateral movement and distinguish it from routine remote administration.
  • Identify Windows security telemetry required for host-to-host logon hunting.
  • Interpret Event ID 4624 and logon types in context.
  • Use KQL to investigate account fan-out and remote logon sequences.
  • Correlate host authentication with privileged activity where available.
  • Record coverage gaps and evidence-based escalation criteria.

What is lateral movement?

Lateral movement is an adversary technique for accessing additional systems after gaining an initial foothold. It may involve stolen credentials, remote services, administrative shares or remote management tools. The same protocols are also used legitimately, so a connection or logon is only a starting point for investigation.

Prerequisites and safe boundaries

Use an authorized Sentinel-connected Log Analytics workspace with Windows Security Events ingested into SecurityEvent using the relevant connector and data collection rule. If your environment uses WindowsEvent or Defender XDR advanced hunting instead, adapt the queries to that table and schema; the examples below specifically target SecurityEvent. These are read-only hunting exercises.

Telemetry coverage comes first

Before interpreting a quiet query, confirm which Windows hosts forward events, whether security auditing includes successful logons, the retention period and the last event received. Missing logs from a target host can hide movement. Do not equate an absence of 4624 events with proof that a system was not accessed.

Key Windows events for a hunt

Event IDMeaningInvestigation value
4624Successful logonAccount, target computer, logon type and source address where populated
4625Failed logonCredential guessing or operational errors
4672Special privileges assigned at logonPrivileged-session context, not proof of abuse
4688Process creation, when auditedPotential follow-up for remote execution

These events are recorded on different systems depending on the activity. Availability depends on audit policy and connector configuration.

Understand logon types

  • Type 2: interactive local logon.
  • Type 3: network logon, often SMB or other remote network access.
  • Type 10: RemoteInteractive, commonly associated with RDP.
  • Type 5: service logon, which may reflect routine service activity.

Logon type alone cannot establish the protocol used or the intent of the operator.

KQL hunt 1 — Check Windows logon event coverage

Sentinel Logs — SecurityEvent coverage
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
SecurityEvent
| where TimeGenerated >= ago(7d)
| where EventID in (4624, 4625, 4672, 4688)
| summarize Events = count(),
            Hosts = dcount(Computer),
            LastSeen = max(TimeGenerated)
    by EventID, bin(TimeGenerated, 1d)
| order by TimeGenerated asc, EventID asc

Confirm expected hosts and event IDs are represented. No 4688 events may simply mean process-creation auditing is not enabled or not collected.

Hypothesis 1 — A user accessed many hosts

Hypothesis: an account connecting to several destination computers within a short interval could be moving laterally. Alternatives: patching, vulnerability scanning, remote administration, software deployment or an automation identity. Use a defined window and compare against a baseline.

Choose fields carefully

In SecurityEvent, Computer is the reporting host; for a successful logon, it commonly represents the destination system. Account, LogonType and IpAddress can help identify account-to-host patterns. Source IP values may be empty, loopback or non-routable; never assume every logon contains a useful remote origin.

KQL hunt 2 — Identify rapid account fan-out

Sentinel Logs — account-to-host fan-out
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
SecurityEvent
| where TimeGenerated >= ago(24h)
| where EventID == 4624
| where LogonType in (3, 10)
| where isnotempty(Account) and isnotempty(Computer)
| where Account !endswith "$"
| summarize Logons = count(),
            DestinationHosts = dcount(Computer),
            HostSample = make_set(Computer, 12),
            SourceIPSample = make_set(IpAddress, 12),
            FirstSeen = min(TimeGenerated),
            LastSeen = max(TimeGenerated)
    by Account, bin(TimeGenerated, 30m)
| where DestinationHosts >= 4
| order by DestinationHosts desc, Logons desc

The four-host threshold is illustrative, not a detection verdict. Confirm whether the account is an authorized administrator or service identity and whether all destination hosts report consistently.

Interpreting source-to-destination relationships

Group the evidence as account → observed source IP → reporting host. Be cautious with NAT, jump hosts, proxies and empty source fields. One IP may represent multiple legitimate administrators, while an attacker may use more than one source.

Hypothesis 2 — The same source touches multiple servers

A source IP that appears across many target servers in a brief window may warrant further review, especially if it is unexpected for the environment. Check change windows, management servers, vulnerability scanners and approved jump hosts before assigning suspicious intent.

KQL hunt 3 — Build a focused remote-logon timeline

Sentinel Logs — target account timeline
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
let TargetAccount = "CONTOSO\\analyst";
SecurityEvent
| where TimeGenerated >= ago(48h)
| where EventID == 4624
| where LogonType in (3, 10)
| where Account =~ TargetAccount
| project TimeGenerated, Computer, Account,
          IpAddress, LogonType, Activity, EventID
| order by TimeGenerated asc
| take 300

Replace the example domain and account with an approved test identity. Check the actual Account format in your workspace before filtering. The 300-row cap can truncate busy identities.

What does a sequence tell you?

Several host logons in time order can suggest a path through the environment, but logon records alone do not prove that one computer was used to access the next. Corroborate with host network events, remote execution evidence, process creation, change records and administrator interviews.

Correlate privilege evidence carefully

Event 4672 may indicate that special privileges were assigned to a logon session. It can occur during routine administrator activity. To correlate 4672 with 4624, inspect available session identifiers such as Logon ID and the host context; do not join only on username and assume the events describe the same session.

Process execution and remote tools

When available, investigate process-creation events and Defender for Endpoint telemetry for activity involving remote administration utilities, command shells or scripting. A tool name alone is not proof of abuse; consider the parent process, signed binary, command line, initiating identity and approved management workflow.

Windows security logs versus Defender XDR

SecurityEvent is a Log Analytics table queried in Sentinel Logs. Defender XDR tables such as DeviceLogonEvents, DeviceProcessEvents and DeviceNetworkEvents are queried in Defender advanced hunting unless that data is explicitly available through a supported Sentinel integration. Do not paste a Defender query into Sentinel Logs and assume the tables exist.

Map behaviour to MITRE ATT&CK

Possible techniques include Remote Services (T1021) and use of valid accounts (T1078), depending on the corroborated behaviour. ATT&CK mappings describe hypotheses about techniques; they do not confirm an attacker merely because a logon was recorded.

Account baseline and business context

Compare candidate accounts against their usual destinations, maintenance schedules and role. A domain administrator visiting multiple servers may be expected; a standard user unexpectedly reaching several critical systems may justify a higher-priority review. Verify asset criticality and identity ownership.

Time windows and false positives

Use a bounded query window and note that ingestion delays, time zones and host clock issues can affect apparent ordering. Batch jobs and monitoring platforms may generate dense, legitimate logon patterns. Validate thresholds against historical activity before using them operationally.

Agent Foskett investigation map

HYPOTHESIS: POSSIBLE LATERAL MOVEMENT ↓ CHECK SECURITYEVENT COVERAGE ↓ IDENTIFY ACCOUNT / DESTINATION FAN-OUT ↓ BUILD UTC LOGON TIMELINE ↓ VALIDATE SOURCE, ADMIN WORK AND PRIVILEGE ↓ CORROBORATE EXECUTION / NETWORK EVIDENCE ↓ DOCUMENT FINDINGS AND UNCERTAINTY

Evidence preservation and privacy

Preserve event timestamps, host names, source addresses, query text and case notes using approved systems. Limit access to identity information and avoid exporting unrestricted log datasets. Escalation should follow the organization’s incident handling process.

Agent Foskett finding — The six-server mystery

The account’s logons match an approved patching window from a managed jump host. Event 4672 appears because the operator used an authorized privileged account. Agent Foskett closes the initial lateral-movement hypothesis as unsupported, while recommending improved tagging of approved management sources to make future hunts faster.

Finding: multiple remote logons were real; malicious movement was not established.

Hands-on lab — Hunt a remote-logon path

  1. Confirm SecurityEvent coverage for the expected Windows hosts.
  2. Review logon types 3 and 10 and note what they do not prove.
  3. Run the account fan-out query and record the chosen threshold.
  4. Choose an authorized test account and inspect its 48-hour timeline.
  5. Compare destination hosts with approved administration activity.
  6. Identify at least two alternative explanations.
  7. Document evidence, missing telemetry and a follow-up pivot.

Knowledge check

  1. Why can a type 3 logon be legitimate?
  2. What does Computer usually represent in a successful SecurityEvent logon record?
  3. Why is a host fan-out query a hunting lead rather than proof?
  4. What extra evidence helps establish remote execution?
  5. Why should you avoid joining privilege events on username alone?

Operational quality checklist

  • Queries use the Sentinel SecurityEvent schema and bounded windows.
  • Event ingestion and host coverage are checked before conclusions.
  • Account formats and source IP limitations are acknowledged.
  • Query thresholds are illustrative and validated against context.
  • Three full-width KQL editors have numbered gutters.
  • Previous Lesson 63 is linked and unpublished Lesson 65 is not clickable.

Agent Foskett takeaway

Movement between systems is an observation. Lateral movement by an attacker is a conclusion that needs evidence. Trace the account, validate the host, check the source and corroborate the activity before you decide.

The Logs Already Knew.

Lesson 64 complete — follow the movement, verify the evidence!
You can now hunt remote logon patterns, host fan-out and potential lateral movement using evidence-driven KQL.
Sentinel Academy Home

Related Agent Foskett learning

Continue from suspicious authentication hunting into lateral movement investigation.