Detect Renamed AnyDesk in Microsoft Defender (KQL)
Detects: AnyDesk running from a user-writable path, matched on its PE version info so a renamed copy still hits.
ATT&CK: T1219 Remote Access Tools
Works on: Microsoft Defender for Endpoint, KQL (DeviceProcessEvents)
Tested on: my lab, a renamed portable AnyDesk and a service install: 35 events
Full write-up: 32 Ransomware Groups Abuse AnyDesk. Your EDR Sees a Legit Tool
Stop trusting the filename
The attacker’s first move against a detection is the laziest one that works: rename the binary. AnyDesk.exe becomes Invoice_Viewer.exe, and every rule keyed on FileName == "anydesk.exe" goes quiet. AnyDesk shows up in the toolsets of 32 groups in the Ransomware Tool Matrix. Akira is one of them, and Fog uses it too.
The renamed file still carries AnyDesk’s version info.
One trap first: AnyDesk does not populate
OriginalFileName, the field everyone reaches for because it is supposed to survive a rename.
The three fields that are populated, and do survive it:
- CompanyName = “AnyDesk Software GmbH”
- ProductName = “AnyDesk”
- FileDescription = “AnyDesk”
The query matches on those, restricted to the user-writable paths where a portable remote-management tool has no business running.
The query
Published verbatim from the newsletter issue.
DeviceProcessEvents
| where Timestamp > ago(1d)
// rename-proof AnyDesk identity - OriginalFileName is EMPTY for AnyDesk, do NOT use it
| where ProcessVersionInfoCompanyName == "AnyDesk Software GmbH"
or ProcessVersionInfoProductName == "AnyDesk"
or ProcessVersionInfoFileDescription == "AnyDesk"
| where FolderPath contains @"\Users\" or FolderPath contains @"\Downloads\"
or FolderPath contains @"\AppData\" or FolderPath contains @"\Temp\"
or FolderPath contains @"\ProgramData\" or FolderPath contains @"\Public\"
| where FolderPath !startswith @"C:\Program Files"
| project Timestamp, DeviceName, AccountName, FileName, FolderPath,
ProcessVersionInfoCompanyName, ProcessVersionInfoFileDescription,
ProcessVersionInfoProductName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine
| order by Timestamp desc

What it catches
In the lab this returned 35 events and caught both faces of the same tool: Invoice_Viewer.exe running from ...\AppData\Local\Temp\ and the untouched AnyDesk.exe from C:\ProgramData\, side by side, every row stamped “AnyDesk Software GmbH”.
Get the next detection in your inbox
One lab-proven detection per issue: the attacker command, the telemetry it leaves, and the KQL / ES|QL that catches it.
You confirm on Substack in one tap.
No spam. Unsubscribe anytime.
Tuning note
Next, narrow it to what is suspicious: a sanctioned remote-management tool is deployed everywhere or nowhere, a planted one lands on one or two machines. In the lab the 30-day rarity view left two rows, AnyDesk.exe on one host and Invoice_Viewer.exe on one host. The SigmaHQ AnyDesk rules key on the same three fields, so the community ruleset already survives the rename.
SigmaHQ rule that fired on the same lab run: Remote Access Tool - AnyDesk Execution
Did this query fire in your environment, or miss something? Email me what you saw: ayush@securityinbits.com (open in Gmail). I read every reply, and it decides what I test next.
Questions
Does renaming AnyDesk.exe hide it?
Not from this query. A rename leaves the compiled version info alone: CompanyName, ProductName and FileDescription still read AnyDesk.
Why not match on OriginalFileName?
AnyDesk does not populate it. A rule built on OriginalFileName matched zero rows on real lab telemetry while looking reasonable in review.
Does an AnyDesk hit mean an attacker?
No. It tells you AnyDesk is running from a user-writable path. Whether it is your help desk or an operator comes from the other angles: rarity, behavior (a piped password), destination (the relay it calls) and the files it writes to disk, such as the approval field in connection_trace.txt.