← Back to SOC feed Coverage →

DetectTorRelayConnectivity

kql MEDIUM Azure-Sentinel
DeviceNetworkEvents
huntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-05-09T11:00:00Z · Confidence: medium

Hunt Hypothesis

Processes communicating with known Tor relay IP addresses may indicate adversary attempts to exfiltrate data or establish covert command and control channels, as Tor relays are commonly used to mask malicious network activity. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential covert communication channels and mitigate advanced persistent threat (APT) activities.

KQL Query

let TorRelayData = (
    externaldata (Nickname:string,Fingerprint:string,EntryAddress:string,IPAddress:string,Port:string,AddressType:string,Hostname:string,CountryCode:string,IsRunning:bool,LastChangedIPData:string)
    [h@'https://torinfo.blob.core.windows.net/public/TorRelayIPs.csv'] with (ignoreFirstRecord=true,format="csv")
    | where AddressType == "IPv4"
);
TorRelayData
| join kind=inner DeviceNetworkEvents on $left.IPAddress == $right.RemoteIP
| join kind=inner (DeviceInfo | distinct DeviceId, PublicIP) on DeviceId
| project Timestamp, DeviceId, LocalPublicIP = PublicIP, LocalIP, RemoteIP, TorIP = IPAddress, Hostname, CountryCode, ActionType, InitiatingProcessFileName, InitiatingProcessFolderPath

Analytic Rule Definition

id: 26be4a5f-7e6f-4c2e-967d-467bddcbb51a
name: DetectTorRelayConnectivity
description: |
  This advanced hunting query detects processes communicating with known Tor relay IP addresses.
  The public URL in the query is updated daily at 12PM and 12AM UTC.
  CSV source is the Tor Project API, obtained with: https://github.com/Dylan-J/Tor-Project-Statistics
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - DeviceNetworkEvents
  - DeviceInfo
tactics:
- Discovery
- Command and control
query: |
  let TorRelayData = (
      externaldata (Nickname:string,Fingerprint:string,EntryAddress:string,IPAddress:string,Port:string,AddressType:string,Hostname:string,CountryCode:string,IsRunning:bool,LastChangedIPData:string)
      [h@'https://torinfo.blob.core.windows.net/public/TorRelayIPs.csv'] with (ignoreFirstRecord=true,format="csv")
      | where AddressType == "IPv4"
  );
  TorRelayData
  | join kind=inner DeviceNetworkEvents on $left.IPAddress == $right.RemoteIP
  | join kind=inner (DeviceInfo | distinct DeviceId, PublicIP) on DeviceId
  | project Timestamp, DeviceId, LocalPublicIP = PublicIP, LocalIP, RemoteIP, TorIP = IPAddress, Hostname, CountryCode, ActionType, InitiatingProcessFileName, InitiatingProcessFolderPath

Required Data Sources

Sentinel TableNotes
DeviceNetworkEventsEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Discovery/DetectTorRelayConnectivity.yaml