Skip to content
WETNav

Investigation · Access

Where did this account log on, and was it used for lateral movement?

Map one account's logons across collected hosts and the DC, read the logon types, and separate normal use from lateral movement to admin shares and services.

When you would ask thisAn account is suspected compromised and you need every host it touched, how it authenticated, and whether it was used to move laterally.

Steps

  1. 1

    Build the logon map from 4624

    Across every collected Security log, filter 4624 on TargetUserName for the account and record LogonType, IpAddress, WorkstationName, TargetLogonId and the host that wrote the event. The type tells you the method: 2 interactive, 3 network (share or service access), 10 RDP, 8 cleartext, and 9 NewCredentials, which is runas /netonly and a classic pass-the-hash or overpass-the-hash fingerprint. A domain account suddenly doing Type 10 or Type 9 on servers it never touched is the thread to pull.

    Every logon for one account, with type and source (collected .evtx)
    Get-WinEvent -Path .\Security.evtx `
      -FilterXPath "*[System[EventID=4624]] and *[EventData[Data[@Name='TargetUserName']='jdoe']]" |
      ForEach-Object { $x = [xml]$_.ToXml(); [pscustomobject]@{
        Time = $_.TimeCreated
        Type = ($x.Event.EventData.Data | Where-Object Name -eq 'LogonType').'#text'
        IP   = ($x.Event.EventData.Data | Where-Object Name -eq 'IpAddress').'#text'
        WS   = ($x.Event.EventData.Data | Where-Object Name -eq 'WorkstationName').'#text' } }
  2. 2

    Find the launch points with explicit credentials

    Event 4648, a logon using explicit credentials, is written on the source host when a session uses credentials other than its own: runas, a scheduled task with stored creds, or a lateral tool authenticating as another user. Read SubjectUserName (the acting account), TargetUserName (the account used), TargetServerName and ProcessName. A 4648 where ProcessName is a remote-exec tool, or where the target server differs from the local host, marks the pivot where the account was used to reach elsewhere.

  3. 3

    See the account domain-wide on the DC

    Workstation Security logs only show hosts you collected. The domain controller sees authentication across the domain: 4768 is the Kerberos TGT request (IpAddress is the requesting workstation), 4769 is a service ticket request (ServiceName names the target host or service, IpAddress the client), and 4776 is NTLM credential validation (the Workstation field names the client). Pulling these for the account from the DC reveals hosts the account authenticated to that you never imaged.

  4. 4

    Flag privileged sessions

    Event 4672, special privileges assigned to a new logon, is written for sessions holding sensitive rights such as SeDebugPrivilege or SeBackupPrivilege. Join its SubjectLogonId to the TargetLogonId of the 4624 to tell which of the account's sessions ran with administrative power. A string of 4672 events for a normally unprivileged user, or on hosts where the account has no business being an admin, narrows the lateral-movement hosts to the ones that actually mattered.

  5. 5

    Confirm lateral movement by technique

    Correlate the account's Type 3 logons with the artifacts of the common techniques. Admin-share access (5140 to \\*\C$ or \\*\ADMIN$) plus a new service (7045) is PsExec-style; a remote scheduled task is task-scheduler 106 arriving over the network; WinRM shows as winrm 91 on the destination; RDP as LocalSessionManager 21. Matching the account's logon times on each host to one of these patterns turns 'the account logged on here' into 'the account was used to move here, this way'.

Where it goes wrong

  • LogonType 9 (NewCredentials) is runas /netonly and the usual footprint of pass-the-hash and overpass-the-hash; the session keeps the original identity locally but authenticates outbound as another.
  • 4769 and 4768 are written on the domain controller, not the target host, so the IpAddress is the client that requested the ticket, not where the ticket was later used.
  • 4776 only appears on the machine that validated the NTLM credentials (the DC for a domain account, the local SAM for a local account), and its Workstation field is supplied by the client and can be spoofed.
  • LogonIds are unique only until a reboot, so scope TargetLogonId joins to within a single uptime window.
  • The account may appear under both its SAM name and its UPN; search both forms or you will miss logons.
  • Machine accounts end in '$' and generate their own Kerberos traffic; do not confuse host$ authentication with the user account.

Beyond event logs

Target-host execution evidence

On each destination: C:\Windows\Prefetch\ and C:\Windows\AppCompat\Programs\Amcache.hve

Prefetch and Amcache show what ran after the account logged on, with first and last run times, which confirms the logon led to execution rather than a passing network touch.

RDP and connection MRU on the source

HKCU\Software\Microsoft\Terminal Server Client\Servers on the account's workstation

If the account owns a workstation, its RDP MRU lists the hosts it reached out to, corroborating the outbound direction of any lateral RDP.

References