Detect Port Monitors in CrowdStrike LogScale
Adversaries may use port monitors to run an adversary-supplied DLL during system boot for persistence or privilege escalation. A port monitor can be set through the AddMonitor API call to set a DLL to be loaded at startup. This DLL can be located in C:\Windows\System32 and will be loaded and run by the print spooler service, spoolsv.exe, under SYSTEM level permissions on boot. Alternatively, an arbitrary DLL can be loaded if permissions allow writing a fully-qualified pathname for that DLL to the Driver value of an existing or new arbitrarily named subkey of HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors.
MITRE ATT&CK
- Tactic
- Persistence Privilege Escalation
- Technique
- T1547 Boot or Logon Autostart Execution
- Sub-technique
- T1547.010 Port Monitors
- Canonical reference
- https://attack.mitre.org/techniques/T1547/010/
LogScale Detection Query
// Detection 1: Registry modification to Print Monitors key
#event_simpleName="AsepValueUpdate" OR #event_simpleName="RegistryKeyCreated"
| TargetObject = /\\Control\\Print\\Monitors\\/i
| table([_time, ComputerName, UserName, TargetObject, NewValue, ImageFileName, CommandHistory])
// Detection 2: Suspicious DLL registered in Print Monitors Driver value
#event_simpleName="AsepValueUpdate"
| TargetObject = /\\Control\\Print\\Monitors\\.*\\Driver/i
| NewValue = /\.dll$/i
| table([_time, ComputerName, UserName, TargetObject, NewValue, ImageFileName])
// Detection 3: Suspicious child process spawned by spoolsv.exe
#event_simpleName="ProcessRollup2"
| ParentBaseFileName = /spoolsv\.exe/i
| ParentBaseFileName != /splwow64\.exe/i
| ParentBaseFileName != /PrintIsolationHost\.exe/i
| ParentBaseFileName != /printfilterpipelinesvc\.exe/i
| table([_time, ComputerName, UserName, FileName, CommandLine, ParentBaseFileName, MD5HashData, SHA256HashData])
// Detection 4: Suspicious DLL written to System32 by non-trusted process
#event_simpleName="NewExecutableWritten" OR #event_simpleName="PeFileWritten"
| TargetFileName = /C:\\Windows\\System32\\.*\.dll/i
| ImageFileName != /TiWorker\.exe/i
| ImageFileName != /TrustedInstaller\.exe/i
| ImageFileName != /msiexec\.exe/i
| ImageFileName != /svchost\.exe/i
| table([_time, ComputerName, UserName, TargetFileName, ImageFileName, CommandLine, MD5HashData, SHA256HashData])
| sort(field=_time, order=desc) CrowdStrike LogScale CQL queries detecting T1547.010 Port Monitor persistence via four detection vectors: Print Monitors registry key modification events (AsepValueUpdate), Driver value DLL registration, unusual child processes of spoolsv.exe via ProcessRollup2, and suspicious DLL file writes to System32 by non-trusted processes. Includes hash fields for IOC enrichment.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate print vendor software (HP Smart, Canon PRINT, Epson iPrint) registering port monitor DLLs during printer setup on corporate endpoints
- Windows print spooler service (spoolsv.exe) launching printing pipeline processes like XPS Document Writer components that may not match the exclusion list
- Automated patch management or configuration management agents deploying updated system DLLs to System32 outside of standard Windows Update channels
Other platforms for T1547.010
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Port Monitor Registry Key Creation
Expected signal: Sysmon Event ID 13: Registry Value Set with TargetObject=HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\TestMonitor_df00tech\Driver, Details=localspl.dll, Image=reg.exe. Security Event ID 4688 with CommandLine containing reg add.
- Test 2DLL Drop in System32 Simulating Port Monitor Payload
Expected signal: Sysmon Event ID 11: File Create with TargetFilename=C:\Windows\System32\df00tech_test_monitor.dll, Image=cmd.exe. DeviceFileEvents with ActionType=FileCreated, FolderPath starting with C:\Windows\System32.
- Test 3PowerShell AddMonitor API Simulation via Registry
Expected signal: Sysmon Event ID 12: Registry Key Created for PSTestMonitor subkey. Sysmon Event ID 13: Registry Value Set for Driver value. Sysmon Event ID 1: Process Create for powershell.exe with the full command line. PowerShell ScriptBlock Log Event ID 4104 with the registry manipulation commands.
References (7)
- https://attack.mitre.org/techniques/T1547/010/
- https://www.defcon.org/images/defcon-22/dc-22-presentations/Bloxham/DEFCON-22-Brady-Bloxham-Windows-API-Abuse-UPDATED.pdf
- https://learn.microsoft.com/en-us/windows/win32/printdocs/addmonitor
- https://technet.microsoft.com/en-us/sysinternals/bb963902
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceregistryevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1547.010/T1547.010.md
- https://github.com/SigmaHQ/sigma/tree/master/rules/windows/registry/registry_set
Unlock Pro Content
Get the full detection package for T1547.010 including response playbook, investigation guide, and atomic red team tests.