Detect Safe Links click-through to threats (KQL)
Defender for Office 365 Safe Links wraps URLs and can warn or block when a user clicks a malicious one. When the recorded ActionType is ClickAllowed for a URL carrying a Phish or Malware verdict, a user reached a known-bad page — exactly the moment a spearphishing link succeeds. This UrlClickEvents query returns those allowed clicks with the account, URL and workload.
Each hit is a potential live compromise: the user may have entered credentials or triggered a download, so triage quickly.
The query
UrlClickEvents
| where Timestamp > ago(24h)
| where ActionType == "ClickAllowed"
| where ThreatTypes has_any ("Phish", "Malware")
| project Timestamp, AccountUpn, Url, ActionType,
IsClickedThrough, ThreatTypes, Workload, NetworkMessageId
| sort by Timestamp descLine-by-line explanation
| where ActionType == "ClickAllowed"ClickAllowed means Safe Links let the user proceed to the URL rather than blocking it.
| where ThreatTypes has_any ("Phish", "Malware")Restricts to clicks on URLs with a phishing or malware verdict — the ones that matter.
project ... IsClickedThrough, Workload, NetworkMessageIdSurfaces IsClickedThrough (whether the user clicked past a warning page), the workload (Email, Teams, Office) and the message id for pivoting.
Required tables and columns
ActionTypeThe Safe Links decision; ClickAllowed means the user reached the URL.ThreatTypesVerdict on the clicked URL, such as Phish or Malware.AccountUpnThe user who clicked the link.IsClickedThroughWhether the user clicked through a warning page (1) rather than being blocked.
MITRE ATT&CK mapping
- Tactic
- Initial AccessTA0001
- Technique
- T1566.002· Phishing: Spearphishing Link
Tuning and false positives
- Join NetworkMessageId back to EmailEvents to recover the delivering message, sender and subject for the full phishing context.
- Also review ClickBlocked with IsClickedThrough set, to catch users who tried to bypass a block even if it held.
Limitations
- Only URLs processed by Safe Links appear; links in unwrapped channels or opened outside Office apps are not covered.
- Confirm the representation of IsClickedThrough in your tenant before adding strict equality filters on it; this query keys on ActionType instead.
Related queries
References
Last reviewed 2026-11-18.