Detect Tor DNS Request
Query
DeviceNetworkEvents //Credit: Suraj Kumar. Modified from his query
| where TimeGenerated > ago(90d)
| extend AdditionalFields_query = tostring(parse_json(AdditionalFields)["query"])
| where AdditionalFields_query endswith ".onion"
| summarize count() by AdditionalFields_query, DeviceNameExplanation
This query is analyzing network events from devices over the past 90 days to identify and count specific activities related to ".onion" domains, which are typically associated with the Tor network. Here's a breakdown of what the query does:
-
DeviceNetworkEvents: This is the data source being queried, which contains network event logs from various devices.
-
where TimeGenerated > ago(90d): Filters the events to include only those that were generated in the last 90 days.
-
extend AdditionalFields_query = tostring(parse_json(AdditionalFields)["query"]): Extracts the "query" field from a JSON object within the "AdditionalFields" column and converts it to a string. This field likely contains the domain or URL being accessed.
-
where AdditionalFields_query endswith ".onion": Further filters the events to include only those where the extracted query ends with ".onion", indicating access to a Tor network site.
-
summarize count() by AdditionalFields_query, DeviceName: Groups the filtered events by the ".onion" query and the device name, then counts the number of occurrences for each combination.
In simple terms, this query is looking for and counting how many times each device accessed ".onion" sites over the last 90 days.