Detecting Privilege Escalation in Splunk

This lab is the defender's half of my Windows Privilege Escalation write-up. It takes the same techniques and builds the detections: the Windows and Sysmon events they generate, the Splunk searches that surface them, and the saved alerts that turn a line in a log into a signal someone acts on.

Scope: a home SOC lab. A Windows VM runs Sysmon and command-line process auditing; logs ship to Splunk, where the searches below run as scheduled alerts. The SPL is illustrative: index names and field names depend on the add-ons in use (Splunk Add-on for Microsoft Windows, Sysmon TA), so treat them as a starting point to tune, not copy-paste rules.

The Detection Pipeline

Detections are only as good as the data under them. The chain is: generate the events on the endpoint, ship them to Splunk, search them, and alert. If command-line auditing and Sysmon are not on, most of these searches have nothing to match.

Windows host Sysmon + 4688 Universal Forwarder Splunk index Alert SPL Endpoint → forwarder → index → scheduled alert

Data Sources

SourceProvides
Sysmon OperationalProcess creation (1), network (3), file create (11), pipe create/connect (17/18)
Security log4688 process creation with command line, 4697/7045 service install, 4672/4673 privilege use
PowerShell Operational4104 script-block logging
System log7045 new service
Application logPosture findings and a heartbeat from Windows Health Monitor: Defender off (3006), firewall profile off (3008), logs cleared (3011), heartbeat (1000)

Command-line process auditing (the command line on 4688) is the single setting that makes most of these searches work, since it reveals what a process was asked to do, not just that it ran.

Named-Pipe Impersonation (Potato)

The potato family creates a named pipe to coerce and impersonate a SYSTEM token. A service account opening an unusual pipe is the signal. Sysmon Event ID 17 captures the pipe creation.

# Sysmon pipe create under a service account index=win_sysmon EventCode=17 | search User IN ("NT AUTHORITY\\NETWORK SERVICE","NT AUTHORITY\\LOCAL SERVICE","*\\IUSR","*MSSQL*") | stats count values(PipeName) AS pipes values(Image) AS images min(_time) AS first_seen BY host, User | where count > 0

Maps to ATT&CK T1134 (Access Token Manipulation). Tune by baselining the pipes your legitimate services open, then alert on the rest.

SAM / SYSTEM Hive Theft

Copying the registry hives for offline credential cracking shows up in the command line of reg.exe, esentutl.exe, or vssadmin.

# Hive export via reg save / esentutl / VSS index=win_security EventCode=4688 | search (New_Process_Name="*\\reg.exe" AND Process_Command_Line="*save*sam*") OR (Process_Command_Line="*reg* save *hklm\\sam*") OR (New_Process_Name="*\\esentutl.exe" AND Process_Command_Line="*vss*") OR (Process_Command_Line="*vssadmin* create shadow*") | table _time, host, Account_Name, New_Process_Name, Process_Command_Line

Maps to ATT&CK T1003.002 (OS Credential Dumping: SAM). High fidelity; legitimate hive exports are rare outside backup software.

Rogue Services and MSI Abuse

# New service installed index=win_security EventCode=7045 | table _time, host, Service_Name, Service_File_Name, Service_Account | sort - _time

Rogue Service

A service pointing at a script or a binary in a user-writable path is a classic escalation and persistence step. ATT&CK T1543.003.

# AlwaysInstallElevated MSI as SYSTEM index=win_security EventCode=4688 New_Process_Name="*\\msiexec.exe" | search Process_Command_Line="*/quiet*" OR Process_Command_Line="*/qn*" | stats count BY host, Account_Name, Process_Command_Line

MSI Abuse

A non-admin installing an MSI silently points at the AlwaysInstallElevated misconfiguration. ATT&CK T1548.

Detection Summary

TechniquePrimary signalATT&CK
Named-pipe impersonation (potato)Sysmon 17/18 under a service accountT1134
SAM / SYSTEM hive theft4688 reg save / esentutl / VSST1003.002
Rogue service7045 / 4697 new serviceT1543.003
AlwaysInstallElevated4688 msiexec /quietT1548
Token privilege abuse4672 special privileges to an unusual accountT1134
Credential files4663 on sensitive files; 4104 script-blockT1552

From Search to Alert

  • Each search is saved as a scheduled alert, run on a short interval over a rolling window.
  • Throttling (suppression) stops one noisy host from firing the same alert repeatedly.
  • Known-good activity is allowlisted first: backup software that touches hives, deployment tools that install MSIs, admin jump hosts.
  • Each alert carries the ATT&CK ID and the host, so triage starts with context instead of a bare event.

The goal is a short list of high-fidelity alerts, not a wall of noise. A detection that fires fifty times a day for legitimate admin work gets muted and stops being a detection, so tuning is the real work, not writing the first search.

What This Lab Demonstrates

Pairing this with the privilege-escalation write-up shows the full loop: I can find a vector, and I can build the detection that catches it. That is the point of doing both: hardening removes what it can, and detection covers what is left. The work maps directly to the SC-200 and CySA+ material I'm studying, and to the Splunk and Sysmon tooling I run in the lab.

Tooling Used

Splunk • SPL • Sysmon • Windows Event Log • Universal Forwarder • MITRE ATT&CK • PowerShell logging

Skills Demonstrated

Detection Engineering • SIEM • Splunk • SPL • Sysmon • Windows Event IDs • MITRE ATT&CK • Alert Tuning • Threat Detection • Log Analysis

Back to Projects