Skip to content

Latest commit

 

History

History
57 lines (48 loc) · 1.76 KB

HuntDevicesDoingFirstRdpSession.md

File metadata and controls

57 lines (48 loc) · 1.76 KB

Hunt for devices doing first RDP session

Query Information

MITRE ATT&CK Technique(s)

Technique ID Title Link
T1021.001 Remote Services: Remote Desktop Protocol https://attack.mitre.org/techniques/T1021/001/

Description

This hunting query can help you find devices doing an RDP connection for the first time in 30 days. While this can be normal behavior, it might be interesting to look at why this device is suddenly doing an RDP connection.

Risk

By investigating these devices, you might find an attacker performing lateral movement over RDP from an end-user device.

Author

References

Defender XDR

let historic_rdp_devices = toscalar(
    DeviceNetworkEvents
    | where Timestamp > ago (30d)
    | where ActionType == "ConnectionSuccess"
    | where RemotePort == 3389
    | summarize make_set(DeviceId)
);
DeviceNetworkEvents
| where Timestamp > ago(1h)
| where ActionType == "ConnectionSuccess"
| where RemotePort == 3389
| where DeviceId !in (historic_rdp_devices)

Sentinel

let historic_rdp_devices = toscalar(
    DeviceNetworkEvents
    | where TimeGenerated > ago (30d)
    | where ActionType == "ConnectionSuccess"
    | where RemotePort == 3389
    | summarize make_set(DeviceId)
);
DeviceNetworkEvents
| where TimeGenerated > ago(1h)
| where ActionType == "ConnectionSuccess"
| where RemotePort == 3389
| where DeviceId !in (historic_rdp_devices)