ByteRay CQL Hub
CrowdStrike Query Library

The open CQL library for Falcon Next‑Gen SIEM.

173 community-maintained detection & hunting queries for CrowdStrike Falcon Next-Gen SIEM and LogScale. Search, filter, copy — free to use.

173 queriesReset filters
Failed and Successful User Logon Events
Monitoring
Endpoint
Insight
This query correlates successful and failed logon attempts per user account to identify potential compromise patterns, focusing on accounts with 4+ failed logons. It provides a comprehensive view of each user's authentication activity including password age and last successful access.
CQL
Copy
Run in Falcon ↗
#event_simpleName=/UserLogon/ | case{ #event_simpleName=UserLogon | SuccessLogonTime:=ContextTimeStamp; #event_simpleName=UserLogonFailed2 | FailedLogonTime:=ContextTimeStamp; } | groupBy([UserSid, UserName], function=([min(FailedLogonTime, as=FirstFailedLogon), max(FailedLogonTime, as=LastFailedLogon), max(SuccessLogonTime, as=LastSuccessfulLogin), count(SuccessLogonTime, as=TotalSuccessfulLogins), count(FailedLogonTime, as=TotalFailedLogins), selectFromMax(field="@timestamp", include=[PasswordLastSet]), {#event_simpleName=UserLogon | selectFromMax(field="@timestamp", include=[ComputerName]) | rename(field="ComputerName", as="LastLoggedOnHost")}])) | TotalFailedLogins>3 | $falcon/helper:enrich(field=UserLogonFlags) | formatTime(format="%F %T", field=FirstFailedLogon, as="FirstFailedLogon", timezone="EST") | formatTime(format="%F %T", field=LastFailedLogon, as="LastFailedLogon", timezone="EST") | formatTime(format="%F %T", field=LastSuccessfulLogin, as="LastSuccessfulLogin", timezone="EST") | PasswordLastSet:=PasswordLastSet*1000 | formatTime(format="%F %T", field=PasswordLastSet, as="PasswordLastSet", timezone="EST") | default(value="-", field=[FirstFailedLogon, LastFailedLogon, LastSuccessfulLogin, TotalSuccessfulLogins, TotalFailedLogins, PasswordLastSet, LastLoggedOnHost]) | sort(order=desc, TotalFailedLogins, limit=20000)
CrowdStrike
failed-and-successful-user-logon-events
Failed User Logon Thresholding
Detection
Endpoint
Insight
This query identifies Windows failed login attempts that exceed a threshold (5+ failures), helping detect potential brute force attacks or account compromise attempts
CQL
Copy
Run in Falcon ↗
// Get Windows UserLogonFailed events event_platform=Win #event_simpleName=UserLogonFailed2 // This line is completely optional, but converts SubStatus to hex | SubStatus_hex:=format(field=SubStatus, "%x") | SubStatus_hex:=upper(SubStatus_hex) | SubStatus_hex:=format(format="0x%s", field=[SubStatus_hex]) // Aggregate results | groupBy([aid, ComputerName, UserName, LogonType, SubStatus_hex, SubStatus], function=([count(aid, as=FailCount), min(ContextTimeStamp, as=FirstLogonAttempt), max(ContextTimeStamp, as=LastLogonAttempt), collect([LocalAddressIP4, aip])])) // Perform rate calculations | firstLastDeltaHours:=((LastLogonAttempt-FirstLogonAttempt)/60/60) | round("firstLastDeltaHours") | logonAttemptsPerHour:=(failCount/firstLastDeltaHours) | round("logonAttemptsPerHour") // Convert timestamps from epoch to human | FirstLogonAttempt:=formatTime(format="%F %T.%L", field="FirstLogonAttempt") | LastLogonAttempt:=formatTime(format="%F %T.%L", field="LastLogonAttempt") // Optional: set threshold for failed logins | FailCount> 5 // Sort descending | sort(FailCount, order=desc, limit=2000) // Convert fields from decimal to human readable | $falcon/helper:enrich(field=LogonType) | $falcon/helper:enrich(field=SubStatus)
CrowdStrike
failed-user-logon-thresholding
CVE-2025-59287 vulnerable WSUS servers identification
Hunting, Monitoring
Endpoint, Other
Insight
This query identifies WSUS servers that have the wsusservice enabled and that are vulnerable to CVE-2025-59287
CQL
Copy
Run in Falcon ↗
// Make table that contains Agent ID values of Windows systems with WSUS service discovered | defineTable(query={ #repo = "base_sensor" event_platform=Win #event_simpleName="ProcessRollup2" FileName="wsusservice.exe" | groupBy([aid], function=[] ) }, include=[aid], name="WsusServiceRunning", start=7d) // Get OsVersionInfo events; sent by sensor every 24-hours or at sensor start or update | #event_simpleName=OsVersionInfo event_platform=Win // Aggregate results to get latest information per Agent ID value | groupBy([aid], function=([selectLast([@timestamp, ComputerName, event_platform, ProductName, LocalAddressIP4])]), limit=max) // Merge details from AID Master | match(file="aid_master_main.csv", field=[aid], include=[ProductType]) // Restrict above results to servers or domain controllers | in(field="ProductType", values=[2,3]) // Evaluate Windows build numbers | case { event_platform=Win MajorVersion=10 MinorVersion=0 BuildNumber=17763 SubBuildNumber<7922 | Status:="NEEDS PATCH"; event_platform=Win MajorVersion=10 MinorVersion=0 BuildNumber=20348 SubBuildNumber<4297 | Status:="NEEDS PATCH"; event_platform=Win MajorVersion=10 MinorVersion=0 BuildNumber=26100 SubBuildNumber<6905 | Status:="NEEDS PATCH"; event_platform=Win MajorVersion=10 MinorVersion=0 BuildNumber=25398 SubBuildNumber<1916 | Status:="NEEDS PATCH"; event_platform=Win MajorVersion=10 MinorVersion=0 BuildNumber=26100 SubBuildNumber<6905 | Status:="NEEDS PATCH"; event_platform=Win MajorVersion=10 MinorVersion=0 BuildNumber=14393 SubBuildNumber<8524 | Status:="NEEDS PATCH"; event_platform=Win MajorVersion=6 MinorVersion=2 BuildNumber=9200 SubBuildNumber<25728 | Status:="NEEDS PATCH"; event_platform=Win MajorVersion=6 MinorVersion=3 BuildNumber=9600 SubBuildNumber<22826 | Status:="NEEDS PATCH"; * | Status:="OK"; } // Check to see if WSUS service was discovered on host | case { match(file="WsusServiceRunning", field=aid, column=aid) | WsusService := "YES"; * | WsusService := "NO"; } // Oragnize table | table([@timestamp, aid, ComputerName, WsusService, Status, ProductName, LocalAddressIP4], sortby=Status, order=asc, limit=50000) // Make ProductType field human readable | $falcon/helper:enrich(field=ProductType)
Crowdstrike
cve-2025-59287-vulnerable-wsus-servers-identification
Powershell Command Length Anomaly Detection
Detection
Endpoint
Insight
This query establishes a 7-day baseline of average PowerShell command lengths for each host. It then compares this baseline to the average command length of the last 24 hours. The query identifies hosts with a significant percentage increase in command length, which can be an indicator for obfuscation, fileless execution, or other malicious activities associated with "Living off the Land" techniques.
CQL
Copy
Run in Falcon ↗
#event_simpleName=ProcessRollup2 | ImageFileName=/\\(powershell(_ise)?|pwsh)\.exe/i | CommandLength := length("CommandLine") | CommandLength>0 | aid=?AID // Classify Data into Historical and LastDay | case { test(@timestamp < (end() - duration(7d))) | DataSet:="Historical"; test(@timestamp > (end() - duration(1d))) | DataSet:="LastDay"; * } // Calculate Average Command Length | groupBy([DataSet, aid], function=avg(CommandLength)) | case { DataSet="Historical" | rename(field="_avg", as="historicalAvg"); DataSet="LastDay" | rename(field="_avg", as="todaysAvg"); * } // Aggregate Averages | groupBy([aid], function=[avg("historicalAvg", as=historicalAvg), avg("todaysAvg", as=todaysAvg)]) // Calculate Percentage Increase | PercentIncrease := (todaysAvg - historicalAvg) / historicalAvg * 100 | format("%d", field=PercentIncrease, as=PercentIncrease) | format(format="%.2f", field=[historicalAvg], as=historicalAvg) // Filter and Sort Results | PercentIncrease > 0 | sort(PercentIncrease, limit=10000)
T1059.001, T1027.010
ByteRay GmbH
powershell-command-length-anomaly-detection
No queries match your filters.

Have a query worth sharing?

Submit it directly — no GitHub account required — or open a pull request. Every query is reviewed and validated before it goes live, credited to you as the author.

Contribute a query →

These queries run in production.

We build, tune and operate CrowdStrike Falcon Next-Gen SIEM for companies across Europe, with more than 350 tested use cases and 24/7 incident response behind them.

Talk to the SIEM team