Pivot From a Scanner Hit to RDP or RMM (KQL)
Detects: RDP and RMM clients (mstsc, AnyDesk, ScreenConnect, Atera, Splashtop) on the same host within 2 hours of a GUI scanner hit.
ATT&CK: pivots from a T1046 Network Service Discovery or T1018 Remote System Discovery hit
Works on: Microsoft Defender for Endpoint, KQL (DeviceProcessEvents)
Tested on: my lab, Microsoft Defender telemetry: anchored on a real Advanced IP Scanner hit, it returned 1 row: mstsc.exe, launched from NetScan on the same host 15 minutes later
Full write-up: Hunt Ransomware Before It Encrypts: The Three Tools 45+ Gangs Reach For
The signal hiding inside the detection
NetScan can run headless, and Advanced IP Scanner and Advanced Port Scanner both ship a console binary as well. Their GUI binaries, though, need someone at a desktop to drive them. So a hit on a GUI binary is not just a discovery alert.
It is an RDP, RMM or VDI session alert by implication: no desktop session, no GUI scan.
Rule out admin use first. Then pivot the hunt to the same host, plus or minus 2 hours from the scanner hit.
The query
Published from the newsletter issue with one change: HitTime defaults to a relative time. Set HitHost and HitTime to the host and time of your scanner hit.
let HitHost = "SERVER01";
let HitTime = ago(2h); // set to your scanner alert time
DeviceProcessEvents
| where DeviceName =~ HitHost
| where Timestamp between (HitTime - 2h .. HitTime + 2h)
| where FileName in~ ("mstsc.exe", "AnyDesk.exe", "ScreenConnect.ClientService.exe", "AteraAgent.exe", "Splashtop.exe")
| project Timestamp, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName

What it catches
Any remote-access client process that ran on the scanner host in that 4-hour window, with the account, command line and parent, so you can tie the scan to the session that drove it.
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
This is step four of a short run: run the process query over the last 30 days, filter out IT admin accounts and known scanning hosts by hostname or account, check each remaining hit’s parent and account, and for a hit on the Advanced IP Scanner or Advanced Port Scanner GUI binary, run this pivot. If RDP or RMM activity surfaces in the window, scope the incident and start IR containment.
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
Why does a GUI scanner hit imply an interactive session?
The GUI binaries of Advanced IP Scanner and Advanced Port Scanner (advanced_ip_scanner.exe, advanced_port_scanner.exe) need someone at a desktop. Check the file name first, because both tools also ship a console binary (*_console.exe) that runs from a script with no desktop. If a GUI binary ran on a host with no admin session active at that time, an attacker had interactive access.
Does this apply to NetScan?
No. NetScan can run headless with /hide and /auto, so a NetScan hit does not prove a desktop session.