VeriKQL by Kaushik Saha

4104 Script Block Logging

Windows PowerShellchecked by code

channel Operational · level Verbose · opcode Create · task CommandStart · keyword Runspace

In Microsoft Sentinel

  • Windows event logs (Azure Monitor Agent) → Event ✓ verified by VeriKQL
    Event | where EventLog in ("Microsoft-Windows-PowerShell/Operational", "Windows PowerShell") | where EventID == 4104
  • Windows Forwarded Events → WindowsEvent ✓ verified by VeriKQL
    WindowsEvent | where Channel in ("Microsoft-Windows-PowerShell/Operational", "Windows PowerShell") | where EventID == 4104

ATT&CK

T1007T1010T1012T1016T1016.001T1016.002T1027.018T1033T1036.001T1036.002T1049T1056.002T1059.001T1069T1069.002T1070.003T1070.004T1070.005T1070.008T1082T1087.002T1087.003T1114T1114.002T1114.003T1124T1132.001T1132.002T1135T1197T1201T1204.004T1205T1216T1216.001T1216.002T1217T1218.003T1218.004T1218.009T1218.013T1218.014T1222T1222.001T1480T1480.001T1505.002T1556.005T1564.008T1564.011T1615T1674T1679T1690T1700

Every technique MITRE cites this event for in ATT&CK 20.0, computed from MITRE's data.

In Content Hub rules

Used by 0 Content Hub rules that filter for it the way the starter queries do.

Content Hub rules at Azure-Sentinel 9ea9f7c that VeriKQL learns from (they bind cleanly, or are valid Defender XDR advanced hunting). A count of practice, not a recommendation.

In Sigma rules

No SigmaHQ rule names this event ID on this log outright.

Community rules, not Microsoft's, and not checked by VeriKQL (Sigma is not KQL). From SigmaHQ/sigma at f083329, under the Detection Rule License (DRL) 1.1; each rule is credited to its author.

From aboutLogging (MicrosoftDocs/PowerShell-Docs@a3de8f2, CC-BY-4.0).

Event names, messages and categories are © Microsoft, from Microsoft Learn's documentation sources, used under CC BY 4.0; each page links its source and the commit it was read at. Questions, groupings and notes are VeriKQL's own.