T1021.005 Microsoft Sentinel · KQL

Detect VNC in Microsoft Sentinel

Adversaries may use Valid Accounts to remotely control machines using Virtual Network Computing (VNC). VNC uses the Remote Framebuffer (RFB) protocol to relay screen, mouse, and keyboard inputs over the network. Unlike RDP, VNC provides screen-sharing rather than resource-sharing, making it useful for interactive control. Threat actors including Gamaredon Group, FIN7, and APT groups have used VNC tools including UltraVNC, TightVNC, TigerVNC, and RealVNC for lateral movement and remote access. VNC communicates on TCP port 5900+ by default and can be used with or without password authentication, with some implementations historically vulnerable to authentication bypasses.

MITRE ATT&CK

Tactic
Lateral Movement
Technique
T1021 Remote Services
Sub-technique
T1021.005 VNC
Canonical reference
https://attack.mitre.org/techniques/T1021/005/

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
// Detect VNC-related process execution and network connections
let VncProcesses = dynamic(["vncserver", "vncviewer", "vncconfig", "vnc4server", "x0vncserver",
  "tightvncserver", "tightvncviewer", "ultravnc", "uvnc", "tvnserver", "tvnviewer",
  "winvnc", "winvnc4", "rfbdrv"]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any (VncProcesses) or InitiatingProcessFileName has_any (VncProcesses)
| extend IsVncServer = FileName has_any ("vncserver", "vnc4server", "tightvnc", "winvnc")
| extend IsVncClient = FileName has_any ("vncviewer", "tightvncviewer")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, IsVncServer, IsVncClient
| union (
    // Detect VNC network connections (default port range 5900-5910)
    DeviceNetworkEvents
    | where Timestamp > ago(24h)
    | where RemotePort between (5900 .. 5910) or LocalPort between (5900 .. 5910)
    | where ActionType in ("ConnectionSuccess", "ConnectionFound", "InboundConnectionAccepted")
    | project Timestamp, DeviceName, InitiatingProcessFileName, RemoteIP, RemotePort, LocalPort, ActionType
)
| union (
    // Detect VNC installation or service registration
    DeviceRegistryEvents
    | where Timestamp > ago(24h)
    | where RegistryKey has_any ("VNC", "RealVNC", "TightVNC", "UltraVNC", "TigerVNC")
    | project Timestamp, DeviceName, ActionType, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessFileName
)
| sort by Timestamp desc
high severity high confidence

Detects VNC activity across three telemetry sources: VNC process execution (server and viewer binaries), network connections to VNC default ports 5900-5910, and registry modifications for VNC software installation/configuration. Covers common VNC implementations including UltraVNC, TightVNC, TigerVNC, RealVNC, and winvnc.

Data Sources

Process: Process CreationNetwork Traffic: Network Connection CreationWindows Registry: Windows Registry Key Modification

Required Tables

DeviceProcessEventsDeviceNetworkEventsDeviceRegistryEvents

False Positives & Tuning

  • IT help desk staff using VNC for legitimate end-user support sessions
  • System administrators using VNC to manage servers without RDP (especially Linux systems with desktop environments)
  • Vendor remote support solutions running VNC as a managed remote access tool
  • Development environments with VNC used to access headless Linux servers with GUI applications
  • Industrial control system (ICS) environments using VNC for HMI access to SCADA systems
Download portable Sigma rule (.yml)

Other platforms for T1021.005


Testing Methodology

Validate this detection against 4 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.

  1. Test 1Install TightVNC Server as Windows Service

    Expected signal: Sysmon Event ID 1: tvnserver.exe with -install flag. Windows Security Event ID 7045: new service tvnservice created. Registry key created at HKLM\SOFTWARE\TightVNC. Sysmon Event ID 12 (registry key create) for TightVNC registry entries.

  2. Test 2VNC Connection to Remote Host via vncviewer

    Expected signal: Sysmon Event ID 1: tvnviewer.exe process creation with target IP. Sysmon Event ID 3: outbound TCP connection to 127.0.0.1:5900. Windows firewall log entry for port 5900 connection.

  3. Test 3Configure UltraVNC with No Authentication (Backdoor Setup)

    Expected signal: Sysmon Event ID 13 (Registry Value Set) for HKLM\SOFTWARE\UltraVNC\Password and SecurityIdentifier. Security Event ID 4657 (registry value modified). Parent process visible as cmd.exe.

  4. Test 4Start VNC Server on Non-Standard Port

    Expected signal: Linux auditd EXECVE for vncserver with -rfbport 5901 and -SecurityTypes None. Network socket opened on port 5901. Process creation for Xvnc child process.

Unlock Pro Content

Get the full detection package for T1021.005 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections