9. Detection_EventIDs_Splunk
9. Detection_EventIDs_Splunk
1. BLUF (Bottom Line Up Front)
This reference maps every recon technique from Scenarios 1–4 to its corresponding Windows Event IDs, Sysmon IDs, network-layer indicators, and Splunk detection queries. Use this as a cross-reference when building detections or validating that your pentest activity is (or isn't) being logged.
2. Architecture
graph TB
subgraph "Recon Activity"
EXT["Scenario 1
External Scan"]
INT["Scenario 2
Internal No-Creds"]
AUTH["Scenario 3
Authenticated Pivot"]
C2["Scenario 4
C2 SOCKS"]
end
subgraph "Detection Sources"
FW["Firewall Logs"]
IDS["IDS/IPS
Suricata / Snort"]
SIEM["SIEM
Splunk / Sentinel"]
EDR["EDR
Defender / CrowdStrike"]
DC["Domain Controller
Windows Event Logs"]
SYSMON["Sysmon"]
end
EXT --> FW
EXT --> IDS
INT --> IDS
INT --> DC
INT --> SYSMON
AUTH --> DC
AUTH --> EDR
AUTH --> SYSMON
C2 --> IDS
C2 --> EDR
C2 --> FW
FW --> SIEM
IDS --> SIEM
EDR --> SIEM
DC --> SIEM
SYSMON --> SIEM
style SIEM fill:#ff9999
style EDR fill:#99ccff
style DC fill:#ccffcc
3. Event ID Reference by Technique
Port Scanning (Scenarios 1, 2, 3)
| Event ID | Source | What it logs | Triggered by |
| 5156 | Windows Filtering Platform | Allowed network connection | Any successful TCP connect scan hit |
| 5157 | Windows Filtering Platform | Blocked network connection | Scan hitting closed/filtered ports |
| 5152 | Windows Filtering Platform | Dropped packet | Firewall dropping scan probes |
| 4625 | Security | Failed logon | Scan probing SMB/RDP/WinRM triggering auth failure |
| Sysmon 3 | Sysmon | Network connection | Outbound scan from compromised host (pivot) |
| Suricata | IDS | ET SCAN Potential TCP Port Scan | 50+ SYN packets to distinct ports in 120s |
| Zeek | NSM | conn.log entries | Every TCP/UDP connection attempt |
SMB / Null Session Enumeration (Scenario 2)
| Event ID | Source | What it logs | Triggered by |
| 4625 | Security (DC) | Failed logon (Status: 0xC000006D) | smbclient -U '%' -N -L //DC_IP |
| 4624 | Security (DC) | Successful logon (Type 3, anonymous) | Null session accepted |
| 4634 | Security (DC) | Logoff | Null session closed |
| 5140 | Security (DC) | Network share accessed | IPC$ share access via null session |
| 5145 | Security (DC) | Share object access check | Share/file-level access attempts |
| Sysmon 3 | Sysmon | Network connection to port 445 | Any SMB enumeration tool |
LDAP / AD Enumeration (Scenario 2)
| Event ID | Source | What it logs | Triggered by |
| 1644 | Directory Service (DC) | Expensive LDAP query | Large ldapsearch queries (requires registry key) |
| 4662 | Security (DC) | Object accessed in AD | Reading AD objects (users, groups, GPOs) |
| 4661 | Security (DC) | Handle to AD object requested | BloodHound/SharpHound querying AD |
| 5136 | Security (DC) | Directory service object modified | Shouldn't fire on reads — if it does, it's a write |
| 2889 | Directory Service (DC) | LDAP bind over unsigned/unencrypted channel | Anonymous or simple LDAP bind |
| Sysmon 3 | Sysmon | Network connection to port 389/636 | Any LDAP enumeration tool |
DNS Enumeration (Scenarios 1, 2)
| Event ID | Source | What it logs | Triggered by |
| Sysmon 22 | Sysmon | DNS query | dig, nslookup, nmap --script dns-srv-enum |
| DNS Debug Log | DNS Server | All DNS queries | dig SRV _ldap._tcp.domain.local |
| 770-771 | DNS Analytical | DNS query received/response sent | Zone transfer (AXFR) attempts |
Kerberos Activity (Scenario 2)
| Event ID | Source | What it logs | Triggered by |
| 4768 | Security (DC) | TGT requested (AS-REQ) | kerbrute user enumeration, AS-REP roasting |
| 4769 | Security (DC) | TGS requested (TGS-REQ) | Kerberoasting (GetUserSPNs.py) |
| 4771 | Security (DC) | Kerberos pre-auth failed | kerbrute brute force, password spray |
| 4770 | Security (DC) | TGT renewed | Normal activity, but anomalous volume = suspicious |
LLMNR / NBT-NS / Responder (Scenario 2)
| Event ID | Source | What it logs | Triggered by |
| Sysmon 3 | Sysmon | Network connection (UDP 5355/137) | Responder answering LLMNR/NBT-NS |
| Sysmon 22 | Sysmon | DNS query failure → LLMNR fallback | Client falling back to LLMNR |
| 4648 | Security | Logon with explicit credentials | NTLMv2 hash captured by Responder |
| 4624 | Security | Logon Type 3 (Network) | NTLM relay succeeding |
| Suricata | IDS | ET POLICY LLMNR Query Response | Responder spoofing responses |
SSH / Tunnel / Pivot Activity (Scenarios 3, 4)
| Event ID | Source | What it logs | Triggered by |
| 4624 | Security | Logon Type 10 (RemoteInteractive) or Type 3 | SSH via OpenSSH on Windows |
| Sysmon 1 | Sysmon | Process create | ssh, chisel, ligolo-agent executing |
| Sysmon 3 | Sysmon | Network connection | Outbound tunnel to attacker IP |
| Sysmon 7 | Sysmon | Image loaded | Proxy DLLs loaded (proxychains on Windows) |
| OpenSSH log | /var/log/auth.log (Linux) | SSH session opened | ssh -D 1080 user@PIVOT |
| 4688 | Security | Process creation | New process with command-line logging enabled |
Service Enumeration / Banner Grabbing (Scenarios 1, 2, 3)
| Event ID | Source | What it logs | Triggered by |
| 4625 | Security | Failed logon | Service probe triggering auth dialog |
| IIS/Apache logs | Web server | HTTP request | curl, nikto, feroxbuster, dirsearch |
| Sysmon 3 | Sysmon | Inbound connection | Any service probe |
| Suricata | IDS | ET SCAN Nmap Scripting Engine | NSE script detection |
4. Splunk Detection Queries
Port Scan Detection
// Detect horizontal port scan (one source → many dest ports)
index=firewall OR index=sysmon sourcetype=WinEventLog:Security EventCode=5156
| stats dc(dest_port) as unique_ports, count as total_conns by src_ip
| where unique_ports > 20 AND total_conns > 50
| sort -unique_ports
| table src_ip, unique_ports, total_conns
// Detect vertical scan (one source → many hosts, same port)
index=firewall OR index=sysmon sourcetype=WinEventLog:Security EventCode=5156
| stats dc(dest_ip) as unique_hosts by src_ip, dest_port
| where unique_hosts > 10
| sort -unique_hosts
| table src_ip, dest_port, unique_hosts
// Detect slow/distributed scan (GHOST tier — expand time window)
index=firewall OR index=sysmon sourcetype=WinEventLog:Security
(EventCode=5156 OR EventCode=5157)
| bucket _time span=1h
| stats dc(dest_port) as unique_ports, count(eval(EventCode=5157)) as blocked by src_ip, _time
| where unique_ports > 5
| streamstats sum(unique_ports) as cumulative_ports by src_ip
| where cumulative_ports > 30
| table _time, src_ip, unique_ports, cumulative_ports, blocked
Failed Connection Ratio (Best Scan Indicator)
// High failed-to-successful connection ratio = scan
index=firewall action IN ("allowed", "blocked", "denied", "drop")
| eval success=if(action="allowed",1,0), fail=if(action!="allowed",1,0)
| stats sum(success) as successes, sum(fail) as failures, dc(dest_port) as unique_ports by src_ip
| eval fail_ratio=round(failures/(successes+failures)*100,1)
| where fail_ratio > 70 AND unique_ports > 10
| sort -fail_ratio
| table src_ip, successes, failures, fail_ratio, unique_ports
SMB Null Session / Anonymous Access
// Detect anonymous/null SMB logon attempts
index=wineventlog sourcetype=WinEventLog:Security EventCode=4624 Logon_Type=3
(TargetUserName="ANONYMOUS LOGON" OR TargetUserName="Guest" OR TargetUserName="")
| stats count by src_ip, TargetUserName, TargetDomainName, ComputerName
| where count > 3
| table src_ip, TargetUserName, ComputerName, count
// IPC$ share access (null session enumeration)
index=wineventlog sourcetype=WinEventLog:Security EventCode=5140 ShareName="\\\\*\\IPC$"
SubjectUserName="ANONYMOUS LOGON"
| stats count by IpAddress, ShareName, SubjectUserName
| table IpAddress, ShareName, count
LDAP Enumeration
// Large LDAP queries (requires Event ID 1644 enabled on DC)
index=wineventlog sourcetype=WinEventLog:Directory\ Service EventCode=1644
| where SearchTimeInMs > 1000 OR EntriesReturned > 100
| stats count, avg(EntriesReturned) as avg_entries by ClientIP, Filter
| sort -avg_entries
| table ClientIP, Filter, count, avg_entries
// Bulk AD object reads
index=wineventlog sourcetype=WinEventLog:Security EventCode=4662
| stats dc(ObjectName) as unique_objects by SubjectUserName, SubjectIP
| where unique_objects > 50
| sort -unique_objects
| table SubjectUserName, SubjectIP, unique_objects
Kerberos Enumeration
// AS-REP Roasting / User enumeration (4768 with failure)
index=wineventlog sourcetype=WinEventLog:Security EventCode=4768 Status!=0x0
| stats count by IpAddress, TargetUserName, Status
| where count > 10
| sort -count
| table IpAddress, TargetUserName, Status, count
// Kerberoasting (TGS requests for service accounts)
index=wineventlog sourcetype=WinEventLog:Security EventCode=4769
TicketEncryptionType=0x17
| stats dc(ServiceName) as unique_spns, count by IpAddress, TargetUserName
| where unique_spns > 3
| sort -unique_spns
| table IpAddress, TargetUserName, unique_spns, count
// Password spray (many failed pre-auths in short window)
index=wineventlog sourcetype=WinEventLog:Security EventCode=4771
| bucket _time span=10m
| stats dc(TargetUserName) as unique_users, count by IpAddress, _time
| where unique_users > 5
| sort -unique_users
| table _time, IpAddress, unique_users, count
LLMNR / Responder Detection
// Unexpected LLMNR responses (Responder spoofing)
index=sysmon EventCode=3 DestPort=5355 Initiated=false
| stats count by SourceIp, DestIp
| where count > 5
| table SourceIp, DestIp, count
// IDS alert for Responder
index=ids_alerts alert_signature="*LLMNR*" OR alert_signature="*NBT-NS*" OR alert_signature="*Responder*"
| stats count by src_ip, alert_signature
| table src_ip, alert_signature, count
Tunnel / C2 / Pivot Detection
// Long-lived outbound connections (tunnels)
index=sysmon EventCode=3 Initiated=true
| eval duration=round((_time - strptime(UtcTime,"%Y-%m-%d %H:%M:%S.%3N"))/60,0)
| where duration > 30
| stats count, values(DestPort) as ports by SourceIp, DestIp, Image
| table Image, SourceIp, DestIp, ports, count
// Suspicious process creating outbound connections (Chisel, Ligolo, SSH tunnels)
index=sysmon EventCode=1
(Image="*chisel*" OR Image="*ligolo*" OR Image="*agent*" OR CommandLine="*ssh*-D*" OR CommandLine="*socks*")
| stats count by Image, CommandLine, User, ComputerName
| table ComputerName, User, Image, CommandLine
// DNS tunneling / high DNS query volume
index=sysmon EventCode=22
| stats dc(QueryName) as unique_queries, count by Image, SourceIp
| where unique_queries > 500
| sort -unique_queries
| table Image, SourceIp, unique_queries, count
Web Directory Enumeration
// Brute-force directory enumeration (high 404/403 rate)
index=web sourcetype=access_combined
| stats count(eval(status=404)) as c404, count(eval(status=403)) as c403, count as total by clientip
| eval error_ratio=round((c404+c403)/total*100,1)
| where error_ratio > 80 AND total > 50
| sort -total
| table clientip, total, c404, c403, error_ratio
5. Quick Reference: Sysmon Event IDs for Recon
| Sysmon ID | Event | Recon Relevance |
| 1 | Process Create | Detects recon tool execution (nmap, chisel, responder) |
| 3 | Network Connection | Every scan probe, tunnel, and enumeration connection |
| 7 | Image Loaded | DLL injection (proxychains), tool DLLs |
| 10 | Process Access | Credential dumping tools reading LSASS |
| 11 | File Create | Tool binaries dropped on pivot host |
| 22 | DNS Query | DNS enumeration, zone transfer attempts |
| 23 | File Delete | Attacker cleaning up tool binaries |
6. Enable Enhanced Logging (Prerequisites)
Not all Event IDs fire by default. Key GPO/registry settings to enable:
| What to enable | How |
| 5156/5157 (WFP) | Advanced Audit Policy → Object Access → Audit Filtering Platform Connection |
| 4688 (Process cmd line) | Administrative Templates → System → Audit Process Creation → Include command line |
| 1644 (LDAP queries) | HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics → set 15 Field Engineering = 5 |
| 5140/5145 (Share access) | Advanced Audit Policy → Object Access → Audit File Share / Detailed File Share |
| Sysmon | Install Sysmon with SwiftOnSecurity config |
| DNS Debug | DNS Server → Properties → Debug Logging → enable |