Privilege Escalation via Named Pipe Impersonation
Adversaries may escalate privileges by abusing named pipe impersonation, a technique often used with tools like Metasploit's meterpreter getsystem command, where a process writes to a named pipe to facilitate a SYSTEM-token handoff.
This rule identifies a privilege escalation attempt via named pipe impersonation, a technique where an adversary leverages a framework such as Metasploit’s meterpreter getsystem command to gain elevated privileges. This involves a process, typically cmd.exe or PowerShell.exe, writing to a named pipe. The detection logic focuses on identifying scenarios where a service-context client interacts with a named-pipe server, enabling the server to impersonate the client’s token, thereby achieving privilege escalation. The rule is designed to detect this activity by monitoring for specific command-line arguments associated with named pipe creation and usage, indicative of an attempt to exploit this vulnerability.
Attack Chain
- An adversary gains initial access to a system, possibly through phishing or exploiting a remote vulnerability.
- The adversary executes a reconnaissance phase to identify potential privilege escalation vectors.
- The attacker uses a tool like Metasploit’s meterpreter and attempts to execute the
getsystemcommand. getsystemattempts various techniques to gain SYSTEM privileges. One of these techniques involves named pipe impersonation.- A process, such as
cmd.exeorpowershell.exe, writes to a named pipe using theechocommand with redirection (> \\\\.\\pipe\\*). - A service running as SYSTEM impersonates the client’s token.
- The attacker gains SYSTEM privileges and can perform administrative tasks.
- The adversary leverages their elevated privileges to achieve their final objective, such as data exfiltration or lateral movement.
Impact
Successful exploitation allows attackers to execute commands with SYSTEM privileges, giving them full control over the compromised system. This can lead to sensitive data theft, installation of malware, lateral movement to other systems within the network, and ultimately, complete compromise of the affected environment. The high risk score reflects the severity of this attack.
Recommendation
- Deploy the provided Sigma rule to your SIEM to detect privilege escalation attempts via named pipe impersonation (detects
process.args : "echo" and process.args : ">" and process.args : "\\\\.\\pipe\\*"). - Enable Sysmon process creation logging with command-line arguments to ensure the Sigma rule functions correctly (Data Source: Sysmon).
- Review and restrict local administrator and service creation rights to prevent untrusted tooling from creating SYSTEM service clients (Post-incident hardening).
- Investigate any alerts generated by this rule, focusing on the parent process, token context, and follow-on activity to determine if the named pipe activity is legitimate or malicious (investigation steps outlined in note section).
- Continuously monitor Windows Security Event Logs for suspicious process creation events (Data Source: Windows Security Event Logs).
Detection coverage 2
Detect Privilege Escalation via Named Pipe Impersonation
highDetects privilege escalation attempts via named pipe impersonation by monitoring for specific command-line arguments in cmd or PowerShell.
Detect Privilege Escalation via Named Pipe Impersonation - Original File Name
highDetects privilege escalation attempts via named pipe impersonation by monitoring for specific command-line arguments in cmd or PowerShell based on original file name.
Detection queries are available on the platform. Get full rules →