Identify Potential RDP Tunneled Sessions
Description:
KQL Query:
// Detect Potential Tunneled RDP Sessions
DeviceNetworkEvents
| where Timestamp > ago(7d) // Limit results to the last 7 days
| where RemotePort == 3389 or LocalPort == 3389 // Focus on RDP traffic (default port 3389)
| extend IsNonStandardPort = RemotePort != 3389 and LocalPort != 3389 // Simplify non-standard port check
| summarize
UniqueRemoteIPs = dcount(RemoteIP),
SessionCount = count(),
FirstSeen = min(Timestamp),
LastSeen = max(Timestamp)
by DeviceName, InitiatingProcessCommandLine, RemoteIP, RemotePort, IsNonStandardPort, InitiatingProcessAccountName
| where SessionCount > 10 // High number of concurrent sessions
or IsNonStandardPort // Non-standard RDP ports
| where InitiatingProcessAccountName != ""
| where InitiatingProcessAccountName !in~ ("local service", "system", "network service")
| extend GeoInfo = geo_info_from_ip_address(RemoteIP) // Geolocation enrichment
| extend Country = GeoInfo.country_name, City = GeoInfo.city
| project
Timestamp = LastSeen,
DeviceName,
InitiatingProcessAccountName,
InitiatingProcessCommandLine,
RemoteIP,
RemotePort,
IsNonStandardPort,
UniqueRemoteIPs,
SessionCount,
Country,
City,
FirstSeen,
LastSeen
| sort by SessionCount descExplanation of the Query:
Use Case:
Notes:
PreviousIdentify Execution of Script From User's Downloads FolderNextIdentify Instances of PowerShell Invoke-WebRequest, IWR or Net.WebClient
Last updated