Detect Remote Access Tools in Microsoft Sentinel
An adversary may use legitimate remote access tools to establish an interactive command and control channel within a network. Remote access tools create a session between two trusted hosts through a graphical interface, a command line interaction, a protocol tunnel via development or management software, or hardware-level access such as KVM (Keyboard, Video, Mouse) over IP solutions. Desktop support software and remote management software allow a user to control a computer remotely as if they are a local user inheriting the user or software permissions. This software is commonly used for troubleshooting, software installation, and system management. Adversaries may similarly abuse response features included in EDR and other defensive tools that enable remote access. Remote access tools may be installed and used post-compromise as an alternate communications channel for redundant access or to establish an interactive remote desktop session with the target system.
MITRE ATT&CK
- Tactic
- Command and Control
- Technique
- T1219 Remote Access Tools
- Canonical reference
- https://attack.mitre.org/techniques/T1219/
KQL Detection Query
let RATProcessNames = dynamic([
"teamviewer.exe", "teamviewer_service.exe",
"anydesk.exe", "anydesk_service.exe",
"screenconnect.exe", "screenconnectclient.exe", "connectwisecontrol.client.exe",
"logmein.exe", "lmi_rescue.exe", "logmeinrescue.exe",
"ammyyadmin.exe", "aa_v3.exe",
"supremo.exe", "supremoservice.exe",
"rustdesk.exe", "splashtop.exe", "splashtopremote.exe",
"ateraagent.exe", "ninjaone.exe", "ninjaremote.exe",
"simplehelp.exe", "dwrcs.exe", "dwrcst.exe",
"tmate", "vnc.exe", "tvnserver.exe", "vncviewer.exe",
"uvnc_service.exe", "winvnc.exe",
"remotedesktopmanager.exe", "mstsc.exe",
"chrome_remote_desktop.exe", "remote_assistance_host.exe"
]);
let RATNetworkDomains = dynamic([
"teamviewer.com", "anydesk.com", "screenconnect.com", "connectwise.com",
"logmein.com", "logmeinrescue.com", "ammyy.com",
"supremo.com", "rustdesk.com", "splashtop.com",
"atera.com", "ninjarmm.com", "simplehelp.com"
]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any (RATProcessNames)
| extend IsService = InitiatingProcessFileName in~ ("services.exe", "svchost.exe")
| extend IsUserLaunched = InitiatingProcessFileName in~ ("explorer.exe", "cmd.exe", "powershell.exe")
| extend RATCategory = case(
FileName has_any ("teamviewer", "anydesk", "screenconnect", "connectwise"), "Commercial RMM",
FileName has_any ("vnc", "tvnserver", "winvnc", "uvnc"), "VNC",
FileName has_any ("logmein", "lmi_rescue"), "LogMeIn",
FileName has_any ("ammyy", "aa_v3"), "AmmyyAdmin",
FileName has_any ("rustdesk", "splashtop", "supremo"), "Other RMM",
FileName has_any ("atera", "ninja", "simplehelp", "dwrcs"), "MSP Tool",
"Unknown")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
RATCategory, IsService, IsUserLaunched
| sort by Timestamp desc Detects execution of known remote access tool (RAT/RMM) processes using Microsoft Defender for Endpoint DeviceProcessEvents. Covers major commercial tools (TeamViewer, AnyDesk, ScreenConnect/ConnectWise, LogMeIn, AmmyyAdmin, Splashtop, RustDesk, Supremo), MSP management platforms (Atera, NinjaOne, SimpleHelp, DameWare), and VNC variants. Categorizes each tool type and identifies whether it was launched as a service or interactively by a user.
Data Sources
Required Tables
False Positives & Tuning
- IT helpdesk staff using approved RMM tools (TeamViewer, ScreenConnect) for legitimate remote support sessions during business hours
- Managed Service Providers (MSPs) running Atera, NinjaOne, or ConnectWise agents as part of contracted IT management services
- Software developers using VNC or RustDesk for legitimate remote access to lab environments or build servers
- System administrators using DameWare Mini Remote Control for server management across data centers
Other platforms for T1219
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1AnyDesk Portable Execution from Temp Directory
Expected signal: Sysmon Event ID 1: Process Create with Image=%TEMP%\anydesk_test.exe. Sysmon Event ID 3: Network connection to AnyDesk relay servers (*.net.anydesk.com). Sysmon Event ID 11: File creation in %TEMP% for the AnyDesk binary. Sysmon Event ID 22: DNS query for anydesk.com domains.
- Test 2TeamViewer Service Installation Detection
Expected signal: Sysmon Event ID 12: Registry key created at HKCU\SOFTWARE\TeamViewer_Test. Sysmon Event ID 13: Registry value set for Run key persistence. Security Event ID 4688: reg.exe process creation with command line containing TeamViewer.
- Test 3VNC Server Execution Test
Expected signal: Sysmon Event ID 1: Process Create with Image containing tvnserver.exe or cmd.exe (mock). If TightVNC present: Sysmon Event ID 3 for VNC listening on port 5900. Security Event ID 4688 with command line arguments.
References (8)
- https://attack.mitre.org/techniques/T1219/
- https://www.cisa.gov/news-events/cybersecurity-advisories/aa23-320a
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceprocessevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1219/T1219.md
- https://github.com/SigmaHQ/sigma/tree/master/rules/windows/process_creation
- https://www.huntress.com/blog/slashandgrab-screen-connect-post-exploitation-in-the-wild-cve-2024-1709-cve-2024-1708
- https://go.crowdstrike.com/rs/281-OBQ-266/images/15GlobalThreatReport.pdf
- https://www.mandiant.com/resources/blog/unc3944-sms-phishing-sim-swapping-ransomware
Unlock Pro Content
Get the full detection package for T1219 including response playbook, investigation guide, and atomic red team tests.