T1547.010 Microsoft Sentinel · KQL

Detect Port Monitors in Microsoft Sentinel

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/

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
let MonitorRegPath = @"HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors";
DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has "Control\\Print\\Monitors"
| where ActionType in ("RegistryValueSet", "RegistryKeyCreated")
| extend RegistryValueName = tostring(RegistryValueData)
| extend SuspiciousDLL = RegistryValueData endswith ".dll"
| project Timestamp, DeviceName, AccountName, ActionType, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessFileName, InitiatingProcessCommandLine, SuspiciousDLL
| sort by Timestamp desc;
DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName =~ "spoolsv.exe"
| where FileName !in~ ("splwow64.exe", "PrintIsolationHost.exe", "printfilterpipelinesvc.exe")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, FolderPath, InitiatingProcessFileName
| sort by Timestamp desc;
DeviceFileEvents
| where Timestamp > ago(24h)
| where FolderPath startswith @"C:\Windows\System32"
| where FileName endswith ".dll"
| where InitiatingProcessFileName !in~ ("TiWorker.exe", "TrustedInstaller.exe", "msiexec.exe", "svchost.exe")
| where ActionType == "FileCreated"
| project Timestamp, DeviceName, AccountName, FileName, FolderPath, InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc
high severity high confidence

Detects port monitor persistence via three signals: (1) Registry modifications to the Print\Monitors key indicating a new port monitor DLL registration, (2) spoolsv.exe spawning unexpected child processes that may indicate a malicious port monitor DLL executing code, and (3) new DLL files dropped into C:\Windows\System32 by non-standard processes. Uses DeviceRegistryEvents, DeviceProcessEvents, and DeviceFileEvents tables from Microsoft Defender for Endpoint.

Data Sources

Windows Registry: Registry Key CreationWindows Registry: Registry Key ModificationProcess: Process CreationFile: File CreationMicrosoft Defender for Endpoint

Required Tables

DeviceRegistryEventsDeviceProcessEventsDeviceFileEvents

False Positives & Tuning

  • Legitimate printer driver installations by IT administrators using vendor-provided installers (HP, Canon, Lexmark, etc.) that register port monitors through AddMonitor API
  • Print management software (PaperCut, PrinterLogic, Pharos) that installs custom port monitors for print job tracking and accounting
  • PDF printer utilities (Adobe PDF, Microsoft Print to PDF, CutePDF) that register virtual port monitors during installation
  • Windows Update or WSUS deploying printer driver updates that modify the Print\Monitors registry key
Download portable Sigma rule (.yml)

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.

  1. 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.

  2. 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.

  3. 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.

Unlock Pro Content

Get the full detection package for T1547.010 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections