Chapter 56

Windows Event Log

EVTX format, channel architecture, critical Security Event IDs, and Windows Event Forwarding — the telemetry backbone every detection engineer must own.

Scenario

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.

ChannelFileDefault Max SizeKey Content
SecuritySecurity.evtx20 MBLogons, object access, process creation, policy changes
SystemSystem.evtx20 MBService installs, driver loads, system errors
ApplicationApplication.evtx20 MBApp crashes, .NET errors, custom app events
Microsoft-Windows-PowerShell/Operational…PowerShell%4Operational.evtx15 MBScriptBlock logging (4104), module logging (4103)
Microsoft-Windows-Sysmon/Operational…Sysmon%4Operational.evtx64 MB (recommended)All Sysmon events 1–29
Microsoft-Windows-WMI-Activity/Operational…WMI-Activity%4Operational.evtx10 MBWMI queries, subscription events 5857–5861
Microsoft-Windows-TaskScheduler/Operational…TaskScheduler%4Operational.evtx4 MBTask creation (106), modification (140), execution (200)
Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational…1 MBRDP connection attempts (1149)
Microsoft-Windows-DNS-Client/Operational…DNS-Client%4Operational.evtx1 MBDNS 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 FieldMeaningExample
<Provider Name>Event source (publisher)Microsoft-Windows-Security-Auditing
<EventID>Unique event identifier within provider4624
<Level>0=LogAlways, 2=Error, 3=Warning, 4=Info, 5=Verbose0 (audit events)
<Task>Category/subcategory ID12544 (Logon)
<Keywords>Audit success (0x8020000000000000) / failure (0x8010000000000000)0x8020000000000000
<TimeCreated SystemTime>UTC timestamp2026-09-18T14:22:01.123Z
<EventRecordID>Sequential record number (resets on log clear)48291
<Computer>Hostname that generated the eventDC01.corp.local
<Security UserID>SID of logging processS-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.

Why this matters

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:

SubcategoryCategoryEvents GeneratedEnable?
Process CreationDetailed Tracking4688 (+ command line with extra GPO)✅ Always
LogonLogon/Logoff4624, 4625, 4634, 4647✅ Always
Logon (Special)Logon/Logoff4672 (admin logon)✅ Always
Account Logon (Kerberos)Account Logon4768, 4769, 4771, 4776✅ On DCs
User Account ManagementAccount Management4720, 4722, 4724, 4728, 4732✅ Always
Security Group ManagementAccount Management4728, 4732, 4756✅ Always
Scheduled Task CreatedObject Access4698, 4702✅ Always
File SystemObject Access4663 (file access — very noisy)⚠️ Selective
Audit Policy ChangePolicy Change4719 (audit policy changed)✅ Always
Other Object AccessObject Access4657 (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 IDDescriptionKey FieldsDetection Use
4624Successful logonLogonType, SubjectUserName, TargetUserName, IpAddress, AuthenticationPackageNameLateral movement (type 3), RDP (type 10), interactive (type 2)
4625Failed logonLogonType, FailureReason, SubjectUserName, IpAddressBrute force, password spray detection
4627Group membership during logonSubjectUserName, MemberName, TokenElevationTypePrivileged group membership at logon
4634LogoffSubjectUserName, LogonType, LogonIDSession duration analysis
4647User-initiated logoffSubjectUserNameInteractive logoff
4648Logon with explicit credentials (runas)SubjectUserName, TargetUserName, TargetServerNameLateral movement via runas/pass-the-hash
4657Registry value modifiedObjectName, OldValue, NewValue, ProcessNamePersistence via registry (requires SACL)
4663Object access attemptObjectName, AccessList, ProcessNameData theft (requires SACL on files)
4672Special privileges assigned to new logonSubjectUserName, PrivilegeListAdmin logon detection
4688Process createdNewProcessName, CommandLine (if enabled), SubjectUserName, ParentProcessNameMalicious process detection, command line hunting
4689Process exitedProcessName, ExitStatusShort-lived process detection
4697Service installed in the systemServiceName, ServiceFileName, ServiceType, ServiceStartTypeMalicious service installation
4698Scheduled task createdTaskName, TaskContent (XML)Scheduled task persistence
4702Scheduled task updatedTaskName, TaskContentTask modification for persistence
4719System audit policy changedSubjectUserName, CategoryId, SubcategoryId, AuditPolicyChangesAttacker disabling auditing
4720User account createdSAMAccountName, SubjectUserNameBackdoor account creation
4722User account enabledTargetUserNameDormant account activation
4724Password reset attemptTargetUserName, SubjectUserNameAccount takeover
4728Member added to global groupMemberName, GroupName, SubjectUserNamePrivilege escalation via group addition
4732Member added to local groupMemberName, GroupNameLocal admin group modification
4756Member added to universal groupMemberName, GroupNameUniversal group changes (AD)
4768Kerberos TGT requested (AS-REQ)TargetUserName, IpAddress, StatusPre-auth failure = 0x18, AS-REP Roasting = 0x17
4769Kerberos service ticket requested (TGS-REQ)ServiceName, TicketEncryptionType, ClientAddressKerberoasting = RC4 (0x17), over-requesting TGS
4771Kerberos pre-authentication failedClientAddress, FailureCodePassword spray against Kerberos
4776NTLM credential validation (NTLM auth)TargetUserName, Workstation, StatusNTLM brute force, Pass-the-Hash (status 0xC000006A)
1102Audit log cleared (Security channel)SubjectUserName, SubjectLogonIdAnti-forensics, attacker cleanup
4104PowerShell ScriptBlock executedScriptBlockText, ScriptBlockIdMalicious PS detection (PowerShell channel)
7045New service installed (System channel)ServiceName, ImagePath, ServiceTypeMalicious service install

Logon Types

Event ID 4624's LogonType field is critical for distinguishing interactive users from lateral movement:

TypeNameMeaningDetection Interest
2InteractiveConsole logon, keyboard at machineNormal; unusual outside hours
3NetworkSMB, net use, file share access⚠️ Lateral movement vector
4BatchScheduled task logonMalicious tasks
5ServiceService account logonMalicious service accounts
7UnlockScreen unlockNormal
8NetworkCleartextIIS basic auth, network logon with cleartext⚠️ Credential exposure
9NewCredentialsRunAs /netonly — impersonation for network only⚠️ PtH lateral movement
10RemoteInteractiveRDP or remote assistance⚠️ RDP lateral movement
11CachedInteractiveLogon 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):

SettingValue
Configure target Subscription ManagerServer=https://WEC01.corp.local:5986/wsman/SubscriptionManager/WEC
Allow Basic authentication (WinRM)Disabled (use Kerberos/NTLM)
WEC subscriptionDefine in WEC server via wecutil.exe or UI
Try this

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 IDChannelTriggerKey Fields
1102SecuritySecurity log cleared (wevtutil cl Security)SubjectUserName, SubjectLogonId — who cleared it
104SystemAny other log clearedChannel name being cleared
Common mistake

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

Mental model

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 MissingWhyAlternative Coverage
Process command lines (4688)Disabled by default; enable via GPO "Include command line in process creation events"Sysmon Event 1
DNS queriesDNS Client Operational log not enabled by defaultSysmon Event 22, DNS server logs
Network connectionsNo built-in per-process network logging without WFP auditingSysmon Event 3
DLL loadsNo native event for ImageLoadSysmon Event 7
File creationObject Access audit requires per-directory SACL configurationSysmon Event 11
Registry persistence writesObject Access requires SACL on specific keysSysmon Event 13, 14
In-memory only activityFundamental gap — nothing executes from disk to trigger file eventsETW process memory, EDR
Direct syscalls (bypassing APIs)Hooks are in ntdll.dll; direct SYSCALL bypasses userland hooksETW-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.

LogDefault MaxRecommended EnterpriseConfigure via
Security20 MB1–4 GBGPO: Computer Config → Windows Settings → Security Settings → Event Log
System20 MB256 MBSame GPO path
Sysmon—512 MB–4 GBsysmon.exe install -c (config maxsize attribute)
PowerShell15 MB100–256 MBRegistry: 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

Pythonparse_evtx.py
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.