Query Details
# Unfolding redirectors using UrlClickEvents table
## Description
The following query leverages UrlClickEvents and more specifically the UrlChain column to unfold redirectors identified from user's clicks at Emails, Teams messages and Office 365 apps.
### Microsoft Defender XDR
```
UrlClickEvents
//| where ActionType == "ClickAllowed" // Uncomment if you need to filter by "ClickAllowed"
| extend UrlChain = todynamic(UrlChain)
| mv-expand UrlChain
| where Url != UrlChain
| extend UrlString = tostring(UrlChain)
| summarize Count = count() by NetworkMessageId
| where Count > 1
| join kind=inner (
UrlClickEvents
| extend UrlChain = todynamic(UrlChain)
| mv-expand UrlChain
// | where Url != UrlChain
| extend UrlString = tostring(UrlChain)
) on NetworkMessageId
| sort by TimeGenerated asc
```
### Versioning
| Version | Date | Comments |
| ------------- |---------------| ---------------------------------------|
| 1.0 | 18/3/2025 | Initial publish |
This query is designed to analyze and unfold redirector URLs from user clicks in various Microsoft applications like Emails, Teams messages, and Office 365 apps using the UrlClickEvents table. Here's a simplified breakdown of what the query does:
Data Preparation:
UrlClickEvents table, which logs URL click events.UrlChain column, which contains a sequence of URLs (redirects), is converted into a dynamic data type for further processing.Expanding URL Chains:
mv-expand function is used to break down the UrlChain into individual URLs, allowing each URL in the chain to be processed separately.Filtering and Counting:
Url) is different from the URLs in the UrlChain.NetworkMessageId (a unique identifier for network messages) and filters to include only those with more than one URL in the chain.Joining Data:
UrlClickEvents table to combine data based on NetworkMessageId, ensuring that only events with multiple redirects are included.Sorting:
TimeGenerated column in ascending order, which organizes the data chronologically.This query helps identify and analyze redirector URLs that users encounter, providing insights into potential security risks or user behavior patterns related to URL redirections.

Michalis Michalos
Released: March 18, 2025
Tables
Keywords
Operators