pentesting, updated
Analyze Windows event logs for attacker activity
Read Security, System and PowerShell event logs to reconstruct what an attacker did on a Windows host.
Goal
Build a timeline of logon, process and script activity from the logs a Windows host keeps by default.
How to test
Get-WinEvent -LogName Security -FilterXPath "*[System[(EventID=4624 or EventID=4625)]]"
Get-WinEvent -LogName Security -FilterXPath "*[System[EventID=4688]]" | # process creation
Select-Object TimeCreated, Message
Get-WinEvent -LogName "Microsoft-Windows-PowerShell/Operational" -FilterXPath "*[System[EventID=4104]]"
Offline (a collected .evtx file): wevtutil qe security.evtx /f:text or open it in Event Viewer / EvtxECmd for a normalized CSV you can sort and grep.
What to look for
EventID 4625 bursts (brute force), 4624 with LogonType 3/10 from an unexpected source (lateral movement/RDP), 4688 spawning powershell.exe -enc or cmd.exe /c, and 4104 script blocks containing Invoke-Expression, DownloadString, or base64 blobs.
Notes
Event log clearing itself logs EventID 1102 — always check for it first; its absence on a compromised host is itself a finding.