Query Details
// Detecting Windows Side-Loading DLL attacks // https://x.com/0gtweet/status/1827991604918890968 // Grzegorz Tworek recently highlighted on X that the Windows command line tool licensingdiag.exe poses a potential security risk. This tool, categorized as a “living off the land” utility, can be exploited for side-loading DLL attacks. If a threat actor gains local administrative rights, they can modify the registry under HKLM to side-load DLLs using licensingdiag.exe. To address this, I have developed a KQL detection rule to identify such side-loading DLL attacks. You can find this rule in my GitHub repository. let DLLLoaded = DeviceEvents | where Timestamp > ago(1h) | where ActionType == @"DriverLoad" | where FileName endswith ".dll" | distinct FileName; DeviceRegistryEvents | where ActionType == @"RegistryKeyCreated" or ActionType == @"RegistryValueSet" | where RegistryKey has_any(DLLLoaded) // MITRE ATT&CK MAPPING // Technique: T1547.006 - Boot or Logon Autostart Execution: Kernel Modules and Extensions // Technique: T1112 - Modify Registry // Technique: T1055.001 - Process Injection: Dynamic-link Library Injection
This KQL query is designed to detect potential Windows side-loading DLL attacks, specifically focusing on the misuse of the licensingdiag.exe tool. Here's a simplified breakdown of what the query does:
Identify Loaded DLLs:
Check Registry Modifications:
Purpose:
MITRE ATT&CK Mapping:
In summary, this query helps identify suspicious DLL side-loading activities by correlating DLL loads with recent registry changes, which could indicate an attempt to exploit the licensingdiag.exe tool for malicious purposes.

Steven Lim
Released: October 3, 2024
Tables
Keywords
Operators