Windows Event Log
EVTX format, channel architecture, critical Security Event IDs, and Windows Event Forwarding — the telemetry backbone every detection engineer must own.
It's 2 AM. The SOC alert fires: lateral movement suspected. You open the SIEM, filter by the target host, and immediately know where to look — Security Event ID 4624 logon type 3 from an unusual source, followed by 4672 (special privileges), then 4688 (process creation) for net.exe commands. Within four minutes you've reconstructed the attacker's path. Your colleague at another company spent the same four minutes wondering why their logs only have Application and System events — they never configured audit policy. Windows Event Log is the difference between those two outcomes.
Event Log Architecture
The Windows Event Log service (EventLog, hosted in svchost.exe) manages the collection, storage, and retrieval of events. It replaced the older EVT format (Windows XP era) with EVTX in Windows Vista.
Windows Event Log Architecture
═══════════════════════════════════════════════════════════════════
Event Sources (Publishers) Consumers
────────────────────────── ─────────
┌─────────────┐ ┌─────────────┐ ┌──────────────────┐
│ Kernel │ │ User-mode │ │ Event Viewer │
│ drivers │ │ services │ │ wevtutil.exe │
│ (ETW) │ │ apps │ │ Get-WinEvent │
└──────┬──────┘ └──────┬──────┘ │ WEC/WEF │
│ │ │ SIEM agents │
▼ ▼ └────────┬─────────┘
┌─────────────────────────────────────────────────────┴──────┐
│ Windows Event Log Service │
│ (svchost.exe -k LocalServiceNetworkRestricted) │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ Channel │ │ Manifest │ │ Subscription │ │
│ │ Manager │ │ Registry │ │ Manager │ │
│ └──────┬───────┘ └──────────────┘ └──────────────────┘ │
└─────────┼───────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ EVTX Log Files (C:\Windows\System32\winevt\Logs\) │
│ Security.evtx System.evtx Application.evtx │
│ Microsoft-Windows-Sysmon%4Operational.evtx ... │
└─────────────────────────────────────────────────────────────┘
Event Channels
A channel is a named destination for events. Channels have types — Admin, Operational, Analytic, Debug — and each maps to an EVTX file on disk.
| Channel | File | Default Max Size | Key Content |
|---|---|---|---|
| Security | Security.evtx | 20 MB | Logons, object access, process creation, policy changes |
| System | System.evtx | 20 MB | Service installs, driver loads, system errors |
| Application | Application.evtx | 20 MB | App crashes, .NET errors, custom app events |
| Microsoft-Windows-PowerShell/Operational | …PowerShell%4Operational.evtx | 15 MB | ScriptBlock logging (4104), module logging (4103) |
| Microsoft-Windows-Sysmon/Operational | …Sysmon%4Operational.evtx | 64 MB (recommended) | All Sysmon events 1–29 |
| Microsoft-Windows-WMI-Activity/Operational | …WMI-Activity%4Operational.evtx | 10 MB | WMI queries, subscription events 5857–5861 |
| Microsoft-Windows-TaskScheduler/Operational | …TaskScheduler%4Operational.evtx | 4 MB | Task creation (106), modification (140), execution (200) |
| Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational | … | 1 MB | RDP connection attempts (1149) |
| Microsoft-Windows-DNS-Client/Operational | …DNS-Client%4Operational.evtx | 1 MB | DNS queries (not enabled by default) |
EVTX Binary Format
EVTX files use a chunked binary format. Understanding the structure helps when parsing logs programmatically or recovering deleted events.
EVTX File Layout
══════════════════════════════════════════════
┌──────────────────────────────────────────┐
│ File Header (4096 bytes) │
│ Magic: "ElfFile\0" │
│ Chunk offset, last chunk, next record │
│ Header size, minor/major version │
└──────────────────────────────────────────┘
┌──────────────────────────────────────────┐
│ Chunk 0 (65536 bytes) │
│ ┌────────────────────────────────────┐ │
│ │ Chunk Header (512 bytes) │ │
│ │ Magic: "ElfChnk\0" │ │
│ │ First/Last record number │ │
│ │ String table, Template table │ │
│ └────────────────────────────────────┘ │
│ ┌────────────────────────────────────┐ │
│ │ Event Record 1 │ │
│ │ Magic: 0x2a2a (0x002a002a) │ │
│ │ Record size (DWORD) │ │
│ │ Record ID (QWORD) │ │
│ │ Timestamp (FILETIME) │ │
│ │ BinXML data (compressed XML) │ │
│ └────────────────────────────────────┘ │
│ [Event Record 2 ... N] │
└──────────────────────────────────────────┘
[Chunk 1 ... N]
Events are stored as BinXML — a binary-encoded form of the XML event structure. The python-evtx library decodes these. Key fields in every event:
| XML Field | Meaning | Example |
|---|---|---|
| <Provider Name> | Event source (publisher) | Microsoft-Windows-Security-Auditing |
| <EventID> | Unique event identifier within provider | 4624 |
| <Level> | 0=LogAlways, 2=Error, 3=Warning, 4=Info, 5=Verbose | 0 (audit events) |
| <Task> | Category/subcategory ID | 12544 (Logon) |
| <Keywords> | Audit success (0x8020000000000000) / failure (0x8010000000000000) | 0x8020000000000000 |
| <TimeCreated SystemTime> | UTC timestamp | 2026-09-18T14:22:01.123Z |
| <EventRecordID> | Sequential record number (resets on log clear) | 48291 |
| <Computer> | Hostname that generated the event | DC01.corp.local |
| <Security UserID> | SID of logging process | S-1-5-18 (SYSTEM) |
| <EventData> | Event-specific fields (vary by EventID) | SubjectUserName, LogonType… |
Audit Policy — What Gets Logged
Events only appear in the Security log if the corresponding audit subcategory is enabled. Windows ships with minimal auditing by default — a major gap attackers rely on.
A fresh Windows Server installation without Group Policy hardening will NOT log process creation (4688), network logons from many sources, or PowerShell commands. Attackers know this. Always confirm audit policy before trusting the absence of events.
Check effective audit policy: auditpol /get /category:*
Critical subcategories to enable:
| Subcategory | Category | Events Generated | Enable? |
|---|---|---|---|
| Process Creation | Detailed Tracking | 4688 (+ command line with extra GPO) | ✅ Always |
| Logon | Logon/Logoff | 4624, 4625, 4634, 4647 | ✅ Always |
| Logon (Special) | Logon/Logoff | 4672 (admin logon) | ✅ Always |
| Account Logon (Kerberos) | Account Logon | 4768, 4769, 4771, 4776 | ✅ On DCs |
| User Account Management | Account Management | 4720, 4722, 4724, 4728, 4732 | ✅ Always |
| Security Group Management | Account Management | 4728, 4732, 4756 | ✅ Always |
| Scheduled Task Created | Object Access | 4698, 4702 | ✅ Always |
| File System | Object Access | 4663 (file access — very noisy) | ⚠️ Selective |
| Audit Policy Change | Policy Change | 4719 (audit policy changed) | ✅ Always |
| Other Object Access | Object Access | 4657 (registry value set) | ⚠️ Selective |
Critical Security Event IDs
These are the events every detection engineer must know cold. Interview questions frequently ask "what event ID tells you X?"
| Event ID | Description | Key Fields | Detection Use |
|---|---|---|---|
| 4624 | Successful logon | LogonType, SubjectUserName, TargetUserName, IpAddress, AuthenticationPackageName | Lateral movement (type 3), RDP (type 10), interactive (type 2) |
| 4625 | Failed logon | LogonType, FailureReason, SubjectUserName, IpAddress | Brute force, password spray detection |
| 4627 | Group membership during logon | SubjectUserName, MemberName, TokenElevationType | Privileged group membership at logon |
| 4634 | Logoff | SubjectUserName, LogonType, LogonID | Session duration analysis |
| 4647 | User-initiated logoff | SubjectUserName | Interactive logoff |
| 4648 | Logon with explicit credentials (runas) | SubjectUserName, TargetUserName, TargetServerName | Lateral movement via runas/pass-the-hash |
| 4657 | Registry value modified | ObjectName, OldValue, NewValue, ProcessName | Persistence via registry (requires SACL) |
| 4663 | Object access attempt | ObjectName, AccessList, ProcessName | Data theft (requires SACL on files) |
| 4672 | Special privileges assigned to new logon | SubjectUserName, PrivilegeList | Admin logon detection |
| 4688 | Process created | NewProcessName, CommandLine (if enabled), SubjectUserName, ParentProcessName | Malicious process detection, command line hunting |
| 4689 | Process exited | ProcessName, ExitStatus | Short-lived process detection |
| 4697 | Service installed in the system | ServiceName, ServiceFileName, ServiceType, ServiceStartType | Malicious service installation |
| 4698 | Scheduled task created | TaskName, TaskContent (XML) | Scheduled task persistence |
| 4702 | Scheduled task updated | TaskName, TaskContent | Task modification for persistence |
| 4719 | System audit policy changed | SubjectUserName, CategoryId, SubcategoryId, AuditPolicyChanges | Attacker disabling auditing |
| 4720 | User account created | SAMAccountName, SubjectUserName | Backdoor account creation |
| 4722 | User account enabled | TargetUserName | Dormant account activation |
| 4724 | Password reset attempt | TargetUserName, SubjectUserName | Account takeover |
| 4728 | Member added to global group | MemberName, GroupName, SubjectUserName | Privilege escalation via group addition |
| 4732 | Member added to local group | MemberName, GroupName | Local admin group modification |
| 4756 | Member added to universal group | MemberName, GroupName | Universal group changes (AD) |
| 4768 | Kerberos TGT requested (AS-REQ) | TargetUserName, IpAddress, Status | Pre-auth failure = 0x18, AS-REP Roasting = 0x17 |
| 4769 | Kerberos service ticket requested (TGS-REQ) | ServiceName, TicketEncryptionType, ClientAddress | Kerberoasting = RC4 (0x17), over-requesting TGS |
| 4771 | Kerberos pre-authentication failed | ClientAddress, FailureCode | Password spray against Kerberos |
| 4776 | NTLM credential validation (NTLM auth) | TargetUserName, Workstation, Status | NTLM brute force, Pass-the-Hash (status 0xC000006A) |
| 1102 | Audit log cleared (Security channel) | SubjectUserName, SubjectLogonId | Anti-forensics, attacker cleanup |
| 4104 | PowerShell ScriptBlock executed | ScriptBlockText, ScriptBlockId | Malicious PS detection (PowerShell channel) |
| 7045 | New service installed (System channel) | ServiceName, ImagePath, ServiceType | Malicious service install |
Logon Types
Event ID 4624's LogonType field is critical for distinguishing interactive users from lateral movement:
| Type | Name | Meaning | Detection Interest |
|---|---|---|---|
| 2 | Interactive | Console logon, keyboard at machine | Normal; unusual outside hours |
| 3 | Network | SMB, net use, file share access | ⚠️ Lateral movement vector |
| 4 | Batch | Scheduled task logon | Malicious tasks |
| 5 | Service | Service account logon | Malicious service accounts |
| 7 | Unlock | Screen unlock | Normal |
| 8 | NetworkCleartext | IIS basic auth, network logon with cleartext | ⚠️ Credential exposure |
| 9 | NewCredentials | RunAs /netonly — impersonation for network only | ⚠️ PtH lateral movement |
| 10 | RemoteInteractive | RDP or remote assistance | ⚠️ RDP lateral movement |
| 11 | CachedInteractive | Logon with cached credentials (no DC contact) | Offline attack detection |
Windows Event Forwarding (WEF)
WEF lets you centralize events from hundreds of endpoints to a Windows Event Collector (WEC) server without a commercial SIEM agent. It uses WinRM and is free with Windows.
Windows Event Forwarding Architecture
══════════════════════════════════════════════════════════════════
Endpoints (Event Sources) Collector
───────────────────────── ─────────
┌──────────────┐
│ Workstation │──┐
│ WinRM push │ │
└──────────────┘ │ HTTPS/5986
┌──────────────┐ ├──────────────────► ┌─────────────────────┐
│ Server │──┤ │ WEC Server │
│ WinRM push │ │ │ (Windows Event │
└──────────────┘ │ │ Collector svc) │
┌──────────────┐ │ │ │
│ DC │──┘ │ Forwarded Events │
│ WinRM push │ │ channel (EVTX) │
└──────────────┘ └──────────┬──────────┘
│
SIEM Agent
│
┌─────▼─────┐
│ SIEM │
│ Splunk / │
│ Sentinel │
└───────────┘
Push mode (source-initiated): endpoints push events to WEC
Pull mode (collector-initiated): WEC polls endpoints (rarely used)
Subscription types:
• Source-initiated: endpoints self-enroll via GPO
• Collector-initiated: WEC pulls specific computers
WEF configuration via GPO (Computer Configuration → Administrative Templates → Windows Components → Event Forwarding):
| Setting | Value |
|---|---|
| Configure target Subscription Manager | Server=https://WEC01.corp.local:5986/wsman/SubscriptionManager/WEC |
| Allow Basic authentication (WinRM) | Disabled (use Kerberos/NTLM) |
| WEC subscription | Define in WEC server via wecutil.exe or UI |
Quick WEF health check on WEC: wecutil es (list subscriptions), wecutil gs <SubscriptionName> (get subscription details), wecutil gr <SubscriptionName> (get subscription runtime status — shows connected sources and last heartbeat).
Event Log Clearing — The Attacker Signal
Attackers often clear logs before or after an operation. Two events capture this:
| Event ID | Channel | Trigger | Key Fields |
|---|---|---|---|
| 1102 | Security | Security log cleared (wevtutil cl Security) | SubjectUserName, SubjectLogonId — who cleared it |
| 104 | System | Any other log cleared | Channel name being cleared |
Event 1102 is generated in the Security log before the clear completes — it is not itself removed. Event 104 appears in the System log when other channels are cleared. Monitoring for 1102 and 104 is a near-zero false-positive detection: legitimate admins rarely clear security logs, and when they do, it should be documented.
What Event Log Does NOT Capture
Windows Event Log is an opt-in system. Nothing is logged unless: (a) the audit subcategory is enabled, (b) the application registers as an event source and calls the logging API, or (c) a driver/ETW provider explicitly writes events. Absence of an event means nothing without confirming the audit policy.
| What's Missing | Why | Alternative Coverage |
|---|---|---|
| Process command lines (4688) | Disabled by default; enable via GPO "Include command line in process creation events" | Sysmon Event 1 |
| DNS queries | DNS Client Operational log not enabled by default | Sysmon Event 22, DNS server logs |
| Network connections | No built-in per-process network logging without WFP auditing | Sysmon Event 3 |
| DLL loads | No native event for ImageLoad | Sysmon Event 7 |
| File creation | Object Access audit requires per-directory SACL configuration | Sysmon Event 11 |
| Registry persistence writes | Object Access requires SACL on specific keys | Sysmon Event 13, 14 |
| In-memory only activity | Fundamental gap — nothing executes from disk to trigger file events | ETW process memory, EDR |
| Direct syscalls (bypassing APIs) | Hooks are in ntdll.dll; direct SYSCALL bypasses userland hooks | ETW-TI (kernel), EDR kernel sensor |
Log Size and Retention
Default log sizes are dangerously small in enterprise environments. A busy domain controller generates thousands of events per minute; 20 MB of Security log can roll in hours, destroying forensic evidence.
| Log | Default Max | Recommended Enterprise | Configure via |
|---|---|---|---|
| Security | 20 MB | 1–4 GB | GPO: Computer Config → Windows Settings → Security Settings → Event Log |
| System | 20 MB | 256 MB | Same GPO path |
| Sysmon | — | 512 MB–4 GB | sysmon.exe install -c (config maxsize attribute) |
| PowerShell | 15 MB | 100–256 MB | Registry: HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging |
Retention policy (on file wrap): Overwrite events as needed (default) is dangerous. Use Archive the log when full, do not overwrite events for critical logs, with a monitoring alert on archive creation.
Programmatic Parsing
from Evtx.Evtx import Evtx
from Evtx.Views import evtx_file_xml_view
import xml.etree.ElementTree as ET
# Parse Security.evtx and extract 4688 events
with Evtx(r"C:\Windows\System32\winevt\Logs\Security.evtx") as log:
for xml_str, record in evtx_file_xml_view(log.get_file_header()):
root = ET.fromstring(xml_str)
ns = {'e': 'http://schemas.microsoft.com/win/2004/08/events/event'}
event_id = root.find('.//e:EventID', ns)
if event_id is not None and event_id.text == '4688':
# Extract process name and command line
data = {d.get('Name'): d.text
for d in root.findall('.//e:Data', ns)}
print(f"Process: {data.get('NewProcessName')}")
print(f"CommandLine: {data.get('CommandLine')}")
print(f"Parent: {data.get('ParentProcessName')}")
Q & A
Q: An analyst says "there are no logon events around the time of compromise." What are the three most likely explanations?
1) The Logon audit subcategory was not enabled (check auditpol — many organizations run defaults). 2) The Security log was too small and rolled over, destroying old events. 3) The attacker used a technique that doesn't generate a 4624 — for example, using a process token with an existing logon session (pass-the-token), or using a compromised local account that was already logged on.
Q: What's the difference between Event ID 4624 and 4648?
4624 is generated on the target machine — it records that someone successfully logged in. 4648 is generated on the source machine — it records that a process used explicit credentials to authenticate to a remote resource (classic runas scenario, or lateral movement tools). When you see 4648 on a workstation followed by 4624 type 3 on a server, that's lateral movement. The combination is stronger evidence than either event alone.
Q: A Kerberos TGS request (4769) shows TicketEncryptionType 0x17. What does that mean?
0x17 is RC4-HMAC encryption. In Kerberoasting, the attacker requests service tickets encrypted with the service account's password hash — they deliberately request RC4 (weaker, faster to crack offline) rather than AES256 (0x12/0x11). A 4769 event with TicketEncryptionType 0x17 for a service account, especially in bulk or from a workstation rather than a server, is a Kerberoasting indicator. Modern environments should disable RC4 entirely and enforce AES-only — then any 0x17 request stands out sharply.
Q: You see Event 1102 in the Security log on a compromised host. What do you do?
First: the fact that you can see 1102 at all is fortunate — it is written before the clear completes. Note the SubjectUserName and SubjectLogonId to identify who cleared it. Then pivot to: (1) The System log — were other logs also cleared (Event 104)? (2) Your SIEM/WEF collector — do you have a copy of the events that existed before the clear? (3) The WEC server if WEF is deployed — was WEF active, and did it receive events before the clear? The log clear itself is strong evidence of attacker presence; timeline the 1102 against other events to determine what they were trying to hide.
Q: What Sigma rule would detect a brute force attempt against local accounts?
Target Event ID 4625 with LogonType 2 or 3, group by SubjectUserName or IpAddress, threshold ≥ 5 failures in 60 seconds. Example title: "Brute Force — Local Account." Also consider correlating with a subsequent 4624 to detect successful login after failures (spray-and-pray success). For password spray (low-and-slow across many accounts), invert: 1 failure per account but across 20+ distinct TargetUserNames from the same source in 5 minutes.