title: "Windows Service Triggers: Enumeration and Abuse" section: "Windows" sectionSlug: "windows-hardening" sourcePath: "src/windows-hardening/windows-local-privilege-escalation/service-triggers.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/windows-hardening/windows-local-privilege-escalation/service-triggers.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#
Windows Service Triggers: Enumeration and Abuse#
Windows Service Triggers allow the Service Control Manager (SCM) to start/stop a service when a condition occurs (e.g., an IP address becomes available, a named pipe connection is attempted, an ETW event is published). Even when you lack SERVICE_START rights on a target service, you may still be able to start it by causing its trigger to fire.[1]
This page focuses on attacker-friendly enumeration and low-friction ways to activate common triggers.
Tip: Starting a privileged built-in service (e.g., RemoteRegistry, WebClient/WebDAV, EFS) can expose new RPC/named-pipe listeners and unlock further abuse chains.
Enumerating Service Triggers#
- sc.exe (local)
- List a service's triggers:
sc.exe qtriggerinfo <ServiceName>
- List a service's triggers:
- Registry (local)
- Triggers live under:
HKLM\SYSTEM\CurrentControlSet\Services\<ServiceName>\TriggerInfo - Dump recursively:
reg query HKLM\SYSTEM\CurrentControlSet\Services\<ServiceName>\TriggerInfo /s
- Triggers live under:
- Win32 API (local)
- Call QueryServiceConfig2 with SERVICE_CONFIG_TRIGGER_INFO (8) to retrieve SERVICE_TRIGGER_INFO.
- Docs: QueryServiceConfig2[W/A] and SERVICE_TRIGGER/SERVICE_TRIGGER_SPECIFIC_DATA[2]
- Call QueryServiceConfig2 with SERVICE_CONFIG_TRIGGER_INFO (8) to retrieve SERVICE_TRIGGER_INFO.
- RPC over MS‑SCMR (remote)
- PowerShell (bulk enumeration)
- Quickly list every service exposing a
TriggerInfokey:Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Services' | Where-Object { Test-Path "$($_.PSPath)\TriggerInfo" } | ForEach-Object { sc.exe qtriggerinfo $_.PSChildName }
- Quickly list every service exposing a
- PowerShell (programmatic)
- James Forshaw's
NtObjectManagermodule exposesGet-Win32ServiceTriggerfor parsing trigger metadata without scrapingsc.exeoutput.
- James Forshaw's
High-Value Trigger Types and How to Activate Them#
Network Endpoint Triggers#
These start a service when a client attempts to talk to an IPC endpoint. Useful to low-priv users because the SCM will auto-start the service before your client can actually connect.[1]
-
Named pipe trigger
- Behavior: A client connection attempt to \.\pipe<PipeName> causes the SCM to start the service so it can begin listening.
- Activation (PowerShell):
$pipe = new-object System.IO.Pipes.NamedPipeClientStream('.', 'PipeNameFromTrigger', [System.IO.Pipes.PipeDirection]::InOut) try { $pipe.Connect(1000) } catch {} $pipe.Dispose() - Internals note: named-pipe triggers are backed by
npsvctrig.sys, a filesystem minifilter that watches for opens against registered trigger pipe names. This is why the open attempt can start the service even before the service itself has created/listened on the pipe.[5] - See also: Named Pipe Client Impersonation for post-start abuse.
-
RPC endpoint trigger (Endpoint Mapper)
- Behavior: Querying the Endpoint Mapper (EPM, TCP/135) for an interface UUID associated with a service causes the SCM to start it so it can register its endpoint.
- Activation (Impacket):
# Queries local EPM; replace UUID with the service interface GUID python3 rpcdump.py @127.0.0.1 -uuid <INTERFACE-UUID>
Custom (ETW) Triggers#
A service can register a trigger bound to an ETW provider/event. If no additional filters (keyword/level/binary/string) are configured, any event from that provider will start the service.[1]
- Example (WebClient/WebDAV): provider {22B6D684-FA63-4578-87C9-EFFCBE6643C7}[6]
- List trigger:
sc.exe qtriggerinfo webclient - Verify provider is registered:
logman query providers | findstr /I 22b6d684-fa63-4578-87c9-effcbe6643c7 - Emitting matching events typically requires code that logs to that provider; if no filters are present, any event suffices.
- Minimal C shape for firing the provider (when no additional ETW filters are configured):
GUID g = {0x22B6D684,0xFA63,0x4578,{0x87,0xC9,0xEF,0xFC,0xBE,0x66,0x43,0xC7}}; REGHANDLE h; EVENT_DESCRIPTOR d; EventRegister(&g, NULL, NULL, &h); EventDescCreate(&d, 1, 0, 0, 4, 0, 0, 0); EventWrite(h, &d, 0, NULL); EventUnregister(h);
- List trigger:
Group Policy Triggers#
Subtypes: Machine/User. On domain-joined hosts where the corresponding policy exists, the trigger runs at boot. gpupdate alone won’t trigger without changes, but:[1]
- Activation:
gpupdate /force- If the relevant policy type exists, this reliably causes the trigger to fire and start the service.
IP Address Available#
Fires when the first IP is obtained (or last is lost). Often triggers at boot.[1]
- Activation: Toggle connectivity to retrigger, e.g.:
netsh interface set interface name="Ethernet" admin=disabled netsh interface set interface name="Ethernet" admin=enabled
Device Interface Arrival#
Starts a service when a matching device interface arrives. If no data item is specified, any device matching the trigger subtype GUID will fire the trigger. Evaluated at boot and upon hot‑plug.[1]
- Activation: Attach/insert a device (physical or virtual) that matches the class/hardware ID specified by the trigger subtype.
Domain Join State#
Despite confusing MSDN wording, this evaluates domain state at boot:[1]
- DOMAIN_JOIN_GUID → start the service if domain-joined
- DOMAIN_LEAVE_GUID → start the service only if NOT domain-joined
System State Change – WNF (undocumented)#
Some services use undocumented WNF-based triggers (SERVICE_TRIGGER_TYPE 0x7). Activation requires publishing the relevant WNF state; specifics depend on the state name. Research background: Windows Notification Facility internals.
Aggregate Service Triggers (undocumented)#
Observed on Windows 11 for some services (e.g., CDPSvc). The aggregated configuration is stored in:
- HKLM\SYSTEM\CurrentControlSet\Control\ServiceAggregatedEvents
A service’s Trigger value is a GUID; the subkey with that GUID defines the aggregated event. Triggering any constituent event starts the service.[1]
Firewall Port Event (quirks and DoS risk)#
A trigger scoped to a specific port/protocol has been observed to start on any firewall rule change (disable/delete/add), not just the specified port. Worse, configuring a port without a protocol can corrupt BFE startup across reboots, cascading into many service failures and breaking firewall management. Treat with extreme caution.[1]
Practical Workflow#
- Enumerate triggers on interesting services (RemoteRegistry, WebClient, EFS, …):
sc.exe qtriggerinfo <Service>reg query HKLM\SYSTEM\CurrentControlSet\Services\<Service>\TriggerInfo /s
- If a Network Endpoint trigger exists:
- Named pipe → attempt a client open to \.\pipe<PipeName>
- RPC endpoint → perform an Endpoint Mapper lookup for the interface UUID
- If an ETW trigger exists:
- Check provider and filters with
sc.exe qtriggerinfo; if no filters, any event from that provider will start the service
- For Group Policy/IP/Device/Domain triggers:
- Use environmental levers:
gpupdate /force, toggle NICs, hot-plug devices, etc.
Related#
- After starting a privileged service via a Named Pipe trigger, you may be able to impersonate it:
Named Pipe Client Impersonation
Quick command recap#
- List triggers (local):
sc.exe qtriggerinfo <Service> - Registry view:
reg query HKLM\SYSTEM\CurrentControlSet\Services\<Service>\TriggerInfo /s - Win32 API:
QueryServiceConfig2(..., SERVICE_CONFIG_TRIGGER_INFO, ...) - RPC remote (Titanis):
Scm.exe qtriggers - ETW provider check (WebClient):
logman query providers | findstr /I 22b6d684-fa63-4578-87c9-effcbe6643c7
Gotchas / Operator Notes#
- Check the service start type first with
sc.exe qc <Service>. If it isDISABLED, firing the trigger is not enough; you must first find a way to change the configuration. - Trigger-start services may stop again after they become idle. If your follow-on action depends on a short-lived listener (RPC/named pipe/WebDAV), trigger and consume it immediately.
sc.exe qtriggerinfodoes not fully understand every undocumented trigger type. For aggregate triggers on newer Windows builds, confirm the backing GUID and constituent events inHKLM\SYSTEM\CurrentControlSet\Control\ServiceAggregatedEvents.
Detection and Hardening Notes#
- Baseline and audit TriggerInfo across services. Also review HKLM\SYSTEM\CurrentControlSet\Control\ServiceAggregatedEvents for aggregate triggers.
- Monitor for suspicious EPM lookups for privileged service UUIDs and named-pipe connection attempts that precede service starts.
- Restrict who can modify service triggers; treat unexpected BFE failures after trigger changes as suspicious.
References#
- [1] There’s More than One Way to Trigger a Windows Service (TrustedSec)
- [2] QueryServiceConfig2 function (Win32 API)
- [3] MS-SCMR: Service Control Manager Remote Protocol – QueryServiceConfig2
- [4] TrustedSec Titanis (SCM trigger enumeration)
- [5] Reversing npsvctrig.sys - Named Pipe Service Triggers (Inbits)
- [6] Starting WebClient Service Programmatically (Tyranid)