Suspicious command line tokens in LolBins or LolScripts
Description
'This query identifies Microsoft-signed Binaries and Scripts that are not system initiated. This technique is commonly used in phishing attacks'
Query · kql
let Bin = externaldata(Binary: string) [@"https://raw.githubusercontent.com/sonnyakhere/LOLBAS_to_CSV/main/lolbas.csv"] with (format="csv", ignoreFirstRecord=True); let ioc = dynamic(["http", "ftp"]); SecurityEvent | where EventID == 4688 | where TimeGenerated between ( ago(1d) .. now() ) // Looking to exclude system initiated activity | where SubjectUserName !endswith "$" | where SubjectUserName != "SYSTEM" | where ParentProcessName has_any (Bin) // Looking to only include details of those that have command line activities matching 1 or more of the defined IOCs | where CommandLine has_any (ioc) | project TimeGenerated, SubjectMachineName, SubjectUserName, ParentProcessName, Process, CommandLine | sort by TimeGenerated asc