AWELA
Advanced Windows Event Log Analysis
Field Manual — Triage, Investigation & Detection Reference
by: Steven Stone, RedSheep Security
First Edition — 2026

Copyright & Legal

How to Use This Manual

AWELA is a field reference — not a textbook. It's designed to be opened during an active investigation, hunt, or detection build, not read cover to cover.

Structure

Parts I–III
Investigation workflow — playbooks, pivot maps, triage checklists, baselines, attack detection. Start here during an active investigation.
Part IV
Foundations — ETW architecture and log integrity. Read once to understand the telemetry layer.
Parts V–IX
Event log reference — Security, System, PowerShell, Application, and Sysmon event IDs with deep dives. Flip to these when you need field definitions, detection queries, or hunt techniques for a specific event.

Conventions

SPL Queries
All detection queries are written in Splunk SPL. Adapt for Elastic KQL, Microsoft Sentinel KQL, or other SIEMs as needed. Field names follow CIM conventions where possible.
CRITICAL
Drop everything. Active breach indicators requiring immediate response.
HIGH
Investigate within 1 hour. Confirmed or likely malicious activity.
MEDIUM
Investigate same shift. Suspicious but context-dependent.
LOW
Review next business day. Low confidence or policy-level.

Assumptions

Feedback & Corrections

Found an error? Have a detection query that should be included? Contact contact@redsheepsec.com.

Table of Contents

Part I — Investigation & Triage Framework
1. Triage Priority Matrix 2. Log Source Decision Tree 3. Pivot Field Maps 4. Investigation Timeline Reconstruction 5. Playbook: Compromised Account 6. Playbook: Malware Execution 7. Playbook: Lateral Movement 8. Playbook: Credential Dumping 9. Playbook: Ransomware Precursors 10. Playbook: Data Staging & Exfiltration 11. Playbook: Insider Threat 12. Common False Positive Guide 13. MITRE ATT&CK Event Mapping 14. Quick Triage Checklists
Part II — Process & System Baselines
15. Windows Process Baseline 16. Suspicious Parent-Child Relationships 17. LOLBins Detection Reference 18. Dangerous Privileges Reference 19. Beaconing Interval Reference
Part III — Advanced Attack Detection
20. Token Manipulation & Privilege Escalation 21. .NET Assembly / Execute-Assembly Detection 22. Service Abuse Detection 23. COM Object Hijacking 24. DPAPI Backup Key Hunting 25. WMI Persistence Forensics 26. BITS Abuse Detection 27. Active Directory Attack Patterns 28. Scheduled Task Forensics — Beyond Event 4698 29. Incident Severity Matrix 30. Registry Persistence — Top Keys 31. ShimDB Persistence 32. Code Signing Forensics 33. WEF Architecture & Blind Spot Detection 34. Sigma-to-SPL Translation Reference 35. AMSI Content & Tool Identification
Part IV — Foundations
36. ETW (Event Tracing for Windows) 37. EVTX Integrity & Log Manipulation Detection
Part V — Windows Security Event Log
38. Authentication Events (4624, 4625) 39. Logon Events Deep Dive (4624/4625) 40. Account Management Events 41. Kerberos Events 42. Kerberos Deep Dive 43. Object Access & Audit Events 44. Event 4662 — GUID Decoding 45. Policy, System & Process Events 46. Event 4688 Deep Dive — Hunting Without Sysmon 47. Scheduled Task XML Dissection (Event 4698) 48. Share & Network Events 49. Event 5145 Deep Dive — Lateral Movement at File Level 50. Directory Service Events 51. Certificate Services & GPO Events
Part VI — Windows System Event Log
52. Core System Events 53. NTLM Operational Log 54. Print Service & PrintNightmare
Part VII — PowerShell Event Log
55. PowerShell Operational Events 56. PowerShell Logging Deep Dive 57. AMSI Bypass Detection
Part VIII — Application & Operational Logs
58. Application Error & Installer Events 59. Windows Defender Events 60. Task Scheduler Operational Events 61. WMI Events 62. BITS Client Events 63. Remote Desktop Events 64. Windows Firewall Events 65. AppLocker Events 66. DNS Client Events
Part IX — Sysmon Event Log
67. Sysmon Complete Event ID Reference 68. Event 10 — LSASS Credential Theft Detection 69. Event 1 — Advanced Process Analysis 70. Event 7 — DLL Side-Loading & BYOVD 71. Event 22 — Per-Process DNS Hunting 72. Event 25 — Process Tampering 73. Event 3 — Network Connection Hunting 74. Events 17/18 — Named Pipes 75. Event 15 — Alternate Data Streams 76. Cross-Event Correlation Patterns 77. Sysmon Configuration Best Practices
PART I — INVESTIGATION & TRIAGE FRAMEWORK

1. Triage Priority Matrix

Priority is based on event combinations, not individual events. Work top to bottom.

P1 — Drop Everything (Active Breach Indicators)

Signal CombinationWhat It MeansFirst Action
Event 10 (LSASS) + GrantedAccess 0x143A/0x1038 + CallTrace UNKNOWNIn-memory credential dumping (Mimikatz/shellcode)Isolate host, preserve memory
Event 4662 (DCSync GUIDs) from non-DC sourceDomain credential extraction in progressDisable source account, isolate host
Event 5145 (drsuapi pipe) from workstationDCSync at network levelBlock source IP at firewall
Event 25 (ProcessTampering) + Event 3 (external connection)Hollowed process calling out to C2Isolate host, capture PCAP
Event 4688/Sysmon 1: vssadmin delete shadows + bcdedit recoveryenabled noRansomware detonation imminentIsolate host AND check lateral spread
Event 1102 (audit log cleared) + Event 7045 (new service) within 5 minActive attacker covering tracks while persistingIsolate host, pull backup logs from SIEM

P2 — Investigate Within 1 Hour

Signal CombinationWhat It MeansFirst Action
Event 4624 Type 3 (NTLM) to multiple hosts from single source in <15 minLateral movement spray (PtH)Identify source, check for 4648
Event 7045 (new service) with ImagePath containing cmd/powershell/temp pathPersistence via malicious serviceIdentify service binary, check parent
Event 5001 (Defender disabled) + Event 4688 (process from temp dir)Attacker disabling AV before payloadCheck what ran after Defender disabled
Event 4698 (sched task) with Hidden=true or RegistrationTriggerCovert persistence or immediate executionParse TaskContent XML for payload
Sysmon 8 (CreateRemoteThread) into svchost/explorer/lsassProcess injectionCheck source process, look for Event 3
Event 4769 with RC4 (0x17) — 5+ unique SPNs from one source in 5 minActive KerberoastingIdentify source account, check if compromised

P3 — Investigate Same Shift

Signal CombinationWhat It MeansFirst Action
Event 4720 (user created) by non-admin or outside change windowPossible backdoor accountVerify with account owner/change ticket
Event 4728/4732/4756 (group membership change) to admin groupsPrivilege escalation or admin changeVerify with IAM team
Sysmon 6 (driver load) unsigned or from user-writable pathPossible BYOVDHash check against LOLDrivers
Event 4104 with download cradle patterns (IEX + IWR/Net.WebClient)PowerShell downloading and executingCheck URL reputation, examine full script
Event 5145 mass samr/lsarpc/srvsvc from single sourceAD enumeration (BloodHound-like)Identify source account, check legitimacy
Sysmon 3 from LOLBin to external IP (certutil, mshta, rundll32)Living-off-the-land downloadCheck destination IP/domain reputation

P4 — Review Next Business Day

SignalWhat It MeansAction
Single Event 4625 from known IP rangeLikely mistyped passwordOnly investigate if pattern emerges
Event 7040 (service start type changed) for known softwareSoftware update changed service configVerify against patch schedule
Event 4104 with Get-ADUser/Get-Process (no download/exec)Admin recon or scripted inventoryVerify with user
Sysmon 22 (DNS) from browser to rare domainUser browsing, possibly risky siteCheck domain reputation

2. Log Source Decision Tree

Check log sources in this order based on investigation type.

Investigation TypeCheck FirstCheck SecondCheck ThirdSupporting
Account CompromiseSecurity (4624/4625/4648)Security (4768/4769/4771)Sysmon 1 (what ran under the account)NTLM log (8001-8004), Security (4720/4728)
Malware ExecutionSysmon 1 (process tree)Sysmon 7 (DLL loads), 11 (file drops)Sysmon 3/22 (network/DNS)Defender (1116/1117), AppLocker (8004)
Lateral MovementSecurity (4624 Type 3/10, 5145)Sysmon 17/18 (named pipes)Security 4697 / System 7045Sysmon 3, RDP logs (21-25)
Credential TheftSysmon 10 (LSASS access)Security (4662 DCSync, 4768/4769)Sysmon 1 (dumping tools)Security (4672 SeDebugPrivilege)
PersistenceSysmon 13 (registry), 12 (key create)Security 4698 sched task / System 7045 serviceSysmon 19-21 (WMI)Task Scheduler (106/140), Sysmon 6 (drivers)
Defense EvasionDefender (5001/5007), Sysmon 4/16Security (1102/4719 log clear/audit change)Sysmon 25 (process tampering)Sysmon 2 (timestomping), PS 4104 (AMSI bypass)
Data ExfiltrationSysmon 3 (outbound connections)Sysmon 11 (archive creation)Sysmon 1 (rar/7z/zip commands)BITS (3/4/59), Sysmon 15 (ADS)
Insider ThreatSecurity (5145 file share access)Print Service (307), USB (6416)Sysmon 11 (file staging)RDP (21-25), Security (4663 object access)

3. Pivot Field Maps

Chain events using shared fields. Find something suspicious → pivot to the next event.

Authentication Chain

From EventPivot FieldTo EventWhat You Learn
4768 (TGT Request)TargetUserName + IpAddress + time4624 (Logon Success)Which logon session came from this TGT
4624 (Logon)TargetLogonId4688 (Process Created)Every process the user ran in this session
4624 (Logon)TargetLogonId5140/5145 (Share Access)What shares/files the session accessed
4624 (Logon)TargetLogonId4634 (Logoff)Session duration
4624 (Logon)IpAddress4625 (Logon Failure)Failed attempts from same source
4624 (Logon)TargetUserName + IpAddress4769 (TGS Request)What services the user requested tickets for
4625 (Failure)IpAddress + time window4624 (Success)Did brute force eventually succeed?

Process Chain

From EventPivot FieldTo EventWhat You Learn
Sysmon 1 (ProcessCreate)ProcessIdSysmon 3 (NetworkConnect)What network connections this process made
Sysmon 1 (ProcessCreate)ProcessIdSysmon 7 (ImageLoad)What DLLs this process loaded
Sysmon 1 (ProcessCreate)ProcessId → SourceProcessIdSysmon 10 (ProcessAccess)What other processes this one opened
Sysmon 1 (ProcessCreate)ProcessIdSysmon 11 (FileCreate)What files this process dropped
Sysmon 1 (ProcessCreate)ProcessIdSysmon 12/13 (Registry)What registry changes this process made
Sysmon 1 (ProcessCreate)ProcessIdSysmon 22 (DNSEvent)What domains this process resolved
Sysmon 1 (ProcessCreate)ParentProcessIdSysmon 1 (parent)What launched this process (walk up the tree)
Sysmon 1 (ProcessCreate)LogonId4624 (Logon)Which logon session owns this process

Network Chain

From EventPivot FieldTo EventWhat You Learn
Sysmon 22 (DNS Query)QueryName → resolved IPSysmon 3 (NetworkConnect)Which process connected after resolving
Sysmon 3 (NetworkConnect)DestinationIpThreat Intel LookupIP reputation, known C2
Sysmon 3 (NetworkConnect)ProcessIdSysmon 1 (ProcessCreate)What process made this connection
5145 (Share Access)IpAddress4624 (Logon) on sourceWho was logged in on the source machine

Persistence Chain

From EventPivot FieldTo EventWhat You Learn
Sysmon 13 (Registry Set)Image (ProcessId)Sysmon 1 (ProcessCreate)What process wrote the registry key
7045 (Service Install)ImagePathSysmon 1 (matching Image)When the service binary actually ran
4698 (Sched Task)TaskContent → CommandSysmon 1 (matching Image/CLI)When the task payload executed
Sysmon 19-21 (WMI)Consumer detailsSysmon 1 (triggered process)What the WMI subscription launched

4. Investigation Timeline Reconstruction

Build a chronological event chain from anchor to full scope.

Step 1: Identify Your Anchor Event

Start with the anchor event. Extract these fields:

Anchor TypeKey Fields to Extract
Alert on a userTargetUserName, TargetLogonId, IpAddress
Alert on a processProcessId, Image, ParentProcessId, LogonId
Alert on a hostComputer, time window
Alert on an IPIpAddress / DestinationIp, time window

Step 2: Expand Backward (How Did We Get Here?)

# From a suspicious process — walk up the process tree
index=sysmon EventCode=1 Computer="HOST" ProcessId="SUSPECT_PID"
| table _time, Image, CommandLine, ParentImage, ParentProcessId, LogonId, User

# Then find the parent
index=sysmon EventCode=1 Computer="HOST" ProcessId="PARENT_PID"
| table _time, Image, CommandLine, ParentImage, ParentProcessId

# From a LogonId — find the original logon
index=wineventlog EventCode=4624 Computer="HOST" TargetLogonId="0xABC123"
| table _time, TargetUserName, LogonType, IpAddress, AuthenticationPackageName, WorkstationName

Step 3: Expand Forward (What Happened Next?)

# All activity in a logon session
index=wineventlog (TargetLogonId="0xABC123" OR SubjectLogonId="0xABC123") Computer="HOST"
| sort _time
| table _time, EventCode, TargetUserName, SubjectUserName

# All processes spawned by a parent
index=sysmon EventCode=1 Computer="HOST" ParentProcessId="SUSPECT_PID"
| sort _time
| table _time, Image, CommandLine, ProcessId

# All network connections from a process
index=sysmon EventCode=3 Computer="HOST" ProcessId="SUSPECT_PID"
| table _time, DestinationIp, DestinationPort, Initiated

Step 4: Build the Unified Timeline

# Full session reconstruction: logon → activity → logoff
index=wineventlog Computer="HOST"
  (EventCode IN (4624,4634,4672,4688,4698,5140,5145,1102)
   AND (TargetLogonId="0xABC123" OR SubjectLogonId="0xABC123"))
  OR EventCode=7045
# NOTE: 7045 (System log) has no LogonId — included unfiltered, correlate by time
| append
  [search index=sysmon Computer="HOST" LogonId="0xABC123"
   EventCode IN (1,3,7,10,11,13,22)]
| sort _time
| eval event_type=case(
    EventCode=4624, "LOGON",
    EventCode=4634, "LOGOFF",
    EventCode=4688 OR EventCode=1, "PROCESS",
    EventCode=3, "NETWORK",
    EventCode=5140 OR EventCode=5145, "SHARE_ACCESS",
    EventCode=10, "PROCESS_ACCESS",
    EventCode=13, "REGISTRY",
    EventCode=22, "DNS",
    EventCode=7045, "SERVICE_INSTALL",
    EventCode=4698, "SCHED_TASK",
    1=1, "OTHER"
  )
| eval Image=coalesce(Image, NewProcessName)
| table _time, event_type, EventCode, Image, CommandLine, TargetImage,
    DestinationIp, ShareName, RelativeTargetName, TargetObject, QueryName

Step 5: Expand to Other Hosts

# If lateral movement detected — find where they went
index=wineventlog EventCode=4624 LogonType IN (3,10) IpAddress="SOURCE_IP"
| stats count, values(LogonType) as logon_types, earliest(_time) as first_seen, latest(_time) as last_seen by Computer, TargetUserName
| sort first_seen

# Then repeat Steps 2-4 on each target host

5. Playbook: Compromised Account

Trigger: Suspicious logon activity, impossible travel, credential leak notification

Phase 1: Scope the Compromise (15 min)

# 1. Find all logon activity for this account (last 7 days)
index=wineventlog EventCode=4624 TargetUserName="SUSPECT_USER"
| stats count by Computer, LogonType, IpAddress, AuthenticationPackageName
| sort - count

# 2. Check for logon failures preceding success (brute force?)
index=wineventlog EventCode IN (4624,4625) TargetUserName="SUSPECT_USER"
| sort _time | table _time, EventCode, IpAddress, LogonType, Status, SubStatus

# 3. Check for explicit credential use (RunAs, credential theft)
index=wineventlog EventCode=4648 SubjectUserName="SUSPECT_USER"
| table _time, TargetUserName, TargetServerName, ProcessName

# 4. Check for Kerberos anomalies
index=wineventlog EventCode IN (4768,4769) TargetUserName="SUSPECT_USER"
| table _time, EventCode, IpAddress, TicketEncryptionType, ServiceName, Status

Phase 2: Assess Impact (30 min)

# 5. What did they access? (shares, files)
index=wineventlog EventCode IN (5140,5145) SubjectUserName="SUSPECT_USER"
| stats count values(RelativeTargetName) as files by ShareName, Computer
| sort - count

# 6. What processes did they run?
index=sysmon EventCode=1 User="*\\SUSPECT_USER"
| table _time, Computer, Image, CommandLine, ParentImage
| sort _time

# 7. Did they create persistence?
# NOTE: 7045 (System log) does not record installing user; correlate with 4697 or Sysmon 1 for attribution
index=wineventlog (EventCode IN (4698,4720) SubjectUserName="SUSPECT_USER") OR (EventCode=7045)
| table _time, EventCode, Computer, TaskName, ServiceName, TargetUserName, ImagePath

# 8. Did they move laterally?
index=wineventlog EventCode=4624 LogonType IN (3,10) TargetUserName="SUSPECT_USER"
| stats count by Computer, IpAddress, LogonType | sort - count

Phase 3: Contain & Remediate


6. Playbook: Malware Execution

Trigger: AV alert, suspicious process, EDR detection

Phase 1: Build the Process Tree (10 min)

# 1. Find the suspicious process and its full chain
index=sysmon EventCode=1 Computer="HOST" Image="*\\SUSPECT.exe"
| table _time, ProcessId, Image, CommandLine, ParentImage, ParentProcessId, User, Hashes, LogonId

# 2. Walk up: What launched it?
index=sysmon EventCode=1 Computer="HOST" ProcessId="PARENT_PID"
| table _time, Image, CommandLine, ParentImage, ParentProcessId
# Repeat until you reach explorer.exe, services.exe, or the initial vector

# 3. Walk down: What did it spawn?
index=sysmon EventCode=1 Computer="HOST" ParentProcessId="SUSPECT_PID"
| sort _time | table _time, Image, CommandLine, ProcessId

Phase 2: Assess Behavior (15 min)

# 4. Network connections (C2?)
index=sysmon EventCode=3 Computer="HOST" ProcessId="SUSPECT_PID"
| table _time, DestinationIp, DestinationPort, DestinationHostname

# 5. DNS queries (what did it resolve?)
index=sysmon EventCode=22 Computer="HOST" ProcessId="SUSPECT_PID"
| table _time, QueryName, QueryResults

# 6. Files dropped
index=sysmon EventCode=11 Computer="HOST" ProcessId="SUSPECT_PID"
| table _time, TargetFilename, Hashes

# 7. Registry changes (persistence?)
index=sysmon EventCode IN (12,13) Computer="HOST" ProcessId="SUSPECT_PID"
| table _time, EventCode, TargetObject, Details

# 8. Did it access LSASS? (credential theft)
index=sysmon EventCode=10 Computer="HOST" SourceProcessId="SUSPECT_PID" TargetImage="*\\lsass.exe"
| table _time, GrantedAccess, CallTrace

Phase 3: Scope & Contain

# 9. Check hash across environment (did it spread?)
index=sysmon EventCode=1 Hashes="*SUSPECT_HASH*"
| stats count by Computer | sort - count

# 10. Check if the same C2 IPs appear elsewhere
index=sysmon EventCode=3 DestinationIp="C2_IP"
| stats count by Computer, Image | sort - count

7. Playbook: Lateral Movement

Trigger: Type 3 logon from unexpected source, PsExec/WMI alerts, named pipe detection

Phase 1: Confirm & Identify Source (10 min)

# 1. On the TARGET host — find the inbound logon
index=wineventlog EventCode=4624 Computer="TARGET" LogonType IN (3,10)
  earliest=-1h
| where NOT match(IpAddress, "known_admin_subnet")
| table _time, TargetUserName, IpAddress, WorkstationName, LogonType,
    AuthenticationPackageName, TargetLogonId

# 2. What happened immediately after logon?
# NOTE: 7045 has no SubjectLogonId — search separately or correlate by time
index=wineventlog Computer="TARGET" SubjectLogonId="LOGON_ID"
  EventCode IN (4688,5140,5145,4698)
| sort _time
| table _time, EventCode, NewProcessName, CommandLine, ShareName, RelativeTargetName

# 3. Check for service install or sched task (PsExec signature)
index=wineventlog Computer="TARGET" EventCode IN (7045,4697)
  earliest=-1h
| eval account=coalesce(AccountName, ServiceAccount)
| table _time, EventCode, ServiceName, ImagePath, ServiceFileName, account

Phase 2: Investigate the Source Host (15 min)

# 4. What was happening on the SOURCE at the time?
index=sysmon EventCode=1 Computer="SOURCE" earliest=-30m@m latest=+30m@m
| table _time, Image, CommandLine, User, ParentImage | sort _time

# 5. How did the SOURCE get compromised? (look for inbound lateral movement)
index=wineventlog EventCode=4624 Computer="SOURCE" LogonType IN (3,10)
  earliest=-24h
| table _time, TargetUserName, IpAddress, LogonType | sort _time

# 6. Check for credential dumping on SOURCE
index=sysmon EventCode=10 Computer="SOURCE" TargetImage="*\\lsass.exe"
  earliest=-24h
| table _time, SourceImage, GrantedAccess, CallTrace

Phase 3: Map the Full Lateral Path

# 7. Find ALL hosts this account touched
index=wineventlog EventCode=4624 TargetUserName="SUSPECT_USER" LogonType IN (3,10)
| stats earliest(_time) as first_seen latest(_time) as last_seen count
  by Computer, IpAddress
| sort first_seen

8. Playbook: Credential Dumping

Trigger: Sysmon Event 10 alert on LSASS, 4662 DCSync alert, suspicious 4672

Phase 1: Confirm the Dump (5 min)

# 1. Examine the LSASS access event
index=sysmon EventCode=10 Computer="HOST" TargetImage="*\\lsass.exe"
  earliest=-1h
| table _time, SourceImage, SourceProcessId, GrantedAccess, CallTrace

# 2. Is CallTrace showing UNKNOWN (shellcode)?
#    Is GrantedAccess 0x143A/0x1038/0x1FFFFF?
#    Is SourceImage from a temp/user directory?
#    If YES to any → confirmed credential dump. Go to Phase 2.

# 3. Check the source process
index=sysmon EventCode=1 Computer="HOST" ProcessId="SOURCE_PID"
| table _time, Image, CommandLine, ParentImage, User, Hashes

Phase 2: Assess Blast Radius (15 min)

# 4. What accounts were logged in at the time? (all are potentially compromised)
index=wineventlog EventCode=4624 Computer="HOST"
  earliest=-24h latest=+0h
| dedup TargetUserName
| table TargetUserName, LogonType, IpAddress
# ALL of these accounts should be considered compromised

# 5. Check for DCSync (domain-wide escalation)
index=wineventlog EventCode=4662
| where match(Properties, "1131f6aa|1131f6ad|89e95b76")
| where NOT match(SubjectUserName, "\$$")
| table _time, SubjectUserName, Computer

# 6. Check for Pass-the-Hash activity (using stolen hashes)
index=wineventlog EventCode=4624 LogonType=3 AuthenticationPackageName="NTLM"
  TargetUserName IN ("COMPROMISED_USER1","COMPROMISED_USER2")
  earliest=-1h
| table _time, Computer, IpAddress, TargetUserName

Phase 3: Contain


9. Playbook: Ransomware Precursors

Trigger: Shadow copy deletion, mass file rename, bcdedit recovery disable

Phase 1: Confirm & Isolate IMMEDIATELY (5 min)

# 1. Confirm ransomware precursors
index=sysmon EventCode=1 Computer="HOST"
| where match(CommandLine, "(?i)vssadmin.*delete|wmic.*shadowcopy.*delete|bcdedit.*recoveryenabled.*no|wbadmin.*delete.*catalog")
| table _time, Image, CommandLine, User, ParentImage

# IF CONFIRMED: ISOLATE THE HOST FROM NETWORK IMMEDIATELY

# 2. Check for encryption activity (mass file operations)
index=sysmon EventCode=11 Computer="HOST" earliest=-30m
| stats count by TargetFilename
| rex field=TargetFilename "(?<ext>\.[^.]+)$"
| stats count by ext | sort - count
# Look for unusual extensions (.encrypted, .locked, .crypt, ransom notes)

Phase 2: Scope the Spread (10 min)

# 3. Did the ransomware spread? Check same indicators on other hosts
index=sysmon EventCode=1
| where match(CommandLine, "(?i)vssadmin.*delete|wmic.*shadowcopy.*delete")
| stats count by Computer | sort - count

# 4. Check lateral movement FROM the infected host
index=wineventlog EventCode=4624 LogonType=3 IpAddress="INFECTED_HOST_IP"
| stats count by Computer, TargetUserName | sort - count

# 5. Check for the deployment mechanism
index=sysmon EventCode=1 Computer="HOST" earliest=-2h
| where match(ParentImage, "(?i)psexec|wmic|powershell|cmd")
| table _time, ParentImage, Image, CommandLine | sort _time

Phase 3: Immediate Actions


10. Playbook: Data Staging & Exfiltration

Trigger: Large outbound transfers, archive tools on sensitive systems, BITS jobs to external

Phase 1: Identify Staging Activity (15 min)

# 1. Archive tool usage
index=sysmon EventCode=1 Computer="HOST"
| where match(Image, "(?i)rar|7z|zip|tar") OR match(CommandLine, "(?i)Compress-Archive|makecab")
| table _time, User, Image, CommandLine, ParentImage

# 2. Large files created (staging archives)
index=sysmon EventCode=11 Computer="HOST"
| where match(TargetFilename, "(?i)\\.rar$|\\.7z$|\\.zip$|\\.tar$|\\.gz$")
| table _time, Image, TargetFilename

# 3. Sensitive file access
index=wineventlog EventCode=5145 SubjectUserName="SUSPECT"
| where match(RelativeTargetName, "(?i)confidential|sensitive|finance|hr|legal|password|secret")
| table _time, Computer, ShareName, RelativeTargetName

Phase 2: Identify Exfil Channel (15 min)

# 4. Unusual outbound connections from staging host
index=sysmon EventCode=3 Computer="HOST" Initiated=true
| where NOT match(DestinationIp, "^(10\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.|192\\.168\\.|127\\.)")
| stats count as connections values(DestinationPort) as ports by Image, DestinationIp
| sort - connections

# 5. BITS transfers (common exfil mechanism)
index=wineventlog source="*BITS*" EventCode IN (3,4,59) Computer="HOST"
| table _time, EventCode, Computer

# 6. DNS exfil check (high volume of DNS queries from single process)
index=sysmon EventCode=22 Computer="HOST"
| stats count dc(QueryName) as unique_domains by Image
| where unique_domains > 100 | sort - unique_domains

11. Playbook: Insider Threat

Trigger: HR referral, abnormal access patterns, departing employee monitoring
# 1. Off-hours activity
index=wineventlog EventCode IN (4624,4688,5145) (TargetUserName="SUSPECT" OR SubjectUserName="SUSPECT")
| eval hour=tonumber(strftime(_time, "%H"))
| where hour >= 20 OR hour <= 5
| stats count by EventCode, hour, Computer | sort hour

# 2. Print volume (data exfil via paper)
index=wineventlog source="*PrintService*" EventCode=307
# NOTE: param2 = user who printed, param1 = document name
| where match(param2, "(?i)SUSPECT")
| stats count by param2, param1, Computer | sort - count

# 3. USB device connections
index=wineventlog EventCode=6416 Computer="SUSPECTS_WORKSTATION"
| table _time, SubjectUserName, DeviceDescription, ClassName

# 4. Abnormal share access patterns
index=wineventlog EventCode=5145 SubjectUserName="SUSPECT"
| stats count dc(RelativeTargetName) as unique_files by ShareName, Computer
| sort - unique_files

# 5. Email attachment volume (if Exchange/O365 logs available)
# Check for large attachment sends, forwarding rules, mailbox exports

# 6. Cloud upload activity (if proxy/CASB logs available)
# Check for uploads to personal cloud storage (Dropbox, GDrive, OneDrive personal)

12. Common False Positive Guide

Known-good patterns. Verify before closing — don't burn hours on these.

Event 10 (LSASS ProcessAccess) — Known Good

SourceImageGrantedAccessWhy It's Normal
MsMpEng.exe (Defender)VariousDefender scans all processes including LSASS
MpCmdRun.exeVariousDefender command-line scan
csrss.exe0x1000Normal subsystem interaction
wininit.exe0x1000Session 0 initialization
svchost.exe0x1000Service host querying LSASS
WerFault.exe0x1FFFFFWindows Error Reporting crash dump (full access is expected)
taskhostw.exe0x1000Scheduled task host
Any EDR agent (CrowdStrike, SentinelOne, etc.)VariousEDR monitoring LSASS is their job
Still Investigate If
Even "known good" processes are suspicious if: GrantedAccess is 0x143A from a non-security product, CallTrace contains UNKNOWN, or the process path doesn't match expected location.

Event 4624 (Logon) — Known Good

PatternWhy It FiresWhen to Still Investigate
Type 3 from DCs to each otherNormal AD replicationOnly if from unexpected IP or account
NTLM from legacy printers/scannersOld devices can't do KerberosIf the printer IP is spoofed or unexpected
Type 5 (Service) for known service accountsServices starting normallyIf the service account logs on interactively (Type 2/10)
Type 7 (Unlock) during business hoursUsers unlocking screensOnly if off-hours or from unexpected location
ANONYMOUS LOGON Type 3NULL session for share enumeration (can be normal in some environments)If volume is high or from external IPs
Machine accounts (ending in $) Type 3Normal machine-to-machine authOnly if from unexpected source

Event 7045 (New Service) — Known Good

ServiceName PatternWhy It Fires
Windows Update servicesWindows patches install services
Software deployment (SCCM, Intune, PDQ)Management tools install/update services
MsMpEng, Sense, CSFalconSecurity product updates
Print spooler relatedPrinter driver installs

Red flags even in "known" services: ImagePath pointing to \Temp\, \Users\, or containing cmd.exe /c, powershell -enc, or pipe characters.

Event 4688/Sysmon 1 (Process Creation) — Known Good

PatternWhySuspicious If
svchost.exe spawned by services.exeNormal service hostingSpawned by anything else
conhost.exe spawned by any console appConsole host for CLI toolsSpawned without a console parent
WerFault.exe after app crashWindows Error ReportingIf it makes network connections
SearchIndexer.exe, SearchProtocolHost.exeWindows Search indexingIf loading unusual DLLs
WMIPRVSE.exe spawning from svchostWMI provider hostIf spawning cmd/powershell children

Event 4698 (Scheduled Task) — Known Good

PatternWhy
Tasks created by SYSTEM with paths under C:\Windows\OS maintenance tasks
Tasks from SCCM/Intune (ccmexec, Microsoft Intune)Management platform operations
Tasks referencing UpdateOrchestrator, WindowsUpdatePatch management

Sysmon Event 3 (NetworkConnect) — Noisy but Normal

ProcessDestinationNormal?
svchost.exeMicrosoft IPs on 80/443Yes — Windows Update, telemetry
OneDrive.exe, Teams.exeMicrosoft 365 IPsYes
MsMpEng.exeMicrosoft IPsYes — definition updates, cloud protection
LSASS.exeDCs on 88/389/636Yes — Kerberos and LDAP to domain controllers

13. MITRE ATT&CK Event Mapping

Event IDs mapped to ATT&CK techniques by tactic.

Initial Access (TA0001)

TechniqueDetection EventsKey Indicator
T1078 Valid Accounts4624, 4625, 4648Logon from unusual IP/time/location
T1566 PhishingSysmon 1 (Office → child process), 4104winword.exe spawning cmd/powershell

Execution (TA0002)

TechniqueDetection EventsKey Indicator
T1059.001 PowerShell4104, 4103, 800, Sysmon 1Encoded commands, download cradles, AMSI bypass
T1059.003 Windows Command ShellSysmon 1, 4688cmd.exe from unusual parent
T1047 WMI5861, Sysmon 1 (wmiprvse → child), Sysmon 19-21WMI spawning processes, persistent subscriptions
T1053.005 Scheduled Task4698, Task Scheduler 106/200, Sysmon 1Task with hidden/immediate/SYSTEM attributes
T1569.002 Service Execution7045, 4697, Sysmon 1New service with suspicious ImagePath

Persistence (TA0003)

TechniqueDetection EventsKey Indicator
T1547.001 Registry Run KeysSysmon 13Value set under *\Run\* or *\RunOnce\*
T1543.003 Windows Service7045, 4697, Sysmon 13New service pointing to non-standard path
T1053.005 Scheduled Task4698, Task Scheduler 106BootTrigger/LogonTrigger with unusual command
T1546.003 WMI Event SubSysmon 19/20/21, 5861Permanent WMI consumer created
T1546.015 COM HijackingSysmon 12 (HKCU CLSID InprocServer32)User-level COM registration
T1547.004 Winlogon HelperSysmon 13Winlogon\Shell or Userinit modified

Privilege Escalation (TA0004)

TechniqueDetection EventsKey Indicator
T1134 Access Token Manipulation4672, 4688 (TokenElevationType), 4696SeDebugPrivilege for non-admin, %%1936 for regular user
T1068 Exploitation for Privesc4688 (MandatoryLabel jump), Sysmon 1Medium → System integrity jump without UAC

Defense Evasion (TA0005)

TechniqueDetection EventsKey Indicator
T1562.001 Disable Security ToolsDefender 5001/5007, Sysmon 4/16RT protection disabled, exclusions added, Sysmon stopped
T1070.001 Clear Windows Event Logs1102, 104Log cleared, especially Security log
T1070.006 TimestompSysmon 2, 4616File creation time modified (Sysmon 2) or system clock changed (4616)
T1036 MasqueradingSysmon 1 (OriginalFileName mismatch)OriginalFileName != actual filename
T1055 Process InjectionSysmon 8, 10, 25CreateRemoteThread, LSASS access, process tampering
T1574.002 DLL Side-LoadingSysmon 7Unsigned DLL loaded by signed exe from non-standard path

Credential Access (TA0006)

TechniqueDetection EventsKey Indicator
T1003.001 LSASS MemorySysmon 10GrantedAccess 0x143A/0x1038, CallTrace UNKNOWN
T1003.006 DCSync4662 (replication GUIDs), 5145 (drsuapi)Non-DC requesting replication rights
T1558.003 Kerberoasting4769 (RC4, mass SPNs)Multiple TGS requests with 0x17 encryption
T1558.004 AS-REP Roasting4768 (PreAuthType=0)TGT without pre-authentication
T1110 Brute Force4625 (mass failures), 4771Multiple failures then success, spray patterns

Discovery (TA0007)

TechniqueDetection EventsKey Indicator
T1087 Account Discovery4662, 5145 (samr pipe), 4104 (Get-ADUser)Mass samr queries, AD enumeration scripts
T1018 Remote System DiscoverySysmon 1 (net.exe, nltest, dsquery)Network/domain enumeration commands
T1135 Network Share Discovery5145 (srvsvc pipe), Sysmon 1 (net share)Mass share enumeration

Lateral Movement (TA0008)

TechniqueDetection EventsKey Indicator
T1021.002 SMB/Windows Admin Shares5140, 5145, 4624 Type 3ADMIN$/C$ access + exe drop + svcctl pipe
T1021.001 Remote Desktop4624 Type 10, RDP 21/22/25RDP from unexpected source
T1021.006 Windows Remote Mgmt4624 Type 3, Sysmon 1 (wsmprovhost)WinRM session from workstation to workstation
T1550.002 Pass the Hash4624 (Type 3 + NTLM + unusual source)NTLM logon from workstation to multiple targets
T1550.003 Pass the Ticket4769 without preceding 4768Service ticket without TGT request

Exfiltration (TA0010)

TechniqueDetection EventsKey Indicator
T1041 Exfil Over C2Sysmon 3 (large outbound)Unusual process with sustained external connection
T1048 Exfil Over Alternative ProtocolSysmon 3/22 (DNS, ICMP)High DNS query volume, unusual protocols
T1567 Exfil to Cloud StorageSysmon 3/22 (cloud storage domains)Non-browser uploading to Dropbox/GDrive/OneDrive
T1560 Archive Collected DataSysmon 1 (rar/7z), Sysmon 11Archive tool usage followed by network transfer

14. Quick Triage Checklists

Work top to bottom. Check the box, move on.

Checklist: Suspicious Logon

[ ] Identify the logon: EventCode=4624, note TargetUserName, LogonType, IpAddress, TargetLogonId
[ ] Check LogonType: Type 3 (network) or 10 (RDP) from unexpected source?
[ ] Check AuthenticationPackageName: NTLM where Kerberos expected?
[ ] Check IpAddress: Known asset? Expected subnet? VPN or external?
[ ] Check time: Business hours? Expected for this user?
[ ] Check for preceding 4625 failures from same IP (brute force?)
[ ] Pivot on TargetLogonId: What did this session do? (4688, 5140, 5145)
[ ] Pivot on IpAddress: Any other accounts from this source?
[ ] Check source host: Was it recently compromised?
[ ] VERDICT: Legitimate / Suspicious / Confirmed Malicious
[ ] ACTIONS: Document / Escalate / Contain

Checklist: Suspicious Process

[ ] Identify process: Sysmon 1, note Image, CommandLine, ParentImage, ProcessId, User
[ ] Check parent: Is this parent-child relationship normal? (e.g., winword → cmd = BAD)
[ ] Check path: Is the executable running from expected location?
[ ] Check command line: Encoded? Unusually long? Contains URLs or UNC paths?
[ ] Check OriginalFileName: Does it match the actual filename? (masquerading?)
[ ] Check Hashes: Run through VT/threat intel
[ ] Check children: Did this process spawn anything? (Sysmon 1, ParentProcessId=this PID)
[ ] Check network: Did this process connect out? (Sysmon 3, ProcessId=this PID)
[ ] Check file drops: Did this process create files? (Sysmon 11, ProcessId=this PID)
[ ] Check registry: Did this process modify persistence keys? (Sysmon 13)
[ ] Check LSASS: Did this process access LSASS? (Sysmon 10)
[ ] VERDICT: Legitimate / Suspicious / Malicious
[ ] ACTIONS: Document / Kill process / Isolate host / Scope to other hosts via hash

Checklist: New Service / Scheduled Task

[ ] Identify: Event 7045/4697 (service) or 4698 (task). Note name, path/command, account
[ ] Check ImagePath/Command: Points to Windows/Program Files (normal) or Temp/Users (suspicious)?
[ ] Check for obfuscation: Does the path contain cmd /c, powershell -enc, pipe characters?
[ ] Check the account: LocalSystem for a non-Microsoft service? Non-admin creating the task?
[ ] Check the creator: Who/what created it? (SubjectUserName for 4697/4698; 7045 does NOT record creator — correlate with Sysmon 1 or Security 4697)
[ ] For tasks: Is it Hidden? RegistrationTrigger (immediate)? BootTrigger/LogonTrigger?
[ ] Check timing: Was this during a change window? Does a change ticket exist?
[ ] Check the binary: Hash lookup, signature check, file path analysis
[ ] Check if the service/task already executed (Task Scheduler 200, Sysmon 1 matching command)
[ ] VERDICT: Legitimate / Suspicious / Malicious
[ ] ACTIONS: Document / Disable service/task / Investigate binary / Scope

Checklist: LSASS Access Alert

[ ] Identify: Sysmon 10, note SourceImage, GrantedAccess, CallTrace
[ ] Check SourceImage: Is it a known security product? (see False Positive Guide)
[ ] Check GrantedAccess: 0x1000/0x0400 = likely benign. 0x143A/0x1038/0x1FFFFF = investigate
[ ] Check CallTrace: Contains "UNKNOWN"? → HIGH CONFIDENCE MALICIOUS (injected code)
[ ] Check CallTrace: Contains comsvcs.dll? → MiniDump technique
[ ] Check CallTrace: Contains dbghelp.dll? → Debug/dump technique
[ ] If suspicious: Examine the source process (Sysmon 1, same ProcessId)
[ ] Check source process parent chain (walk up the tree)
[ ] Check source process network activity (Sysmon 3)
[ ] Determine accounts at risk: All sessions active on this host at time of dump
[ ] VERDICT: False Positive / Confirmed Credential Dump
[ ] ACTIONS: If confirmed → isolate host, reset ALL active session passwords, check for lateral movement
PART II — PROCESS & SYSTEM BASELINES

15. Windows Process Baseline

Know normal to find evil. If any of these deviate, investigate immediately.

ProcessExpected ParentCountExpected PathExpected User
SystemNone (PID 4)1N/ASYSTEM
smss.exeSystem1 (master)%systemroot%\System32\SYSTEM
csrss.exesmss.exe (shown as none)2+ (per session)%systemroot%\System32\SYSTEM
wininit.exesmss.exe (shown as none)1%systemroot%\System32\SYSTEM
winlogon.exesmss.exe (shown as none)1+ (per session)%systemroot%\System32\SYSTEM
services.exewininit.exe1%systemroot%\System32\SYSTEM
lsass.exewininit.exe1 (EXACTLY)%systemroot%\System32\SYSTEM
svchost.exeservices.exeMany%systemroot%\System32\SYSTEM/SERVICE/NETWORK SERVICE
explorer.exeuserinit.exe (shown as none)1 per user%systemroot%\Logged-in user
taskhostw.exesvchost.exe1+%systemroot%\System32\User/SYSTEM
RuntimeBroker.exesvchost.exe1+%systemroot%\System32\User
Critical Alerts

Windows Boot Process Chain

UEFI/BIOS → bootmgr → winload.exe → ntoskrnl.exe
  → smss.exe (Session Manager)
    → csrss.exe (Session 0) + wininit.exe
      wininit.exe → services.exe → svchost.exe (many)
                  → lsass.exe (EXACTLY ONE)
    → csrss.exe (Session 1) + winlogon.exe
      winlogon.exe → userinit.exe → explorer.exe

Any deviation from this tree = suspicious.

svchost.exe Service Groups

GroupServicesUser
-k netsvcsMany (largest group)SYSTEM
-k LocalServiceVarious local servicesLOCAL SERVICE
-k NetworkServiceDNS client, etc.NETWORK SERVICE
-k DcomLaunchDCOM, RPCSYSTEM
-k LocalServiceNoNetworkAudio endpoint builder, etc.LOCAL SERVICE
-k UnistackSvcGroupModern app servicesUser

16. Suspicious Parent-Child Relationships

Critical — Almost Always Malicious

winword.exe  → cmd.exe → powershell.exe    (macro execution)
winword.exe  → powershell.exe (direct)         (macro execution)
excel.exe    → cmd.exe / powershell.exe / mshta (macro execution)
outlook.exe  → powershell.exe                   (email-based attack)
w3wp.exe     → cmd.exe                          (web shell)
sqlservr.exe → cmd.exe / powershell.exe          (SQL injection)
wmiprvse.exe → powershell.exe                   (WMI lateral movement)
wsmprovhost.exe → powershell.exe                (WinRM lateral movement)

Suspicious — Investigate Arguments

explorer.exe   → cmd.exe → powershell.exe  (check args for -enc, downloads)
svchost.exe    → cmd.exe                       (possible injection into svchost)
services.exe   → cmd.exe                       (service executing shell)
taskhostw.exe  → suspicious child               (scheduled task abuse)
rundll32.exe   → cmd.exe / powershell.exe       (LOLBin chaining)
mshta.exe      → cmd.exe / powershell.exe       (HTA-based attack)
cscript/wscript → cmd.exe / powershell.exe      (script-based attack)
regsvr32.exe   → cmd.exe                        (Squiblydoo / AppLocker bypass)

Expected — Usually Benign

services.exe  → svchost.exe       svchost.exe  → WerFault.exe
explorer.exe  → [user apps]       userinit.exe → explorer.exe
smss.exe      → csrss.exe         wininit.exe  → services.exe
wininit.exe   → lsass.exe         winlogon.exe → userinit.exe

17. LOLBins Detection Reference

Living Off the Land Binaries — legitimate Windows tools abused by attackers.

BinaryLegitimate UseAbuse PatternDetection Events
certutil.exeCertificate management-urlcache -f download, -decode base64Sysmon 1 + 3
mshta.exeHTML ApplicationsRemote HTA execution via URLSysmon 1 + 3
regsvr32.exeRegister COM DLLs/s /n /u /i:http:// (Squiblydoo)Sysmon 1 + 3
rundll32.exeRun DLL functionsArbitrary DLL/shellcode executionSysmon 1 + 7
bitsadmin.exeBITS transfersSilent file downloadSysmon 1 + 3
msiexec.exeInstall MSI packagesRemote MSI payloadsSysmon 1 + 3
wmic.exeWMI command lineProcess creation, remote execSysmon 1 + 3
cmstp.exeConnection ManagerUAC bypass via INF fileSysmon 1 + 13
esentutl.exeESE database utilityCopy locked files (ntds.dit)Sysmon 1
msbuild.exeBuild .NET projectsInline C# task executionSysmon 1
installutil.exe.NET installerCode exec via Uninstall methodSysmon 1
forfiles.exeBatch file processingExecution proxySysmon 1
pcalua.exeProgram Compat AssistantExecution proxySysmon 1
bash.exe / wsl.exeWindows Subsystem for LinuxLinux commands on WindowsSysmon 1
Detection approach for all LOLBins:
  1. Unusual parent process (who launched it?)
  2. Unusual command-line arguments (what's it doing?)
  3. Network connections (shouldn't phone home)
  4. File writes to unusual locations (dropping payloads?)
  5. Execution from non-standard paths (masquerading?)

SPL (LOLBins with network connections):
  index=sysmon EventCode=3
  | where match(Image, "(?i)\\\\(certutil|mshta|regsvr32|rundll32|bitsadmin|msiexec|wmic|cmstp|msbuild|installutil)\\.exe$")
  | where NOT match(DestinationIp, "^(10\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.|192\\.168\\.|127\\.)")
  | table _time, Computer, Image, DestinationIp, DestinationPort, User

18. Dangerous Privileges Reference

Hunt via Event 4672 (Special Privileges Assigned). Non-SYSTEM accounts with these = investigate.

PrivilegeWhat It AllowsRiskAttack Use
SeDebugPrivilegeDebug any processCRITICALLSASS access, process injection
SeImpersonatePrivilegeImpersonate tokensCRITICALPotato exploits (Juicy/Sweet/God)
SeTcbPrivilegeAct as part of OSCRITICALFull system access
SeCreateTokenPrivilegeCreate tokensCRITICALForge arbitrary tokens
SeLoadDriverPrivilegeLoad kernel driversCRITICALBYOVD attacks
SeBackupPrivilegeRead any fileHIGHSAM/NTDS.dit access
SeRestorePrivilegeWrite any fileHIGHDLL hijacking, file replacement
SeTakeOwnershipPrivilegeTake ownership of objectsHIGHPermission manipulation
SeAssignPrimaryTokenPrivilegeAssign process tokenHIGHToken manipulation
SeEnableDelegationPrivilegeTrust for delegationHIGHKerberos delegation abuse
# Track dangerous privilege usage (non-system accounts)
index=wineventlog EventCode=4672
| where match(PrivilegeList, "SeDebugPrivilege|SeImpersonatePrivilege|SeBackupPrivilege|SeRestorePrivilege|SeTcbPrivilege|SeLoadDriverPrivilege|SeCreateTokenPrivilege")
| where NOT match(SubjectUserName, "(?i)SYSTEM|LOCAL SERVICE|NETWORK SERVICE|DWM-|UMFD-")
| where NOT match(SubjectUserName, "\$$")
| stats count values(PrivilegeList) as privileges by SubjectUserName, Computer
| sort - count

19. Beaconing Interval Reference

IntervalCommon ToolDetection Difficulty
0s (continuous)Meterpreter (default)Easy — very noisy
5-30sDefault Cobalt StrikeEasy — regular intervals visible
60sVarious "low and slow"Medium — need frequency analysis
300s (5m)Mature C2 operationsHard — blends with normal polling
900s (15m)Advanced persistent actorsHard — blends with normal traffic
3600s (1h)Long-haul persistenceVery hard — need long baselines
Random/large jitterAdvanced actorsVery hard — need statistical analysis
# Beaconing detection via Sysmon Event 3
index=sysmon EventCode=3 Initiated=true
| where NOT match(DestinationIp, "^(10\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.|192\\.168\\.|127\\.)")
| bin _time span=5m
| stats count by Image, DestinationIp, DestinationPort, _time, Computer
| streamstats current=f last(_time) as prev_time by Image, DestinationIp, Computer
| eval delta=_time-prev_time
| stats avg(delta) as avg_int, stdev(delta) as stdev_int, count
  by Image, DestinationIp, DestinationPort, Computer
| where count > 20 AND stdev_int < (avg_int * 0.2)
| eval jitter_pct=round((stdev_int/avg_int)*100,2)
| sort jitter_pct
PART III — ADVANCED ATTACK DETECTION

20. Token Manipulation & Privilege Escalation

Token Theft (T1134.001)

Attack: Open high-privilege process → duplicate token → apply to attacker process
Target: winlogon.exe, lsass.exe, services.exe (requires SeDebugPrivilege)

Detection:
  Sysmon Event 10: ProcessAccess targeting winlogon/lsass/services
  Security Event 4696: Primary token assigned to process
  Security Event 4672: SeDebugPrivilege used (prerequisite)

Token Impersonation — Potato Exploits

Juicy/Sweet/Rotten/God Potato abuse SeImpersonatePrivilege
to escalate from service account → SYSTEM.

Detection:
  index=wineventlog EventCode=4672
  | where match(PrivilegeList, "SeImpersonatePrivilege")
  | where NOT match(SubjectUserName, "(?i)SYSTEM|LOCAL SERVICE|NETWORK SERVICE")
  | table _time, Computer, SubjectUserName, PrivilegeList

Make Token (Cobalt Strike)

Creates new logon session with stolen creds. Generates 4624 LogonType=9.

  index=wineventlog EventCode=4624 LogonType=9
  | where NOT match(TargetUserName, "(?i)SYSTEM|DWM-|UMFD-")
  | table _time, Computer, TargetUserName, SubjectUserName, IpAddress

Parent PID Spoofing

Process appears to have a legitimate parent but was actually spawned by attacker.
Detection: Cross-reference Sysmon Event 1 creation times.
  If "parent" started AFTER "child" → spoofed PPID.
ETW: Microsoft-Windows-Kernel-Process catches REAL parent even when PID is spoofed.

21. .NET Assembly / Execute-Assembly Detection

C# attack tools (Rubeus, SharpHound, Seatbelt, Certify, SharpDPAPI) require the .NET CLR. Detect via Sysmon Event 7.

CLR DLLs to Monitor

DLLPurpose
clr.dllMain CLR runtime
clrjit.dllJIT compiler
mscoree.dllCLR startup shim
System.Management.Automation.dllPowerShell engine
# Non-.NET process loading CLR (high-fidelity detection)
index=sysmon EventCode=7 (ImageLoaded="*\\clr.dll" OR ImageLoaded="*\\clrjit.dll")
| where NOT match(Image, "(?i)powershell|pwsh|csc\\.exe|msbuild\\.exe|w3wp\\.exe|dotnet\\.exe|mmc\\.exe|devenv\\.exe|sqlservr|dns\\.exe|wsmprovhost")
| where NOT match(Image, "(?i)\\\\Microsoft\\\\|\\\\Windows\\\\Microsoft\\.NET|Visual Studio|JetBrains")
| table _time, Computer, Image, ImageLoaded, User

# Classic execute-assembly pattern (rundll32/dllhost loading CLR)
index=sysmon EventCode=7
  (ImageLoaded="*\\clr.dll" OR ImageLoaded="*\\clrjit.dll" OR ImageLoaded="*\\mscoree.dll")
  Image IN ("*\\rundll32.exe", "*\\dllhost.exe", "*\\gpupdate.exe",
            "*\\msiexec.exe", "*\\searchprotocolhost.exe", "*\\svchost.exe")
| table _time, Computer, Image, ImageLoaded, User

# PowerShell engine in non-PowerShell process (unmanaged PS / CLM bypass)
index=sysmon EventCode=7 ImageLoaded="*\\System.Management.Automation.dll"
| where NOT match(Image, "(?i)powershell|pwsh|wsmprovhost|svchost|ConfigRemoting")
| table _time, Computer, Image, ImageLoaded, User

22. Service Abuse Detection

Attack Tool Service Patterns

ToolService NameImagePath Pattern
PsExecPSEXESVC (or random)%SystemRoot%\PSEXESVC.exe
Impacket smbexecRandom (e.g., "BToBTo")%COMSPEC% /Q /c echo ... ^> \\127.0.0.1\C$\...
Cobalt StrikeRandom 7-16 chars%COMSPEC% /b /c start /b /min powershell -nop -w hidden -enc ...
# Comprehensive suspicious service detection (Event 7045)
index=wineventlog EventCode=7045
| eval suspicious=case(
    match(ImagePath, "(?i)cmd\\.exe|powershell|%COMSPEC%"), "CMD_IN_PATH",
    match(ImagePath, "(?i)\\\\Users\\\\|\\\\Temp\\\\|\\\\tmp\\\\|\\\\Downloads\\\\"), "USER_PATH",
    match(ImagePath, "(?i)-enc|-encoded|base64|hidden"), "ENCODED",
    match(ImagePath, "(?i)\\\\\\\\[0-9]|\\\\\\\\[a-zA-Z]"), "UNC_PATH",
    match(ImagePath, "(?i)rundll32|regsvr32|mshta"), "LOLBIN_SERVICE",
    NOT match(ImagePath, "^\"") AND match(ImagePath, " ") AND NOT match(ImagePath, "(?i)Windows|Program Files"), "UNQUOTED_PATH",
    len(ServiceName) < 4 OR match(ServiceName, "^[a-zA-Z]{7,16}$"), "RANDOM_NAME",
    1=1, "REVIEW"
  )
| where suspicious!="REVIEW"
| table _time, Computer, ServiceName, ImagePath, AccountName, suspicious | sort suspicious

# Unquoted service path (privilege escalation vector)
index=wineventlog EventCode=7045
| where NOT match(ImagePath, "^\"") AND match(ImagePath, " ")
  AND NOT match(ImagePath, "^C:\\\\Windows")
| table _time, Computer, ServiceName, ImagePath

# ServiceDll hijacking (Sysmon 13)
index=sysmon EventCode=13
| where match(TargetObject, "(?i)\\\\Services\\\\.*\\\\Parameters\\\\ServiceDll")
| table _time, Computer, Image, TargetObject, Details

23. COM Object Hijacking

No admin required. HKCU checked before HKLM. Attacker creates HKCU CLSID entry → their DLL loads instead.

Why It's Stealthy

No new process, no service, no scheduled task, no Run key. DLL loads into existing process when COM object is called. Most tools don't monitor HKCU CLSID changes.

Commonly Hijacked CLSIDs

CLSIDLoaded ByNotes
{BCDE0395-E52F-...}Many audio appsMMDeviceEnumerator — very frequent trigger
{42aedc87-2188-...}explorer.exeTriggers at user logon — classic persistence
{fbeb8a05-beee-...}explorer.exeShellFolder
{0A29FF9E-7F9C-...}eventvwr.exeUAC bypass — eventvwr auto-elevates
# HKCU CLSID InprocServer32 creation (the attack itself)
index=sysmon EventCode IN (12, 13)
| where match(TargetObject, "(?i)HKU\\\\.*\\\\Classes\\\\CLSID\\\\.*\\\\InprocServer32")
  OR match(TargetObject, "(?i)HKCU\\\\.*\\\\Classes\\\\CLSID\\\\.*\\\\InprocServer32")
| where NOT match(Image, "(?i)msiexec|TiWorker|setup|install|update|DismHost|svchost")
| table _time, Computer, Image, TargetObject, Details

# DLL loaded from user path via COM (the result)
index=sysmon EventCode=7
| where match(ImageLoaded, "(?i)\\\\Users\\\\|\\\\Temp\\\\|\\\\AppData\\\\")
| where match(Image, "(?i)explorer\\.exe|svchost\\.exe|mmc\\.exe|eventvwr\\.exe")
| table _time, Computer, Image, ImageLoaded, Signed

24. DPAPI Backup Key Hunting

Domain Backup Key = master key to ALL DPAPI-protected secrets across the domain. Extractable by Domain Admins.

What It Unlocks

SecretWhere
Browser passwordsChrome, Edge, Firefox
Credential ManagerWindows Vault
WiFi passwordsWLAN profiles
RDP credentialsSaved RDP sessions
Certificate private keysUser/machine cert store
EFS encryption keysEncrypted files
# Detect backup key extraction (Event 4662 targeting LSA secrets)
index=wineventlog EventCode=4662
| where match(Properties, "(?i)BCKUPKEY|currentValue")
| table _time, SubjectUserName, Computer, ObjectName, Properties

# Sysmon: Tools extracting backup key
index=sysmon EventCode=1
| where match(CommandLine, "(?i)backupkeys|lsadump::backupkeys|dpapi\\.py.*backupkey")
| table _time, Computer, User, Image, CommandLine

25. WMI Persistence Forensics

Fileless persistence via WMI event subscriptions. Survives reboots with no files on disk.

WMI Subscription Components

ComponentSysmon EventWhat It Does
__EventFilterEvent 19WHEN to trigger (timer, logon, process start)
__EventConsumerEvent 20WHAT to execute (CommandLine, ActiveScript, PowerShell)
__FilterToConsumerBindingEvent 21Links filter to consumer (activates the subscription)
# All three must exist for a working subscription
# Sysmon 19/20/21 fire when each is created

# WMI persistent subscriptions (Sysmon)
index=sysmon EventCode IN (19, 20, 21)
| table _time, Computer, EventCode, Operation, User, Name, Query, Destination

# WMI-Activity operational log
index=wineventlog source="*WMI-Activity*" EventCode=5861
| table _time, Computer, Message

# WMI consumers executing suspicious commands
index=sysmon EventCode=20
| where match(Destination, "(?i)powershell|cmd|script|encoded|http|rundll32")
| table _time, Computer, Name, Destination

26. BITS Abuse Detection

Background Intelligent Transfer Service — used for downloads, exfil, and persistence.

EventSourceMeaning
3BITS-ClientJob created
4BITS-ClientTransfer completed
59BITS-ClientStarted transferring
60BITS-ClientStopped transferring
# BITS persistence via NotifyCmdLine (runs command after transfer)
index=sysmon EventCode=1 Image="*\\bitsadmin.exe"
| where match(CommandLine, "(?i)SetNotifyCmdLine|/transfer.*http|addfile.*http")
| table _time, Computer, User, CommandLine

# BITS-Client events
index=wineventlog source="*BITS*" EventCode IN (3,4,59)
| table _time, Computer, EventCode, Message

27. Active Directory Attack Patterns

Kerberos Attacks Summary

AttackDetection EventKey Indicator
Kerberoasting4769RC4 (0x17) encryption + multiple SPNs from one source
AS-REP Roasting4768PreAuthType=0 (no pre-authentication)
Golden Ticket4769 without 4768TGS without preceding TGT request
Silver Ticket4624 without 4769Logon without TGS on DC (forged locally)
Overpass-the-Hash4768TGT with RC4 encryption from unexpected source
Pass-the-Ticket4769 from different IP than 4768TGT obtained on one host, used on another
Skeleton KeySysmon 7 (lsass loading DLL)lsass.exe loading unexpected DLL
DCShadow4742 + 5137Computer account promoted to DC, new AD object
Diamond TicketVery hardModified legitimate TGT — requires decryption analysis

AD Persistence Mechanisms

TechniqueDetectionKey Indicator
AdminSDHolder5136 (AD object modified)ACL on AdminSDHolder container changed
GPO Abuse5136 (gPLink/gPCFileSysPath)GPO linked to OU or GPO content modified
SID History Injection4765SID history added to account
Machine Account Quota4741Non-admin creating computer accounts (RBCD setup)
Certificate Template Abuse4899Template modified for ESC1-ESC8
Rogue DC4742Computer account modified with DC attributes

AD Enumeration Detection

# BloodHound-style LDAP enumeration
# High volume of LDAP queries for users, groups, computers, SPNs
index=wineventlog EventCode=4662
| where match(Properties, "bf967aba|bf967a86|bf967a9c")
| bin _time span=5m
| stats count dc(ObjectName) as objects by SubjectUserName, _time
| where objects > 50

# Sensitive LDAP query patterns
# (userAccountControl:1.2.840.113556.1.4.803:=4194304) = DONT_REQ_PREAUTH (AS-REP roastable)
# (servicePrincipalName=*) = Kerberoastable accounts
# (adminCount=1) = Admin accounts
# (msDS-AllowedToDelegateTo=*) = Delegation-enabled accounts

28. Scheduled Task Forensics — Beyond Event 4698

Task Scheduler artifacts exist in multiple locations. Cross-reference for complete coverage.

ArtifactLocationSurvives Log Clearing?
Task XML filesC:\Windows\System32\Tasks\Yes
Security eventsEvents 4698-4702No (if cleared)
Scheduler operational logEvents 106, 140, 141, 200, 201No (if cleared)
Registry (TaskCache)HKLM\SOFTWARE\Microsoft\Windows NT\...\Schedule\TaskCacheYes
Legacy AT tasksC:\Windows\Tasks\*.jobYes

Hidden Task Discovery

# Compare tasks on disk vs visible via schtasks
# Hidden tasks exist on disk but don't show in Task Scheduler UI

# Event 200 (Action Started) shows the ACTUAL command executed
# This is more reliable than 4698's TaskContent XML for confirming execution
index=wineventlog source="*TaskScheduler*" EventCode=200
| table _time, Computer, TaskName, ActionName, Message

29. Incident Severity Matrix

SeverityCriteriaResponse TimeExamples
CRITICALActive data breach, ransomware, APT confirmed< 15 minDCSync, ransomware precursors, LSASS dump + lateral movement
HIGHConfirmed lateral movement, credential theft, active C2< 1 hourPtH spray, new malicious service, C2 beacon confirmed
MEDIUMSuspicious activity, possible recon, single-host indicator< 4 hoursBloodHound enumeration, suspicious PowerShell, single AV alert
LOWPolicy violation, low-confidence alert< 24 hoursFailed logon spike, USB device, off-hours admin access

30. Registry Persistence — Top Keys

Monitor via Sysmon Event 12 (key create/delete) and 13 (value set).

Persistence Keys

#KeyWhat It Does
1HKLM\...\CurrentVersion\RunPrograms run at every logon (all users)
2HKCU\...\CurrentVersion\RunPrograms run at logon (current user)
3HKLM\...\CurrentVersion\RunOnceRun once then delete (all users)
4HKLM\...\Winlogon\ShellDefault: explorer.exe. Replace = boot persistence
5HKLM\...\Winlogon\UserinitDefault: userinit.exe. Append = logon persistence
6HKLM\...\Image File Execution Options\*\DebuggerRuns instead of named exe = hijack any process
7HKLM\SYSTEM\...\Services\*\ImagePathService binary path. Start=2 = auto-start
8HKLM\...\Windows\AppInit_DLLsDLL injected into every user32.dll process
9HKLM\SYSTEM\...\Control\Session Manager\BootExecuteRuns before Windows fully starts
10HKCU\...\Classes\CLSID\*\InprocServer32COM hijacking (no admin needed)
11HKLM\...\Control\Lsa\Security PackagesSSP injection into lsass.exe at boot
12HKLM\...\Print\Monitors\*\DriverDLL loaded by spoolsv.exe (SYSTEM)

Defense Evasion Keys

KeyAbuse
HKLM\...\Windows Defender\DisableAntiSpywareDefender disabled via registry
HKLM\...\Windows Defender\Exclusions\PathsAttacker adds malware path to exclusions
HKLM\...\Policies\System\EnableLUA0 = UAC disabled
HKLM\...\PowerShell\EnableScriptBlockLoggingAttacker disables PS logging
# Comprehensive registry persistence sweep (Sysmon 12/13)
index=sysmon EventCode IN (12, 13)
| where match(TargetObject, "(?i)\\\\Run\\\\|\\\\RunOnce\\\\|\\\\Winlogon\\\\(Shell|Userinit)|Image File Execution Options.*Debugger|AppInit_DLLs|\\\\Print\\\\Monitors.*Driver|\\\\Lsa\\\\(Security|Authentication) Packages|\\\\Classes\\\\CLSID.*InprocServer32|BootExecute")
| table _time, Computer, EventCode, Image, TargetObject, Details | sort - _time

31. ShimDB Persistence

Application Compatibility shims inject DLLs or redirect execution. No Run keys, no services, no tasks — invisible to most tools.

TechniqueHow It Works
InjectDLL.sdb specifies DLL → target app runs → DLL loads automatically
RedirectEXE.sdb redirects one exe to another → user runs notepad → malware runs
Locations:
  C:\Windows\AppPatch\Custom\*.sdb
  C:\Windows\AppPatch\Custom\Custom64\*.sdb
  HKLM\...\AppCompatFlags\Custom
  HKLM\...\AppCompatFlags\InstalledSDB

# sdbinst.exe execution (shim installation)
index=sysmon EventCode=1 Image="*\\sdbinst.exe"
| table _time, Computer, User, CommandLine

# New .sdb files
index=sysmon EventCode=11
| where match(TargetFilename, "(?i)\\\\AppPatch\\\\Custom.*\\.sdb")
| table _time, Computer, Image, TargetFilename

# AppCompatFlags registry changes
index=sysmon EventCode IN (12, 13)
| where match(TargetObject, "(?i)AppCompatFlags\\\\(Custom|InstalledSDB)")
| table _time, Computer, Image, TargetObject, Details

32. Code Signing Forensics

Signature StatusMeaningHunt Value
ValidUnmodified since signingNormal (but stolen certs exist)
Invalid / HashMismatchFile tampered after signingInvestigate immediately
ExpiredCertificate expiredMay be old legitimate or lazy attacker
RevokedCertificate revoked (compromised)Known-compromised publisher
NotSignedNever signedContext-dependent

Known Stolen Certificate Campaigns

Stuxnet:            Stolen Realtek + JMicron certs
Duqu:               Stolen C-Media cert
Flame:              Forged Microsoft cert (MD5 collision)
ShadowPad/CCleaner: Legitimate Piriform/Avast cert (supply chain)
NVIDIA leak:        Stolen NVIDIA certs used to sign malware
Various ransomware: Purchased or stolen EV certificates
# Modules loaded with invalid/expired/revoked signatures (Event 7, not Event 1)
index=sysmon EventCode=7
| where SignatureStatus IN ("Expired", "Revoked", "Invalid", "Error")
| table _time, Computer, Image, ImageLoaded, SignatureStatus, Signature

# Unsigned drivers (BYOVD indicator)
index=sysmon EventCode=6
| where Signed="false" OR SignatureStatus!="Valid"
| table _time, Computer, ImageLoaded, Signed, Signature, Hashes

# Certificate serial number as IOC (find other files from same stolen cert)
# PowerShell:
Get-AuthenticodeSignature C:\path\to\file.exe
# Then search: Get-ChildItem -Recurse *.exe | Where { (Get-AuthenticodeSignature $_).SignerCertificate.SerialNumber -eq "TARGET_SERIAL" }

33. WEF Architecture & Blind Spot Detection

If attackers disable WEF, your SIEM goes blind for that host.

How Attackers Disable Forwarding

TechniqueCommandDetection
Stop WinRMnet stop WinRMEvent 7036 (WinRM stopped)
Disable subscriptionwecutil ss Name /e:falseSysmon 1 (wecutil.exe)
Block WinRM portsnetsh ... block 5985,5986Firewall Event 2004
Shrink log sizewevtutil sl Security /ms:1048576Sysmon 1 (wevtutil.exe)
Modify GPOGPO change for WEFEvent 5136
# Detect hosts that stopped forwarding (blind spot detection)
index=wineventlog
| stats latest(_time) as last_event by Computer
| eval hours_since = round((now() - last_event) / 3600, 1)
| where hours_since > 4
| sort - hours_since
| table Computer, hours_since, last_event

# WinRM service stopped
index=wineventlog EventCode=7036
| where match(Message, "(?i)Windows Remote Management.*stopped")
| table _time, Computer, Message

# WEF manipulation tools
index=sysmon EventCode=1 Image IN ("*\\wecutil.exe", "*\\wevtutil.exe")
| where match(CommandLine, "(?i)/e:false|ds |sl.*ms:")
| table _time, Computer, User, CommandLine

34. Sigma-to-SPL Translation Reference

Convert community Sigma rules to production SPL queries.

Modifier Translation

Sigma ModifierSPL Equivalent
|endswithfield="*value"
|startswithfield="value*"
|containsfield="*value*"
|contains|allfield="*val1*" field="*val2*" (AND)
|rematch(field, "regex")
|cidrcidrmatch("10.0.0.0/8", field)
|windashfield="*/c*" OR field="*-c*"

Logsource Mapping

Sigma CategorySPL Index / Filter
process_creationindex=sysmon EventCode=1 OR index=wineventlog EventCode=4688
registry_setindex=sysmon EventCode=13
file_eventindex=sysmon EventCode=11
network_connectionindex=sysmon EventCode=3
image_loadindex=sysmon EventCode=7
process_accessindex=sysmon EventCode=10
dns_queryindex=sysmon EventCode=22
driver_loadindex=sysmon EventCode=6
create_remote_threadindex=sysmon EventCode=8
wmi_eventindex=sysmon EventCode IN (19,20,21)
ps_scriptindex=wineventlog EventCode=4104
windows / securityindex=wineventlog source="WinEventLog:Security"
windows / systemindex=wineventlog source="WinEventLog:System"
# Automated conversion
sigma convert -t splunk -p sysmon rules/credential_access/mimikatz.yml

35. AMSI Content & Tool Identification

Windows Defender Events 1116/1117 contain the actual threat name — use it to identify attacker tools.

Threat Name Decoding

Defender threat names follow a pattern:
  [Type]:[Platform]/[Family].[Variant]![Suffix]

Examples:
  HackTool:Win32/Mimikatz.D        = Mimikatz
  HackTool:Win64/Rubeus.A          = Rubeus (Kerberos attacks)
  HackTool:MSIL/SharpHound.A       = SharpHound (BloodHound collector)
  Trojan:Win32/CobaltStrike.B!dha  = Cobalt Strike beacon
  HackTool:Win32/Certify.A         = Certify (AD CS attacks)
  Behavior:Win32/Invoke-Mimikatz.A = PowerShell Mimikatz

Type prefixes: HackTool = offensive tool, Trojan = malware, Behavior = behavioral detection
Platform: Win32/Win64 = native, MSIL = .NET/C#
# Extract tool names from Defender detections
index=wineventlog source="*Windows Defender*" EventCode IN (1116, 1117)
| rex field=Message "Threat Name:\s*(?<threat_name>[^\n]+)"
| eval tool=case(
    match(threat_name, "(?i)Mimikatz"), "MIMIKATZ",
    match(threat_name, "(?i)CobaltStrike|Beacon"), "COBALT_STRIKE",
    match(threat_name, "(?i)Rubeus"), "RUBEUS",
    match(threat_name, "(?i)SharpHound|BloodHound"), "BLOODHOUND",
    match(threat_name, "(?i)Certify"), "CERTIFY_ADCS",
    match(threat_name, "(?i)Seatbelt"), "SEATBELT",
    match(threat_name, "(?i)SharpDPAPI"), "SHARPDPAPI",
    1=1, threat_name
  )
| table _time, Computer, tool, threat_name, EventCode
| sort - _time

# Track attacker response to detection (did they disable Defender after?)
index=wineventlog source="*Windows Defender*" EventCode IN (1116, 5001, 5007) Computer="HOST"
| sort _time
| table _time, EventCode, Message
# Pattern: 1116 (detected) → 5001 (disabled) or 5007 (exclusion added) = attacker adapting
PART IV — FOUNDATIONS

36. ETW (Event Tracing for Windows)

ETW is the underlying telemetry framework. Sysmon, Security logs, and EDR all consume ETW. Understanding it gives access to the raw source.

Architecture

Provider → Session → Consumer

Provider:   Generates events (kernel, applications, services)
Session:    Collects events from one or more providers
Consumer:   Processes/records events (SIEM, EDR, custom tools)

Key ETW Providers for Security

ProviderGUIDEventsValue
Kernel-Process{22FB2CD6-0E7B-422B-A0C7-2FAD1FD0E716}Process creation, termination, image loadRaw process telemetry (before Sysmon filtering)
Kernel-File{EDD08927-9CC4-4E65-B970-C2560FB5C289}File create, delete, rename, read, writeFile system activity at kernel level
Kernel-Registry{70EB4F03-C1DE-4F73-A051-33D13D5413BD}Registry key/value operationsRegistry changes before Sysmon filtering
Kernel-Network{7DD42A49-5329-4832-8DFD-43D979153A88}TCP/UDP connections, DNS queriesNetwork connections at kernel level
DNS-Client{1C95126E-7EEA-49A9-A3FE-A378B03DDB4D}DNS query/responseProcess-level DNS resolution
DotNETRuntime{E13C0D23-CCBC-4E12-931B-D9CC2EEE27E4}.NET assembly loading, JIT compilationDetect .NET-based attacks (Cobalt Strike, PowerShell)
LDAP-Client{099614A5-5DD7-4788-8BC9-E29F43DB28FC}LDAP queriesAD enumeration detection
WinINet{43D1A55C-76D6-4F7E-995C-64C711E5CAFE}HTTP/HTTPS connectionsProcess-level HTTP activity
Security-Auditing{54849625-5478-4994-A5BA-3E3B0328C30D}All Windows Security eventsThe provider behind the Security event log

Using ETW for Advanced Detection

# List all active ETW sessions
logman query -ets

# Create a custom ETW session for hunting
logman create trace SecurityHunt -ets -p Microsoft-Windows-Kernel-Process -o C:\hunt\trace.etl

# Start/stop the trace
logman start SecurityHunt -ets
logman stop SecurityHunt -ets

# Convert ETL to readable format
tracerpt C:\hunt\trace.etl -o C:\hunt\output.csv -of CSV

# Real-time ETW monitoring with SilkETW
SilkETW.exe -t user -pn Microsoft-Windows-DotNETRuntime -uk 0x2038 -ot file -p C:\hunt\dotnet.json

ETW-Based Detection Bypasses (What Attackers Do)

TechniqueMethodDetection
Patching EtwEventWritePatches ntdll.dll in user-mode to return immediatelyMonitor for ntdll.dll memory modifications
Removing ETW providerslogman update trace -ets -p {GUID} -disableMonitor for ETW session modifications
Kernel-level tamperingPatching kernel ETW functionsKernel integrity monitoring
TLS callback abuseModify ETW thread callbacksVery difficult — requires kernel monitoring
# Hunt for ETW tampering
# Suspicious process access with write permissions (potential ntdll patching)
index=sysmon EventCode=10 GrantedAccess IN ("0x1FFFFF","0x1F3FFF","0x001F0FFF")
| where NOT match(SourceImage, "(?i)csrss\\.exe|smss\\.exe|services\\.exe|MsMpEng\\.exe|lsass\\.exe|svchost\\.exe")
| where NOT match(TargetImage, "(?i)\\\\lsass\\.exe")
| table _time, Computer, SourceImage, TargetImage, GrantedAccess

# ETW session modifications
index=sysmon EventCode=1 Image="*\\logman.exe"
| where match(CommandLine, "(?i)update|delete|stop") AND match(CommandLine, "(?i)trace|ets|session")
| table _time, Computer, User, CommandLine

37. EVTX Integrity & Log Manipulation Detection

Sophisticated attackers selectively delete events, not just clear logs.

How EVTX Files Work

.evtx files contain records with sequential Record IDs: 1, 2, 3, 4, 5, 6, 7...
If an attacker deletes records 4 and 5:  1, 2, 3, [GAP], 6, 7...
The gap in Record IDs = evidence of manipulation.

Detection Methods

MethodTechniqueNotes
Record ID GapsCheck for non-sequential Record IDsMost reliable for selective deletion
File Size vs CountFile size larger than expected for record countSlack space contains remnants
Timestamp GapsNo events during a period on a busy systemContext-dependent
Event 1102Security Audit Log ClearedObvious — attackers who selectively delete don't trigger this
Event 104 (System)Any event log was clearedCatches non-Security log clears
Service TamperingEvent log service stopped (7036)No new events while stopped
Sysmon ContinuityGap in Sysmon eventsSysmon stopped or logs deleted

PowerShell Record ID Gap Detection

$events = Get-WinEvent -Path Security.evtx -Oldest
$prev = 0
foreach ($event in $events) {
    if ($event.RecordId - $prev > 1 -and $prev -gt 0) {
        Write-Host "GAP: Records $prev to $($event.RecordId) missing ($($event.RecordId - $prev - 1) events)"
    }
    $prev = $event.RecordId
}

SPL Detection Queries

# Log cleared events
index=wineventlog EventCode=1102
| table _time, Computer, SubjectUserName

# System log - any log cleared
index=wineventlog source="WinEventLog:System" EventCode=104
| table _time, Computer, Message

# Event log service stopped
index=wineventlog EventCode=7036
| where match(Message, "(?i)Windows Event Log.*stopped")
| table _time, Computer, Message

# Sysmon continuity check (gap = suspicious)
index=sysmon Computer="HOST"
| bin _time span=5m
| timechart span=5m count
| where count < 5

EVTX Analysis Tools

ToolPurpose
EvtxECmd (Eric Zimmerman)Full EVTX parsing with timeline output
Chainsaw (WithSecure)Fast Windows event log hunting with Sigma rules
HayabusaFast forensic timeline from EVTX files
LogParserMicrosoft's SQL-like log query tool
PART V — WINDOWS SECURITY EVENT LOG

38. Authentication Events (4624, 4625)

Event IDNameHunt ValueKey Fields
4624Logon SuccessLateral movement, account abuseTargetUserName, LogonType, IpAddress, WorkstationName
4625Logon FailureBrute force, password sprayTargetUserName, LogonType, IpAddress, Status, SubStatus
4626User/Device Claims InfoClaims-based accessSubject, DeviceClaims
4627Group Membership InfoGroup trackingSubjectUserName, GroupMembership
4634LogoffSession durationTargetUserName, LogonType
4647User-Initiated LogoffUser session trackingTargetUserName
4648Logon Using Explicit CredsRunAs, credential useSubjectUserName, TargetUserName, TargetServerName
4649Replay Attack DetectedKerberos replayTargetUserName, KeyType
4672Special Privileges AssignedPrivilege escalationSubjectUserName, PrivilegeList
4675SIDs Were FilteredSID filteringTargetUserName

4625 Failure Status/SubStatus Codes

Note: Splunk stores these in lowercase (e.g., 0xc000006d). Use lower(Status) or match case when searching.

StatusSubStatusMeaning
0xC000006AWrong password
0xC0000064User does not exist
0xC000006D0xC000006ABad password
0xC000006D0xC0000064Bad username
0xC000006FLogon outside allowed hours
0xC0000070Logon from unauthorized workstation
0xC0000071Expired password
0xC0000072Account disabled
0xC000015BUser not granted logon type
0xC0000192NetLogon service not started
0xC0000193Account expired
0xC0000224Password must change at next logon
0xC0000234Account locked out
0xC0000413Machine account auth failure

Logon Type Reference

TypeNameWhen GeneratedHunt Significance
2InteractiveConsole logon, RunAsNormal for workstations; suspicious for servers
3NetworkSMB, net use, remote mgmtLateral movement indicator (PsExec, WMI)
4BatchScheduled task executionPersistence mechanism
5ServiceService startupService account abuse
7UnlockScreen unlockNormal, but timing can matter
8NetworkCleartextIIS basic authCredentials in clear — security issue
9NewCredentialsRunAs /netonlyCredential use without interactive logon
10RemoteInteractiveRDP, Terminal ServicesLateral movement (very common)
11CachedInteractiveOffline domain cred logonDC connectivity issues or isolation
12CachedRemoteInteractiveCached RDPSimilar to Type 11 for RDP
13CachedUnlockCached creds unlockDC unreachable during unlock

39. Logon Events Deep Dive (4624/4625)

Most analysts use 30% of Event 4624. These are the fields they miss.

The Full 4624 Field Set

FieldDescriptionHunt Use
SubjectUserSidSID of the requesting accountIdentify the "asker"
TargetLogonIdLogon session ID (hex)Track ALL activity in this session
AuthenticationPackageNameKerberos / NTLM / NegotiateProtocol fingerprinting
LogonGuidLinks to Kerberos TGS (4769)Correlate logon to Kerberos service tickets
LmPackageNameNTLM V1 / NTLM V2NTLMv1 should not exist
KeyLengthEncryption key lengthPass-the-Hash detection (128=NTLMv2, 0=Kerberos/NULL, 56=NTLMv1)
ImpersonationLevelImpersonation grantedToken manipulation
ElevatedToken%%1842=Yes, %%1843=NoAdmin session tracking
RestrictedAdminModeRDP Restricted AdminRDP security posture
TargetLinkedLogonIdLinks standard + elevated sessionsUAC split token tracking
TargetOutboundUserNameOutbound identity (Type 9)NewCredentials identity

AuthenticationPackageName — Protocol Fingerprinting

ValueProtocolSignificance
KerberosKerberos authenticationModern, preferred — most domain logons
NTLMNTLM authenticationLegacy, weaker, attack vector (PtH, relay)
NegotiateTried Kerberos, fell backPossible Kerberos config issue
MICROSOFT_AUTHENTICATION_PACKAGE_V1_0MSV1_0 (local account)Unusual for domain accounts
CloudAPAzure AD / Entra IDCloud authentication
SchannelCertificate-based (TLS)Client cert auth

Pass-the-Hash Detection via KeyLength

# Detect potential Pass-the-Hash
index=wineventlog EventCode=4624 LogonType=3
  AuthenticationPackageName="NTLM" LogonProcessName="NtLmSsp"
| where TargetUserName!="ANONYMOUS LOGON" AND NOT match(TargetUserName, "\$$")
| stats count dc(Computer) as unique_targets values(Computer) as targets
  by TargetUserName, IpAddress, WorkstationName, KeyLength
| where unique_targets > 2
| sort - unique_targets

# NTLMv1 usage (should be ZERO)
index=wineventlog EventCode=4624 AuthenticationPackageName="NTLM"
| where LmPackageName="NTLM V1" OR KeyLength=56
| stats count by TargetUserName, IpAddress, Computer, LmPackageName

TargetLogonId — Session Tracking

# Everything a user did in one session
index=wineventlog (EventCode=4624 OR EventCode=4634 OR EventCode=4672 OR
  EventCode=4688 OR EventCode=5140 OR EventCode=5145)
  (TargetLogonId="0x12345678" OR SubjectLogonId="0x12345678")
| sort _time
| table _time, EventCode, Computer, TargetUserName, SubjectUserName

# Cross-reference with Sysmon (LogonId links process execution to logon session)
index=sysmon EventCode=1 LogonId="0x12345678"
| table _time, Computer, Image, CommandLine, ParentImage | sort _time

Event 4625 — Failure Analysis Patterns

# Password Spray Detection
index=wineventlog EventCode=4625 Status="0xc000006d" SubStatus="0xc000006a"
| bin _time span=15m
| stats count dc(TargetUserName) as unique_users values(TargetUserName) as users
  by IpAddress, _time
| where unique_users > 10

# User Enumeration (SubStatus=0xC0000064 = user does not exist)
index=wineventlog EventCode=4625 SubStatus="0xc0000064"
| stats count dc(TargetUserName) as tried_names by IpAddress
| where tried_names > 10

# Brute Force Success (multiple failures then success)
index=wineventlog EventCode IN (4625, 4624)
| sort _time
| transaction TargetUserName IpAddress maxspan=30m
  startswith=(EventCode=4625) endswith=(EventCode=4624)
| where eventcount > 5
| table TargetUserName, IpAddress, eventcount, duration

40. Account Management Events

Event IDNameHunt ValueKey Fields
4720User Account CreatedBackdoor accountsTargetUserName, SubjectUserName
4722User Account EnabledDormant account activationTargetUserName
4723Password Change Attempt (by user)Account manipulationTargetUserName
4724Password Reset Attempt (by admin)Account takeoverTargetUserName, SubjectUserName
4725User Account DisabledCleanup or denial of serviceTargetUserName
4726User Account DeletedCleanupTargetUserName
4728Member Added to Global Security GroupPrivilege escalationMemberName, TargetUserName
4732Member Added to Local Security GroupLocal admin addMemberName, TargetUserName
4738User Account ChangedAccount manipulationTargetUserName, changed attributes
4740User Account Locked OutBrute force indicatorTargetUserName, SubjectUserName
4741Computer Account CreatedNew domain joinTargetUserName
4756Member Added to Universal Security GroupEnterprise admin addMemberName, TargetUserName
4767User Account UnlockedPost-lockout activityTargetUserName, SubjectUserName

41. Kerberos Events

Event IDNameHunt ValueKey Fields
4768Kerberos TGT Requested (AS-REQ)AS-REP Roasting, auth trackingTargetUserName, IpAddress, TicketEncryptionType, Status
4769Kerberos Service Ticket (TGS-REQ)Kerberoasting, service accessServiceName, TargetUserName, IpAddress, TicketEncryptionType
4770Kerberos Service Ticket RenewedTicket managementTargetUserName, ServiceName
4771Kerberos Pre-Auth FailedPassword sprayingTargetUserName, IpAddress, Status
4773Kerberos Service Ticket FailedAuth failures (never generated — use 4769 with non-zero Status instead)TargetUserName, ServiceName

Kerberos Encryption Types

ValueAlgorithmHunt Significance
0x1DES-CBC-CRCWeak/legacy — should not be in use
0x3DES-CBC-MD5Weak/legacy — should not be in use
0x11AES128-CTS-HMAC-SHA1-96Normal — modern
0x12AES256-CTS-HMAC-SHA1-96Normal — modern, preferred
0x17RC4-HMACKerberoasting indicator — downgraded encryption
0x18RC4-HMAC-EXPWeak — export grade

4768 Kerberos Status Codes

StatusMeaningHunt Value
0x0SuccessNormal
0x6Client not foundEnumeration attempt
0x7Server not foundMisconfiguration or enumeration
0xCPolicy rejects requestTime sync or policy violation
0x12Client credentials revokedAccount disabled/locked/expired
0x18Pre-auth data invalidWrong password (AS-REQ)
0x25Clock skew too greatTime sync issue or Golden Ticket

42. Kerberos Deep Dive

Event 4768 (AS-REQ) — TGT Request Analysis

TicketOptions Bitmask

BitFlagNotes
0x40000000ForwardableCan be used for delegation
0x20000000ForwardedHas been forwarded
0x10000000ProxiableCan be used as proxy
0x08000000ProxyProxy ticket requested
0x00800000RenewableCan be renewed
0x00010000CanonicalizeRequest principal name canonicalization
0x00000010Name-canonicalizeCanonicalize server name

Common values: 0x40810010 = normal workstation TGT. 0x50800000 = Forwardable + Proxiable + Renewable (delegation-capable TGT — investigate if from unexpected account). 0x60810010 = forwarded TGT (Kerberos delegation).

PreAuthType

ValueMeaningHunt Value
0No pre-authenticationAS-REP Roasting vulnerable!
2PA-ENC-TIMESTAMPStandard (encrypted timestamp)
15PA-PK-AS-REQCertificate/smartcard authentication

Kerberos Attack Detection Queries

# Kerberoasting (mass TGS requests with RC4)
index=wineventlog EventCode=4769 TicketEncryptionType="0x17"
| where ServiceName!="krbtgt" AND NOT match(ServiceName, "\$$")
| bin _time span=5m
| stats count dc(ServiceName) as unique_spns values(ServiceName) as services
  by TargetUserName, IpAddress, _time
| where unique_spns > 3

# AS-REP Roasting
index=wineventlog EventCode=4768 PreAuthType="0" Status="0x0"
| stats count by TargetUserName, IpAddress, TicketEncryptionType

# Golden Ticket indicators (TGS without recent TGT)
index=wineventlog EventCode=4769
| eval key=TargetUserName."-".IpAddress
| join type=left key
  [search index=wineventlog EventCode=4768 Status="0x0"
   | eval key=TargetUserName."-".IpAddress
   | stats max(_time) as last_tgt by key]
| eval time_since_tgt = _time - last_tgt
| where isnull(last_tgt) OR time_since_tgt > 43200
| table _time, TargetUserName, ServiceName, IpAddress, time_since_tgt

# Clock skew (possible Golden Ticket)
index=wineventlog EventCode=4768 Status="0x25"
| stats count by IpAddress, TargetUserName

4768 → 4769 → 4624 Correlation Chain

Anomaly Detection in the Chain

43. Object Access & Audit Events

Event IDNameHunt ValueKey Fields
4656Handle to Object RequestedSAM/SYSTEM/SECURITY hive accessObjectName, ObjectType, AccessMask
4657Registry Value ModifiedPersistence, config changesObjectName, ObjectValueName, NewValue
4660Object DeletedAnti-forensicsObjectName
4662Operation on AD ObjectDCSync detectionProperties (GUIDs), SubjectUserName
4663Object Access AttemptedFile access auditingObjectName, AccessMask, ProcessName
4670Permissions ChangedACL manipulationObjectName, SubjectUserName

4662 Key GUIDs for DCSync

DS-Replication-Get-Changes:          {1131f6aa-9c07-11d1-f79f-00c04fc2dcd2}
DS-Replication-Get-Changes-All:      {1131f6ad-9c07-11d1-f79f-00c04fc2dcd2}
DS-Replication-Get-Changes-In-Filtered-Set: {89e95b76-444d-4c62-991a-0facbeda640c}

44. Event 4662 — GUID Decoding

Critical GUIDs for Detection

GUIDMaps ToHunt Use
{1131f6aa-...}DS-Replication-Get-ChangesDCSync detection
{1131f6ad-...}DS-Replication-Get-Changes-AllDCSync detection
{89e95b76-...}DS-Replication-Get-Changes-In-Filtered-SetDCSync detection
{4c164200-...}User-Account-ControlAccount property manipulation (e.g., disable pre-auth)
{91e647de-...}Private-Information (CONFIDENTIAL)Confidential attribute access
{f30e3bc2-...}GPC-File-Sys-PathGPO access/modification
{00299570-...}Reset-PasswordPassword reset by non-admin
{f3a64788-...}servicePrincipalNameSPN modification (Kerberoasting setup)
{bf967aba-...}User object classAD enumeration
{bf967a86-...}Computer object classAD enumeration
# DCSync detection — the definitive query
index=wineventlog EventCode=4662
| where match(Properties,
    "1131f6aa-9c07-11d1-f79f-00c04fc2dcd2|1131f6ad-9c07-11d1-f79f-00c04fc2dcd2|89e95b76-444d-4c62-991a-0facbeda640c")
| where NOT match(SubjectUserName, "\$$")
| table _time, SubjectUserName, SubjectDomainName, ObjectName

# SPN modification (Kerberoasting setup)
# NOTE: %%14674 = Object Access (includes reads); triage for write operations
index=wineventlog EventCode=4662
| where match(Properties, "f3a64788-5306-11d1-a9c5-0000f80367c1")
| where OperationType="%%14674"
| table _time, SubjectUserName, ObjectName

# Mass AD enumeration (BloodHound)
index=wineventlog EventCode=4662
| where match(Properties, "bf967aba-0de6-11d0-a285-00aa003049e2|bf967a86-0de6-11d0-a285-00aa003049e2")
| bin _time span=5m
| stats count dc(ObjectName) as unique_objects by SubjectUserName, _time
| where unique_objects > 50

45. Policy, System & Process Events

Event IDNameHunt ValueKey Fields
1100Event Logging Service ShutdownAnti-forensics
1102Security Audit Log ClearedAnti-forensicsSubjectUserName
4616System Time ChangedTimestompingSubjectUserName, PreviousTime, NewTime
4688Process CreatedProcess execution trackingNewProcessName, CommandLine, ParentProcessName
4689Process ExitedProcess lifecycleProcessName
4690Duplicate HandleToken manipulationSourceProcessId, TargetProcessId
4692-4695DPAPI OperationsCredential accessSubjectUserName
4696Primary Token AssignedToken manipulationSubjectUserName, NewProcessName
4697Service InstalledPersistenceServiceName, ServiceFileName, ServiceAccount
4698Scheduled Task CreatedPersistenceTaskName, TaskContent (XML)
4699-4702Scheduled Task Modified/Deleted/Enabled/DisabledTask lifecycleTaskName
4703Token Right AdjustedPrivilege manipulationProcessName, EnabledPrivilegeList
4719System Audit Policy ChangedAudit evasionSubjectUserName, CategoryId

46. Event 4688 Deep Dive — Hunting Without Sysmon

Prerequisite: Enable Command Line Logging

GPO: Computer Config → Admin Templates → System → Audit Process Creation → "Include command line in process creation events" = Enabled

Registry: HKLM\SOFTWARE\...\Policies\System\Audit\ProcessCreationIncludeCmdLine_Enabled = 1

Without this setting, 4688 is nearly useless.

Hidden Fields Most Analysts Miss

TokenElevationType

ValueTypeMeaningHunt Value
%%1936Type 1: Full tokenFull admin privilegesIf a regular user has Type 1, investigate
%%1937Type 2: ElevatedUAC elevation occurredExpected for admin tasks
%%1938Type 3: LimitedStandard user rightsNormal — most common

MandatoryLabel (Integrity Level)

ValueLevelSIDWhen
%%4096UntrustedS-1-16-0Almost never seen
%%4097LowS-1-16-4096Protected Mode IE, sandboxed
%%4098MediumS-1-16-8192Standard user processes
%%4099Medium PlusS-1-16-8448Slightly elevated (rare)
%%4100HighS-1-16-12288Admin/elevated processes
%%4101SystemS-1-16-16384SYSTEM-level processes

4688 Hunt Queries (Sysmon-Free Environment)

# Suspicious parent-child (Office spawning shells)
index=wineventlog EventCode=4688
| where match(ParentProcessName, "(?i)\\\\(winword|excel|powerpnt|outlook)\\.exe$")
  AND match(NewProcessName, "(?i)\\\\(cmd|powershell|mshta|wscript|cscript|certutil|regsvr32|rundll32)\\.exe$")
| table _time, Computer, SubjectUserName, ParentProcessName, NewProcessName, CommandLine

# Encoded PowerShell
index=wineventlog EventCode=4688 NewProcessName="*\\powershell.exe"
  (CommandLine="*-enc*" OR CommandLine="*-EncodedCommand*")
| table _time, Computer, SubjectUserName, CommandLine

# Processes from temp/user directories
index=wineventlog EventCode=4688
| where match(NewProcessName, "(?i)\\\\(Temp|tmp|Downloads|AppData)\\\\") AND match(NewProcessName, "\\.exe$")
| table _time, Computer, SubjectUserName, NewProcessName, CommandLine

# Shadow copy deletion (pre-ransomware)
index=wineventlog EventCode=4688
  ((NewProcessName="*\\vssadmin.exe" CommandLine="*delete*shadows*")
   OR (NewProcessName="*\\wmic.exe" CommandLine="*shadowcopy*delete*")
   OR (NewProcessName="*\\bcdedit.exe" CommandLine="*recoveryenabled*no*"))
| table _time, Computer, SubjectUserName, NewProcessName, CommandLine

# Privilege escalation — Full token for non-admin
index=wineventlog EventCode=4688 TokenElevationType="%%1936"
| where NOT match(SubjectUserName, "(?i)SYSTEM|LOCAL SERVICE|NETWORK SERVICE|DWM-|UMFD-")
| where NOT match(SubjectUserName, "\$$")
| stats count by SubjectUserName, Computer, NewProcessName

47. Scheduled Task XML Dissection (Event 4698)

Task XML Structure

<Task>
  <RegistrationInfo>   — Who created it, when, description
  <Triggers>           — WHEN it runs (boot, logon, time, event)
  <Principals>         — WHO it runs as (user, privilege level)
  <Settings>           — Execution settings (hidden, run if missed)
  <Actions>            — WHAT it does (execute command)
</Task>
Key Indicators
# Parse Command from TaskContent XML
index=wineventlog EventCode=4698
| rex field=TaskContent "<Command>(?<task_command>[^<]+)</Command>"
| rex field=TaskContent "<Arguments>(?<task_args>[^<]+)</Arguments>"
| rex field=TaskContent "<UserId>(?<task_user>[^<]+)</UserId>"
| table _time, Computer, SubjectUserName, TaskName, task_command, task_args, task_user

# Hidden tasks
index=wineventlog EventCode=4698
| where match(TaskContent, "<Hidden>true</Hidden>")
| rex field=TaskContent "<Command>(?<cmd>[^<]+)</Command>"
| table _time, Computer, SubjectUserName, TaskName, cmd

# Tasks with RegistrationTrigger (immediate execution)
index=wineventlog EventCode=4698
| where match(TaskContent, "RegistrationTrigger")
| rex field=TaskContent "<Command>(?<cmd>[^<]+)</Command>"
| table _time, Computer, SubjectUserName, TaskName, cmd

# SYSTEM tasks from non-standard paths
index=wineventlog EventCode=4698
| rex field=TaskContent "<Command>(?<cmd>[^<]+)</Command>"
| rex field=TaskContent "<UserId>(?<uid>[^<]+)</UserId>"
| where (uid="S-1-5-18" OR match(uid, "(?i)SYSTEM"))
  AND NOT match(cmd, "(?i)C:\\\\Windows\\\\|C:\\\\Program Files")
| table _time, Computer, TaskName, cmd, uid

48. Share & Network Events

Event IDNameHunt ValueKey Fields
5140Network Share AccessedLateral movementShareName, IpAddress, SubjectUserName
5142Network Share CreatedNew share creationShareName
5145Network Share Object CheckedDetailed share accessShareName, RelativeTargetName, AccessMask
5156WFP Connection AllowedNetwork connection trackingApplication, SourceAddress, DestAddress, Ports
5157WFP Connection BlockedBlocked connectionsApplication, SourceAddress, DestAddress

5145 Access Mask Values

MaskMeaning
0x1ReadData / ListDirectory
0x2WriteData / AddFile
0x4AppendData / AddSubdirectory
0x20Execute / Traverse
0x10000Delete
0x20000ReadControl (read ACL)
0x40000WriteDACL (modify permissions!)
0x80000WriteOwner (take ownership!)

49. Event 5145 Deep Dive — Lateral Movement at File Level

ShareName & RelativeTargetName Patterns

ShareNameRelativeTargetNameIndicates
\\*\ADMIN$PSEXESVC.exePsExec dropping service binary
\\*\IPC$svcctlService Control Manager pipe (PsExec, smbexec)
\\*\IPC$samrSAM Remote pipe (BloodHound, enumeration)
\\*\IPC$lsarpcLSA Remote pipe (enumeration, DCSync prep)
\\*\IPC$drsuapiDRS pipe (DCSync!)
\\*\IPC$atsvcTask Scheduler pipe (atexec)
\\*\IPC$RemCom_communicatonImpacket RemCom pipe
\\*\IPC$spoolssPrint Spooler (PrintNightmare)
\\*\SYSVOLGroups.xmlGPP password hunting
# Comprehensive lateral movement detection via 5145
index=wineventlog EventCode=5145
| eval risk=case(
    match(RelativeTargetName, "(?i)PSEXESVC|RemCom"), "CRITICAL-psexec",
    match(RelativeTargetName, "drsuapi"), "CRITICAL-dcsync",
    RelativeTargetName="svcctl" AND match(ShareName, "\\\\IPC\\$"), "HIGH-service_control",
    RelativeTargetName="atsvc", "HIGH-sched_task",
    match(RelativeTargetName, "(?i)\\.exe$") AND AccessMask="0x2", "HIGH-exe_drop",
    match(ShareName, "\\\\ADMIN\\$") AND AccessMask="0x2", "HIGH-admin_write",
    match(ShareName, "\\\\C\\$"), "MEDIUM-c_drive_access",
    match(RelativeTargetName, "samr|lsarpc|srvsvc"), "MEDIUM-enumeration",
    1=1, "LOW"
  )
| where risk!="LOW"
| table _time, Computer, IpAddress, SubjectUserName, ShareName, RelativeTargetName, risk
| sort risk

50. Directory Service Events

Event IDNameHunt ValueKey Fields
4661Handle to AD Object RequestedAD enumerationObjectType, ObjectName
4662Operation on AD ObjectDCSync, AD manipulationProperties, ObjectName
5136Directory Service Object ModifiedGPO changes, AD modificationsObjectDN, AttributeLDAPDisplayName
5137Directory Service Object CreatedNew AD objectsObjectDN
5138Directory Service Object UndeletedDeleted object recoveryObjectDN
5141Directory Service Object DeletedAD object deletionObjectDN

51. Certificate Services & GPO Events

Event IDNameHunt Value
4886Certificate requestedCertificate request tracking
4887Certificate issuedCheck SAN for impersonation
4888Certificate request deniedFailed attack attempt
4899Certificate template updatedESC4 attack (template modification)
4739Domain Policy ChangedDomain-level policy modification
# GPO Modification Hunting
index=wineventlog EventCode=5136
| where match(ObjectDN, "(?i)groupPolicyContainer") OR match(AttributeLDAPDisplayName, "(?i)gPCFileSysPath|gPLink")
| table _time, SubjectUserName, ObjectDN, AttributeLDAPDisplayName, AttributeValue
PART VI — WINDOWS SYSTEM EVENT LOG

52. Core System Events

Event IDSourceNameHunt Value
1Kernel-GeneralTime ChangedTimestomping at kernel level
6FilterManagerFS Filter LoadFilter driver (rootkit detection)
12Kernel-GeneralSystem StartBoot tracking
13Kernel-GeneralSystem ShutdownShutdown tracking
16Kernel-BootBoot Type (Normal/Safe)Boot mode detection
41Kernel-PowerUnexpected ShutdownCrash or forced shutdown
104EventlogEvent Log ClearedAnti-forensics
7000SCMService Failed to StartService issues
7034SCMService Crashed UnexpectedlyExploitation/instability
7040SCMService Start Type ChangedPersistence (disabled to auto)
7045SCMNew Service InstalledPersistence — critical event

Event 7045 Hunting

High Priority Indicators:
  - ImagePath contains cmd.exe, powershell.exe, or encoded commands
  - ImagePath points to temp directories or user profiles
  - ImagePath contains pipe (|) or redirection (>)
  - Service name is random-looking or very short
  - Account is LocalSystem for a non-Microsoft service
  - ImagePath uses UNC path (\\server\share)

  NOTE: Event 7045 (System log) uses "ImagePath" field.
        Event 4697 (Security log) uses "ServiceFileName" field.

SPL:
  index=wineventlog source="WinEventLog:System" EventCode=7045
  | where NOT match(ImagePath, "(?i)C:\\\\Windows\\\\|C:\\\\Program Files")
  | table _time, Computer, ServiceName, ImagePath, ServiceType, AccountName

Additional System Events

Event IDSourceNameHunt Value
1074User32Shutdown/Restart InitiatedWho shut it down?
1033/1034MsiInstallerProduct install/removalSoftware tracking
11707/11708MsiInstallerInstall success/failurePackage tracking

53. NTLM Operational Log

Event IDNameHunt Value
8001NTLM client blocked auditNTLM usage tracking
8002NTLM server blocked auditNTLM usage on servers
8003NTLM auth from domain controllerDC NTLM usage
8004NTLM auth to domain controllerClient-to-DC NTLM — investigate
Why Track NTLM?
NTLM is legacy and weaker than Kerberos. Pass-the-Hash and NTLM relay attacks exploit NTLM. Any NTLM to a DC from a workstation = investigate.
# NTLM field names vary by Splunk TA; 8004 has DomainName, UserName, Workstation
index=wineventlog source="*NTLM*" EventCode IN (8001,8002,8003,8004)
| stats count by EventCode, Computer, DomainName, UserName | sort - count

54. Print Service & PrintNightmare

Event IDNameHunt Value
307Document printedInsider threat — print volume
316Printer driver installedPrintNightmare exploitation
808Spooler failed to load driverExploitation attempt
842New printer driver installedRemote driver installation
# PrintNightmare Detection
# Field names depend on Splunk TA — check Message field if DriverName/UserName are blank
index=wineventlog source="*PrintService*" EventCode IN (316, 808, 842)
| table _time, Computer, param1, param2, Message

# Also via Sysmon
index=sysmon EventCode=11 TargetFilename="*\\spool\\drivers\\*"
| where NOT match(Image, "(?i)spoolsv\\.exe")
| table _time, Computer, Image, TargetFilename
PART VII — POWERSHELL EVENT LOG

55. PowerShell Operational Events

Event IDNameDescriptionHunt Value
4103Module LoggingPipeline execution details with parametersCommand execution + parameter values
4104Script Block LoggingFull script contentMost valuable for hunting
4105/4106Script Block Start/StopExecution lifecycleExecution tracking
40961/40962PS Console Starting/ReadySession lifecycleSession tracking
800Pipeline ExecutionClassic PS loggingHostApplication shows what launched PS

Script Block Logging (4104) — Suspicious Pattern Hunting

# Download cradles
index=wineventlog EventCode=4104 ScriptBlockText="*DownloadString*"
  OR ScriptBlockText="*DownloadFile*" OR ScriptBlockText="*Invoke-WebRequest*"
  OR ScriptBlockText="*Net.WebClient*" OR ScriptBlockText="*Start-BitsTransfer*"

# Credential access
index=wineventlog EventCode=4104 ScriptBlockText="*Invoke-Mimikatz*"
  OR ScriptBlockText="*sekurlsa*" OR ScriptBlockText="*kerberos::*"
  OR ScriptBlockText="*lsadump*" OR ScriptBlockText="*token::elevate*"

# Evasion (AMSI bypass)
index=wineventlog EventCode=4104 ScriptBlockText="*AmsiUtils*"
  OR ScriptBlockText="*amsiInitFailed*" OR ScriptBlockText="*AmsiScanBuffer*"
  OR ScriptBlockText="*VirtualAlloc*" OR ScriptBlockText="*-ExecutionPolicy Bypass*"

# Encoding/obfuscation
index=wineventlog EventCode=4104 ScriptBlockText="*FromBase64String*"
  OR ScriptBlockText="*ToBase64String*" OR ScriptBlockText="*DeflateStream*"
  OR ScriptBlockText="*GzipStream*"

# Lateral movement
index=wineventlog EventCode=4104 ScriptBlockText="*Invoke-Command*"
  OR ScriptBlockText="*Enter-PSSession*" OR ScriptBlockText="*Invoke-WmiMethod*"

# Persistence
index=wineventlog EventCode=4104 ScriptBlockText="*Register-ScheduledTask*"
  OR ScriptBlockText="*New-Service*" OR ScriptBlockText="*Set-ItemProperty*HKLM*Run*"

PowerShell Severity Classification

LevelPatterns
CRITICALInvoke-Mimikatz, sekurlsa::, Invoke-DllInjection, Invoke-Shellcode, AmsiUtils, amsiInitFailed, token::elevate, privilege::debug
HIGHDownload + Execute chains (IWR + IEX), Base64 + execution, VirtualAlloc + CreateThread (shellcode), -WindowStyle Hidden -ExecutionPolicy Bypass
MEDIUMInvoke-Command to remote hosts, Get-ADUser large queries, Registry Run key mods, Service creation
LOWStandard admin tasks (Get-Process, Get-Service), file operations, network testing

56. PowerShell Logging Deep Dive

4104 vs 4103 vs 800 — What Each Captures

EventSource LogCapturesBest ForMisses
4104PS/OperationalFull script text (ScriptBlockText)Seeing exactly what code ranRuntime variable values
4103PS/OperationalPipeline execution with parameter valuesWhat variables resolved toCustom functions, .NET calls
800Windows PowerShell (classic)Pipeline summary, HostApplicationQuick overview, unusual PS launchersScript internals

Recommendation: Enable ALL THREE. 4104 gives you the code. 4103 gives you what the code did with what values. 800 gives you the execution context.

ScriptBlockId — Reassembling Fragmented Scripts

Attackers Exploit Script Fragmentation
Large scripts are split across multiple 4104 events. If a keyword like "DownloadString" spans two message parts, a single-event search will MISS it.
# Reassemble fragmented scripts
index=wineventlog EventCode=4104
| sort ScriptBlockId, MessageNumber
| stats list(ScriptBlockText) as parts values(MessageTotal) as total by ScriptBlockId, Computer
| eval full_script=mvjoin(parts, "")
| where match(full_script, "(?i)DownloadString|Invoke-Expression|FromBase64|Invoke-Mimikatz|AmsiUtils")
| table Computer, ScriptBlockId, total, full_script

Key Insight: -EncodedCommand

Event 4104 captures the DECODED script, not the Base64 blob. Sysmon Event 1 captures the original -enc command line. Use both: 4104 for decoded content, Sysmon 1 for the original command.


57. AMSI Bypass Detection

# Direct AMSI bypass strings
index=wineventlog EventCode=4104
| where match(ScriptBlockText, "(?i)AmsiUtils|amsiInitFailed|AmsiScanBuffer|AmsiOpenSession|amsi\\.dll")
| table _time, Computer, ScriptBlockText

# Reflection-based AMSI bypass
index=wineventlog EventCode=4104
| where match(ScriptBlockText, "(?i)\\[Reflection\\.Assembly\\]|DynamicMethod|Runtime\\.InteropServices")
  AND match(ScriptBlockText, "(?i)Amsi|Marshal")
| table _time, Computer, ScriptBlockText

# Non-PowerShell loading PS engine (unmanaged PS — bypasses CLM entirely)
index=sysmon EventCode=7 ImageLoaded="*\\System.Management.Automation.dll"
| where NOT match(Image, "(?i)powershell|pwsh|wsmprovhost|svchost|mmc")
| table _time, Computer, Image, ImageLoaded

# CLM bypass via PowerShell v2
index=sysmon EventCode=1 Image="*\\powershell.exe"
| where match(CommandLine, "(?i)-version\\s+2|-v\\s+2")
| table _time, Computer, User, CommandLine
PART VIII — APPLICATION & OPERATIONAL LOGS

58. Application Error & Installer Events

Event IDSourceNameHunt Value
1000Application ErrorApplication crashExploitation indicator
1001Windows Error ReportingCrash detailsExploitation details (faulting module)
1002Application HangApplication hungDoS or exploitation
1033/1034MsiInstallerMSI install/removal completedSoftware tracking
11707/11708MsiInstallerInstall success/failurePackage tracking

59. Windows Defender Events

Event IDNameHunt Value
1006Malware DetectedKnown malware found
1007Malware Action TakenRemediation action
1008Malware Action FailedFailed remediation — investigate!
1009Restore from QuarantineRestored malicious file
1013Malware History DeletedAnti-forensics
1116Threat DetectedReal-time detection
1117Action on ThreatBlock/quarantine action
5001Real-time Protection DisabledDefense evasion!
5004Real-time Protection Config ChangedSettings manipulation
5007Configuration ChangedExclusion added, settings modified
5010/5012Scanning DisabledReduced protection
# Detect Defender being disabled or tampered
index=wineventlog source="WinEventLog:Microsoft-Windows-Windows Defender/Operational"
  EventCode IN (5001, 5004, 5007, 5010, 5012, 1013)
| table _time, Computer, EventCode, Message

# Detect exclusion additions
index=wineventlog source="WinEventLog:Microsoft-Windows-Windows Defender/Operational" EventCode=5007
| search Message="*Exclusion*"
| table _time, Computer, Message

60. Task Scheduler Operational Events

Event IDNameHunt Value
100Task StartedExecution tracking
106Task RegisteredNew task — persistence
107Task TriggeredTask fired on trigger
118Triggered by Computer StartupBoot persistence
119Triggered by LogonLogon persistence
140Task UpdatedModification
141Task RemovedCleanup
200Action StartedShows actual command executed
201Action CompletedExecution finished

61. WMI Events

Event IDNameHunt Value
5857WMI Provider LoadedProvider activity
5858WMI Query ErrorFailed operations
5860WMI Temporary Event CreatedEvent subscription
5861WMI Permanent Event CreatedPersistent event subscription — investigate!

62. BITS Client Events

Event IDNameHunt Value
3BITS Job CreatedNew transfer — download/exfil
4BITS Job TransferredTransfer completed
59BITS Started TransferringActive transfer
61BITS ErrorTransfer failure

63. Remote Desktop Events

TerminalServices-LocalSessionManager/Operational

Event IDNameHunt Value
21Session Logon SucceededRDP logon success
22Shell Start NotificationRDP shell started
23Session Logoff SucceededRDP logoff
24Session DisconnectedRDP disconnect
25Session ReconnectedRDP reconnect

TerminalServices-RDPClient/Operational

Event IDNameHunt Value
1024RDP ConnectingConnection attempt
1025RDP ConnectedConnection established
1026RDP DisconnectedDisconnected

64. Windows Firewall Events

Event IDNameHunt Value
2003Firewall Profile ChangedProfile/settings change
2004Firewall Rule AddedNew rule — possible opening
2005Firewall Rule ModifiedRule change
2006Firewall Rule DeletedRule removed
2033All Rules DeletedComplete rule wipe — evasion

65. AppLocker Events

Event IDNameLogHunt Value
8002Exe/DLL was allowedEXE and DLLAllowed execution
8003Exe/DLL would have been blockedEXE and DLLAudit mode bypass
8004Exe/DLL was blockedEXE and DLLBlocked execution
8005Script/MSI was allowedScript and MSIAllowed script
8006Script/MSI would have been blockedScript and MSIAudit mode bypass
8007Script/MSI was blockedScript and MSIBlocked script

66. DNS Client Events

Event IDNameHunt Value
3006DNS Query Completed (by type)DNS resolution tracking
3008DNS Query CompletedQuery result
3020DNS Response ReceivedResponse data
PART IX — SYSMON EVENT LOG

67. Sysmon Complete Event ID Reference

IDNameDescriptionHunt Value
1ProcessCreateProcess creation with full command lineCore hunting event
2FileCreateTimeFile creation timestamp changedTimestomping detection
3NetworkConnectTCP/UDP connection detectedProcess network activity
4Sysmon State ChangeSysmon started/stoppedAnti-forensics if stopped
5ProcessTerminateProcess terminatedLifecycle tracking
6DriverLoadDriver loaded into kernelRootkit/BYOVD detection
7ImageLoadModule (DLL) loadedDLL side-loading, injection
8CreateRemoteThreadThread in remote processProcess injection
9RawAccessReadRaw disk accessMBR read, forensic tool
10ProcessAccessProcess handle openedCredential dumping (LSASS)
11FileCreateFile created/overwrittenDropped files, staging
12RegistryEvent (Create/Delete)Registry key created/deletedPersistence
13RegistryEvent (ValueSet)Registry value setPersistence
14RegistryEvent (Rename)Registry key/value renamedEvasion
15FileCreateStreamHashAlternate Data Stream createdADS hiding data
16Sysmon Config ChangeConfiguration modifiedAnti-forensics
17PipeEvent (Created)Named pipe createdC2 communication
18PipeEvent (Connected)Named pipe connectedLateral movement
19WmiEvent (Filter)WMI filter registeredPersistence
20WmiEvent (Consumer)WMI consumer registeredPersistence
21WmiEvent (Binding)Filter-consumer boundPersistence
22DNSEvent (Query)DNS query by processProcess-level DNS
23FileDelete (Archived)File deleted (copy kept)Anti-forensics
24ClipboardChangeClipboard changedData theft
25ProcessTamperingProcess image modifiedHollowing/herpaderping
26FileDeleteDetectedFile deleted (logged only)Deletion tracking
27FileBlockExecutableExecutable blockedBlocked exec tracking
28FileBlockShreddingFile shredding blockedAnti-forensics prevention
29FileExecutableDetectedExecutable droppedNew executable tracking
255ErrorSysmon errorHealth monitoring

68. Event 10 — LSASS Credential Theft Detection

GrantedAccess Values for LSASS

ValueMeaningThreat Level
0x0010PROCESS_VM_READLOW
0x0400PROCESS_QUERY_INFORMATIONLOW
0x1000PROCESS_QUERY_LIMITED_INFORMATIONLOW
0x1010QUERY_LIMITED + VM_READHIGH possible cred dump
0x1038QUERY_LIMITED + VM_WRITE + VM_READ + VM_OPERATIONCRITICAL credential dump
0x1438QUERY_LIMITED + QUERY_INFO + VM_OPERATION + VM_READ + VM_WRITECRITICAL modified Mimikatz
0x143AQUERY_LIMITED + QUERY_INFO + CREATE_THREAD + VM_OPS + VM_RWCRITICAL Mimikatz signature
0x0810SUSPEND_RESUME + VM_READHIGH nanodump, custom dumpers
0x1FFFFFPROCESS_ALL_ACCESSCRITICAL full access

CallTrace Field — Most Underused Field in Sysmon

CallTrace shows HOW the handle was opened

The magic keyword is UNKNOWN — this indicates unbacked memory (code not loaded from disk = injected/shellcode).

# Normal (AV checking LSASS):
C:\Windows\SYSTEM32\ntdll.dll+12345|C:\Windows\System32\KERNELBASE.dll+6789|
C:\Program Files\Windows Defender\MsMpEng.exe+abc

# Mimikatz sekurlsa::logonpasswords:
C:\Windows\SYSTEM32\ntdll.dll+9c5a4|C:\Windows\System32\KERNELBASE.dll+2cd86|
UNKNOWN(00000000XXXXXXXX)              ← UNBACKED MEMORY = shellcode/injected

# Procdump:
...|C:\Windows\System32\dbghelp.dll+xxx|C:\SysinternalsSuite\procdump64.exe+xxx

# comsvcs.dll MiniDump:
...|C:\Windows\System32\comsvcs.dll+xxx|C:\Windows\System32\rundll32.exe+xxx

Comprehensive LSASS Detection with Risk Scoring

index=sysmon EventCode=10 TargetImage="*\\lsass.exe"
| where NOT SourceImage IN (
    "C:\\Windows\\system32\\csrss.exe",
    "C:\\Windows\\system32\\wininit.exe",
    "C:\\Windows\\system32\\WerFault.exe",
    "C:\\Windows\\system32\\svchost.exe",
    "C:\\Windows\\system32\\lsass.exe"
  )
| where NOT match(SourceImage, "(?i)MsMpEng\\.exe|MpCmdRun\\.exe|MsSense\\.exe")
| eval risk=case(
    match(CallTrace, "UNKNOWN"), "CRITICAL-shellcode",
    GrantedAccess="0x1FFFFF", "CRITICAL-full_access",
    GrantedAccess="0x143a" OR GrantedAccess="0x143A", "CRITICAL-mimikatz",
    GrantedAccess="0x1438", "CRITICAL-credential_dump",
    GrantedAccess="0x1038", "HIGH-memory_rw",
    GrantedAccess="0x1010", "HIGH-memory_read",
    GrantedAccess="0x0810", "HIGH-suspend_read",
    match(CallTrace, "dbghelp|dbgcore"), "HIGH-debugger",
    match(CallTrace, "comsvcs"), "HIGH-minidump",
    GrantedAccess="0x1410", "MEDIUM-query_read",
    GrantedAccess="0x0040", "MEDIUM-dup_handle",
    1=1, "LOW-other"
  )
| where NOT risk="LOW-other"
| table _time, Computer, SourceImage, GrantedAccess, risk, CallTrace
| sort risk

Beyond LSASS — Other Event 10 Targets

TargetWhyAttack
csrss.exeHandles process/thread creationInjecting = kernel-adjacent access
winlogon.exeSecure logon, credential providerToken theft, credential interception
services.exeService Control ManagerService manipulation, privesc

69. Event 1 — Advanced Process Analysis

# Command line length analysis (long = encoded/obfuscated)
index=sysmon EventCode=1
| eval cmd_len=len(CommandLine)
| where cmd_len > 500
| table _time, Computer, User, Image, cmd_len, CommandLine | sort - cmd_len

# OriginalFileName vs IMAGE (masquerading detection)
index=sysmon EventCode=1
| where isnotnull(OriginalFileName) AND OriginalFileName!=""
| eval image_name=replace(Image, ".*\\\\", "")
| eval orig_lower=lower(OriginalFileName), image_lower=lower(image_name)
| where orig_lower != image_lower
| table _time, Computer, Image, OriginalFileName, CommandLine

# Processes from temp/user directories
index=sysmon EventCode=1
| where match(CurrentDirectory, "(?i)\\\\Temp\\\\|\\\\tmp\\\\|\\\\Downloads\\\\|\\\\AppData\\\\Local\\\\Temp")
| table _time, Computer, User, Image, CurrentDirectory, CommandLine

# Rare process hashes (long-tail analysis)
index=sysmon EventCode=1
| stats count dc(Computer) as host_count by Hashes, Image
| where host_count < 3 AND count < 5
| sort count | head 50

70. Event 7 — DLL Side-Loading & BYOVD

DLL Side-Loading Detection

# Unsigned DLLs loaded by signed executables
index=sysmon EventCode=7 Signed="false" SignatureStatus!="Valid"
| where match(Image, "(?i)C:\\\\Program Files|C:\\\\Windows")
| where NOT match(ImageLoaded, "(?i)C:\\\\Windows\\\\|C:\\\\Program Files\\\\")
| stats count by Image, ImageLoaded, Signed | sort count

Common Side-Loading Pairs

Legitimate EXEHijacked DLL
OneDrive.exeversion.dll, secur32.dll
Teams.exeVarious (Electron app)
bginfo.exeVarious (SysInternals)
msbuild.exeversion.dll
Narrator.exeMSTTSLocEnUS.DLL (UAC bypass)

Event 6 (DriverLoad) — BYOVD Detection

# Unsigned drivers
index=sysmon EventCode=6 Signed="false"
| table _time, Computer, ImageLoaded, Hashes, Signed

# Drivers from user-writable paths
index=sysmon EventCode=6
| where match(ImageLoaded, "(?i)\\\\Users\\\\|\\\\Temp\\\\|\\\\Downloads\\\\|\\\\AppData\\\\")
| table _time, Computer, ImageLoaded, Hashes, Signed

# Known vulnerable driver names
index=sysmon EventCode=6
| where match(ImageLoaded, "(?i)RTCore64\\.sys|gdrv\\.sys|dbutil_2_3\\.sys|cpuz141\\.sys|iqvw64e\\.sys|mhyprot2\\.sys|kprocesshacker\\.sys|procexp152\\.sys")
| table _time, Computer, ImageLoaded, Hashes, Signed

Resource: LOLDrivers Project (loldrivers.io) — known-vulnerable driver hash list.


71. Event 22 — Per-Process DNS Hunting

# Rare DNS queries (long-tail analysis)
index=sysmon EventCode=22
| stats count dc(Computer) as hosts by QueryName, Image
| where hosts < 3 AND count < 5 | sort count | head 50

# Non-browser processes making external DNS queries
index=sysmon EventCode=22
| where NOT match(Image, "(?i)chrome|firefox|edge|msedge|teams|outlook|svchost")
| where NOT match(QueryName, "(?i)\\.microsoft\\.com|\\.windows\\.com|\\.office\\.com")
| stats count by Image, QueryName | sort count | head 100

# rundll32 making DNS queries (almost always suspicious)
index=sysmon EventCode=22 Image="*\\rundll32.exe"
| table _time, Computer, Image, QueryName, QueryResults

# DGA detection via high unique domain count
index=sysmon EventCode=22
| eval domain_parts=split(QueryName, ".") | eval sld=mvindex(domain_parts, -2) | eval sld_len=len(sld)
| where sld_len > 10
| stats dc(QueryName) as unique_domains count by Image, Computer
| where unique_domains > 20 | sort - unique_domains

72. Event 25 — Process Tampering

TechniqueMITREHow It Works
Process HollowingT1055.012Create suspended process → unmap original → map malicious code → resume
Process HerpaderpingCreate file with malware → create process → modify file on disk → close
Process GhostingCreate temp file → mark for deletion → write payload → create section → delete file
# ALL process tampering events
index=sysmon EventCode=25
| table _time, Computer, Image, Type, User | sort - _time

# Correlate tampering with subsequent activity
index=sysmon EventCode=25
| rename Computer as host, ProcessId as tampered_pid
| join type=left host tampered_pid
  [search index=sysmon (EventCode=3 OR EventCode=1)
   | rename Computer as host, ProcessId as tampered_pid
   | table _time, host, tampered_pid, Image, DestinationIp, CommandLine]
| table _time, host, Image, Type, DestinationIp, CommandLine

73. Event 3 — Network Connection Hunting

# LOLBins making outbound connections
index=sysmon EventCode=3
| where match(Image, "(?i)\\\\(certutil|mshta|regsvr32|rundll32|bitsadmin|msiexec|wmic|cmstp|msbuild|powershell|cmd)\\.exe$")
| where NOT match(DestinationIp, "^(10\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.|192\\.168\\.|127\\.)")
| table _time, Computer, Image, DestinationIp, DestinationPort, User

# Svchost to unusual ports (injection indicator)
index=sysmon EventCode=3 Image="*\\svchost.exe" Initiated=true
| where DestinationPort NOT IN (80, 443, 53, 123, 389, 636, 445, 135, 88, 5985, 5986)
| where NOT match(DestinationIp, "^(10\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.|192\\.168\\.|127\\.)")
| stats count by DestinationIp, DestinationPort | sort count

# Process-level beaconing detection
index=sysmon EventCode=3 Initiated=true
| where NOT match(DestinationIp, "^(10\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.|192\\.168\\.|127\\.)")
| bin _time span=5m
| stats count by Image, DestinationIp, DestinationPort, _time, Computer
| streamstats current=f last(_time) as prev_time by Image, DestinationIp, Computer
| eval delta=_time-prev_time
| stats avg(delta) as avg_interval, stdev(delta) as stdev_interval, count
  by Image, DestinationIp, DestinationPort, Computer
| where count > 20 AND stdev_interval < (avg_interval * 0.2)
| eval jitter_pct=round((stdev_interval/avg_interval)*100,2)
| sort jitter_pct

74. Events 17/18 — Named Pipes

Event 17 = Pipe CREATED. Event 18 = Pipe CONNECTED. Not logged by default — requires Sysmon.

Why Pipes Matter for Hunting

ReasonDetail
No files on diskPure IPC — no artifacts without Sysmon
Network capableSMB pipes span machines (port 445)
Blends inLegitimate Windows uses hundreds of pipes
C2 channelCobalt Strike SMB beacon, Meterpreter, etc.
Lateral movementPsExec, smbexec, atexec all use pipes

Pipe Types

TypeFormatUse
Local\\.\pipe\PipeNameSame-machine IPC. CS post-ex, credential relay.
Remote (SMB)\\TargetHost\pipe\PipeNameCross-machine over port 445. PsExec, WMI, DCE/RPC.

C2 Framework Pipes

ToolPipe PatternsNotes
Cobalt Strikemsagent_##, MSSE-*-server, postex_*, postex_ssh_*, status_*Defaults — configurable via Malleable C2
Cobalt Strike (newer)mojo.*, interprocess.*, win_svcChrome-mimicking and service pipes
Metasploitmeterpreter*, msf_*Default Meterpreter pipes
CovenantgruntsvcDefault Covenant C2
Various RATsDserNamePipe, SearchTextHarvesterGeneric malware pipes

Lateral Movement Pipes

ToolPipeBehavior
PsExecPSEXESVCDrops service binary to ADMIN$ → creates service → communicates via pipe
Impacket RemComRemCom_communicatonSimilar to PsExec, open-source
CsExeccsexecPsExec alternative
PAExecPAExec*PsExec alternative (open-source)
smbexecsvcctlService control pipe for remote service manipulation

Credential Attack Pipes

PipeAttack
spoolssPrinterBug / SpoolSample coercion
efsrpcPetitPotam NTLM coercion
lsarpcLSA operations, DCSync preparation
drsuapiDirectory Replication — DCSync
netdfsDFS coercion

Expected Windows Pipes (Know Normal to Find Evil)

ALWAYS PRESENT:
  lsass, ntsvcs, scerpc, browser, wkssvc, srvsvc, winreg,
  samr, netlogon, svcctl, atsvc, epmapper, spoolss,
  tapsrv, InitShutdown, protected_storage, ROUTER

KEY INSIGHT: When Event 18 shows Image="System" connecting to a pipe,
that is a REMOTE connection over SMB. Local pipe access shows the
actual process path.

Detection Queries

# Known malicious pipe names (comprehensive)
index=sysmon EventCode IN (17, 18)
| where match(PipeName, "(?i)\\\\msagent_|\\\\MSSE-.*-server|\\\\postex_|\\\\status_|\\\\mojo\\.|\\\\interprocess\\.|meterpreter|msf_|gruntsvc|\\\\RemCom_|DserNamePipe|SearchTextHarvester|csexec|PAExec|win_svc")
| table _time, Computer, EventCode, Image, PipeName

# Remote pipe connections (lateral movement indicator)
# Image="System" means connection came over SMB from another host
index=sysmon EventCode=18 Image="System"
| stats count by PipeName, Computer | sort - count

# Pipe creation by unusual processes
index=sysmon EventCode=17
| where NOT match(Image, "(?i)svchost|lsass|services|spoolsv|SearchIndexer|System|wininit|csrss|smss")
| stats count by Image, PipeName | sort count | head 30

# Rarest pipes (long-tail — your best hunting query)
index=sysmon EventCode=17
| stats count dc(Computer) as hosts by PipeName
| where hosts < 3 | sort count | head 30

# Risk-scored pipe detection
index=sysmon EventCode IN (17, 18)
| eval pipe_risk=case(
    match(PipeName, "(?i)\\\\msagent_|\\\\postex_|\\\\status_|\\\\MSSE-.*-server|\\\\mojo\\.|\\\\interprocess\\."), "CRITICAL-cobalt_strike",
    match(PipeName, "(?i)\\\\meterpreter|\\\\msf_"), "CRITICAL-metasploit",
    match(PipeName, "(?i)\\\\PSEXESVC"), "HIGH-psexec",
    match(PipeName, "(?i)\\\\RemCom_comm|\\\\csexec|\\\\PAExec"), "HIGH-lateral_move",
    match(PipeName, "(?i)\\\\gruntsvc|\\\\DserNamePipe|\\\\SearchTextHarvester|\\\\win_svc"), "HIGH-c2_framework",
    match(PipeName, "(?i)\\\\drsuapi") AND EventCode=18 AND Image="System", "CRITICAL-dcsync_pipe",
    1=1, "LOW"
  )
| where pipe_risk!="LOW"
| table _time, Computer, EventCode, Image, PipeName, pipe_risk | sort pipe_risk

Live System Pipe Enumeration

# PowerShell — list all active pipes
Get-ChildItem \\.\pipe\ | Select-Object Name
[System.IO.Directory]::GetFiles("\\\\.\\pipe\\") | ForEach-Object { Split-Path $_ -Leaf }

# Sysinternals
pipelist.exe

# Compare against known-good baseline → new pipes = investigate

75. Event 15 — Alternate Data Streams

# Files downloaded from internet (Zone.Identifier)
index=sysmon EventCode=15
| where match(TargetFilename, "Zone\\.Identifier")
| rex field=TargetFilename "(?<base_file>.+):Zone\\.Identifier"
| table _time, Computer, Image, base_file, Hash

# Suspicious ADS (non-Zone.Identifier = actually suspicious)
index=sysmon EventCode=15
| where NOT match(TargetFilename, "Zone\\.Identifier")
| table _time, Computer, Image, TargetFilename, Hash | sort - _time

76. Cross-Event Correlation Patterns

Pattern: Process Injection Chain

Event 1 (attacker process) → Event 8 (CreateRemoteThread) → Event 10 (ProcessAccess) → Event 3 (C2 connection)

index=sysmon EventCode IN (1, 8, 10, 3) Computer="TARGET_HOST"
| sort _time | table _time, EventCode, Image, TargetImage, SourceImage, DestinationIp, CommandLine

Pattern: Credential Dump → Lateral Movement

Event 10 (LSASS access) → Event 1 (recon) → Event 1 (lateral movement) → Event 3 (outbound)

index=sysmon Computer="SOURCE_HOST"
| where (EventCode=10 AND TargetImage="*\\lsass.exe")
  OR (EventCode=1 AND (Image="*\\net.exe" OR Image="*\\wmic.exe" OR Image="*\\psexec*"))
  OR (EventCode=3 AND match(Image, "(?i)wmic|psexec"))
| sort _time | table _time, EventCode, Image, TargetImage, CommandLine, DestinationIp

Pattern: Macro → Download → Execute → Persist

Event 1 (winword → cmd/ps) → Event 22 (DNS query) → Event 11 (file dropped) → Event 1 (payload run) → Event 13 (Run key)

index=sysmon Computer="TARGET_HOST"
| where (EventCode=1 AND ParentImage="*\\winword.exe")
  OR EventCode=22
  OR (EventCode=11 AND match(TargetFilename, "(?i)\\\\Temp\\\\|\\\\Downloads\\\\"))
  OR (EventCode=13 AND match(TargetObject, "\\\\Run\\\\"))
| sort _time | table _time, EventCode, Image, ParentImage, TargetFilename, TargetObject, QueryName, CommandLine

Pattern: BYOVD → EDR Kill

Event 6 (vulnerable driver loaded) → Event 1 (exploit tool) → Event 5 (EDR terminated)

index=sysmon Computer="TARGET_HOST"
| where (EventCode=6 AND Signed="true") OR EventCode=1 OR EventCode=5
| sort _time | table _time, EventCode, Image, ImageLoaded, ParentImage, Signed, Signature, CommandLine

77. Sysmon Configuration Best Practices

Golden Rules

  1. Log everything, then exclude. Never start with include-only.
  2. Never exclude: Events 1, 8, 10, 11, 13, 25
  3. Be careful with Event 3: Exclude by process (chrome, edge), not destination.
  4. Aggressive Event 7 exclusions: System32 DLLs, known signed DLLs.

Event Volume Estimation (per endpoint per day)

EventVolumeNotes
Event 1 (Process)500–5,000Core — always log
Event 3 (Network)10,000–100,000+Needs filtering!
Event 7 (DLL Load)10,000–50,000+Needs filtering!
Event 10 (ProcessAccess)100–1,000Manageable
Event 11 (FileCreate)1,000–10,000Moderate
Event 13 (Registry)500–5,000Moderate
Event 22 (DNS)5,000–50,000Can be noisy
Total per endpoint~30K–200K/dayPlan SIEM ingestion accordingly

Recommended Configs

ConfigSourceStyle
SwiftOnSecuritysysmon-configStarting point
Olaf Hartongsysmon-modularModular
ION-Stormsysmon-configVerbose
# Install with config
sysmon64.exe -accepteula -i sysmonconfig.xml

# Update config (no reinstall)
sysmon64.exe -c sysmonconfig.xml

# Verify running
sc query Sysmon64

Appendix A — Critical Event ID Quick Reference

The most important event IDs for threat hunting and incident response.

IDSourceNameWhy It Matters
1SysmonProcessCreateCore hunting event — process trees, CLI args
3SysmonNetworkConnectProcess-level network connections
6SysmonDriverLoadBYOVD / rootkit detection
7SysmonImageLoadDLL side-loading, .NET CLR injection
8SysmonCreateRemoteThreadProcess injection
10SysmonProcessAccessLSASS credential dumping
11SysmonFileCreateDropped files, payload staging
13SysmonRegistryEvent (ValueSet)Persistence via registry
17/18SysmonPipeEventC2 named pipes, lateral movement
22SysmonDNSEventPer-process DNS resolution
25SysmonProcessTamperingProcess hollowing / herpaderping
1102SecurityAudit Log ClearedAnti-forensics
4624SecurityLogon SuccessLateral movement, account tracking
4625SecurityLogon FailureBrute force, password spray
4648SecurityExplicit CredentialsRunAs, credential theft
4662SecurityAD Object OperationDCSync detection
4672SecuritySpecial PrivilegesPrivilege escalation, SeDebugPrivilege
4688SecurityProcess CreatedProcess tracking (without Sysmon)
4697SecurityService InstalledPersistence
4698SecurityScheduled Task CreatedPersistence
4719SecurityAudit Policy ChangedDefense evasion
4720SecurityUser Account CreatedBackdoor accounts
4728SecurityMember Added to GroupPrivilege escalation
4768SecurityKerberos TGT (AS-REQ)AS-REP Roasting
4769SecurityKerberos TGSKerberoasting (RC4 0x17)
4771SecurityKerberos Pre-Auth FailPassword spraying
5140SecurityShare AccessedLateral movement
5145SecurityShare Object CheckedFile-level lateral movement
104SystemEvent Log ClearedAnti-forensics
7045SystemNew Service InstalledPersistence — critical event
4104PowerShellScript Block LoggingFull script content capture
5001DefenderReal-time Protection OffDefense evasion
5007DefenderConfig ChangedExclusions added
1116DefenderThreat DetectedMalware/tool identification
5861WMI-ActivityPermanent Event CreatedWMI persistence
21TS-LocalSessionRDP Session LogonRDP lateral movement
2004FirewallRule AddedFirewall manipulation

Appendix B — Glossary

TermDefinition
ACLAccess Control List — permissions on an object
ADSAlternate Data Stream — hidden NTFS file stream
AMSIAntimalware Scan Interface — scans scripts before execution
AS-REPAuthentication Service Reply — Kerberos TGT response
AS-REQAuthentication Service Request — Kerberos TGT request
BITSBackground Intelligent Transfer Service
BYOVDBring Your Own Vulnerable Driver
C2Command and Control
CLMConstrained Language Mode (PowerShell restriction)
CLRCommon Language Runtime (.NET execution engine)
COMComponent Object Model
CLSIDClass Identifier — unique ID for a COM object
DCSyncAttack that replicates AD credentials via DRS protocol
DGADomain Generation Algorithm
DPAPIData Protection API — encrypts user/system secrets
DRSDirectory Replication Service
EQLEvent Query Language (Elastic)
ETWEvent Tracing for Windows — kernel telemetry framework
EVTXWindows Event Log file format
GPOGroup Policy Object
IPC$Inter-Process Communication share (named pipe access)
JA3/JA3STLS Client/Server fingerprinting
JARMActive TLS server fingerprinting
KQLKusto Query Language (Elastic KQL or Sentinel KQL)
LAPSLocal Administrator Password Solution
LOLBinLiving Off the Land Binary
LSASSLocal Security Authority Subsystem Service
MFTMaster File Table (NTFS)
NTLMNT LAN Manager authentication protocol
PtHPass-the-Hash
PtTPass-the-Ticket
RBCDResource-Based Constrained Delegation
SDBShim Database (Application Compatibility)
SigmaOpen standard for SIEM detection rules
SPNService Principal Name (Kerberos)
SPLSearch Processing Language (Splunk)
SSPSecurity Support Provider
TGSTicket Granting Service (Kerberos service ticket)
TGTTicket Granting Ticket (Kerberos initial ticket)
TTPTactics, Techniques, and Procedures
UACUser Account Control
WEFWindows Event Forwarding
WMIWindows Management Instrumentation
WinRMWindows Remote Management (WS-Management)

Dedication

To my homies in cell block 121B — you made coming into the office way better than it could've been.

To my wife Kekai — thanks for putting up with all my sh!t.

And to my kids, Kawai and Bishop — go to sleep, or I will read this entire book to you, word for word, from front to back; then we'll talk in depth about why every organization needs a threat intel capability.

I love all of you.

About the Author

Steven Stone is a Cyber Threat Intelligence analyst, Threat Hunter, and former Detection Engineer supporting government networks. With over 15 years of experience in DoD operations, he operates across the full spectrum of defensive cyber, from intelligence analysis and threat hunting to detection engineering and incident response.

Steven currently serves as a CTI analyst, where he builds and maintains threat hunting programs, develops detection content for enterprise SIEMs, tracks advanced threat actors, and leads intelligence-driven hunt operations. His daily work lives at the intersection of Splunk, Elastic, threat intelligence platforms, and the Windows event logs that this manual is built from.

He holds multiple industry certifications including the CISSP, CISM, several SANS certifications (GCTI, GCFA, GCIH, GCFE, GNFA), and CompTIA credentials (SecurityX/CASP+, CySA+, PenTest+, Security+). He also built and maintains redsheepsec.com, an intelligence sharing platform that tracks ransomware campaigns, emerging CVEs, and threat actor activity, and publishes intelligence reports and hunt guides on current and developing threats.

Contact

Email: contact@redsheepsec.com
Web: redsheepsec.com
LinkedIn: linkedin.com/in/steven-st0n3/