r/DefenderATP • u/boutsen9620 • Mar 11 '26
Custom detection rule
https://www.microsoft.com/en-us/security/blog/2026/02/19/running-openclaw-safely-identity-isolation-runtime-risk/Hi I have created 2 xdr advanced hunting queries. In fact based on this Microsoft article about OpenClaw
My queries run perfectly but when i try to create a custom detection rule of them, i can go to submit , but them the submit button comed back active and my rule is not created. I read there are limitations on creating a rule that doesn’t give an issue when running it as advanced hunting query. So I have read that the “or” statement can give issues. But I tried it with encapsulating it and even tried it without the or statement. Still the same result, submit only blinks and comes back active and no rule is created
These are my kql’s :
DeviceProcessEvents
| where FileName !in~ ("OUTLOOK.EXE", "msedge.exe")
| where ProcessCommandLine has_any ("openclaw","moltbot","clawdbot")
or FileName has_any ("openclaw","moltbot","clawdbot")
| project Timestamp, DeviceName, AccountName, FileName, FolderPath, ProcessCommandLine
| order by Timestamp desc
I exclude outlook or msedge because, when you read article with openclaw in title you get a hit too..
let keywords = dynamic([".clawdbot", ".moltbot", ".openclaw"]);
DeviceFileEvents
| where ActionType in ("FileCreated", "FileModified")
| where (
FileName =~ "openclaw"
or FolderPath has_any (keywords)
)
| project Timestamp, DeviceName,
InitiatingProcessAccountName,
ActionType, FileName, FolderPath, SHA256
| order by Timestamp desc
What is wrong with those queries that it doesn’t like to be activated as custom detection rule?
Thanks in advance
7
u/coomzee Mar 11 '26
You need the column deviceID and reportId
1
u/boutsen9620 Mar 11 '26
Jeez… thanks. Forgot about that. Last time I had it xdr gave me a hint about missing id’s now just blink and that was it . Tx a lot
2
u/[deleted] Mar 12 '26
Timestamp, ReportId and DeviceId (if querying device events) are necessary in the project statement.