Security Lab
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.
Design
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.
Sources
Data Sources
| Source | Provides |
|---|---|
| Sysmon Operational | Process creation (1), network (3), file create (11), pipe create/connect (17/18) |
| Security log | 4688 process creation with command line, 4697/7045 service install, 4672/4673 privilege use |
| PowerShell Operational | 4104 script-block logging |
| System log | 7045 new service |
| Application log | Posture 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.
Detection
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.
Maps to ATT&CK T1134 (Access Token Manipulation). Tune by baselining the
pipes your legitimate services open, then alert on the rest.
Detection
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.
Maps to ATT&CK T1003.002 (OS Credential Dumping: SAM). High fidelity;
legitimate hive exports are rare outside backup software.
Detection
Rogue Services and MSI Abuse
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.
MSI Abuse
A non-admin installing an MSI silently points at the AlwaysInstallElevated
misconfiguration. ATT&CK T1548.
Reference
Detection Summary
| Technique | Primary signal | ATT&CK |
|---|---|---|
| Named-pipe impersonation (potato) | Sysmon 17/18 under a service account | T1134 |
| SAM / SYSTEM hive theft | 4688 reg save / esentutl / VSS | T1003.002 |
| Rogue service | 7045 / 4697 new service | T1543.003 |
| AlwaysInstallElevated | 4688 msiexec /quiet | T1548 |
| Token privilege abuse | 4672 special privileges to an unusual account | T1134 |
| Credential files | 4663 on sensitive files; 4104 script-block | T1552 |
Operations
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.
Reflection
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.
Tools
Tooling Used
Skills