KQL Library / Email & Phishing
Email & Phishing
top-phishing-sender-recipient-pairs.kql
Top phishing volume grouped by *(recipient, sender-domain)* pair — useful for spotting targeted campaigns against specific users.
// Author: Ian D. Hanley (DevSecOpsDad) | linkedin.com/in/ianhanley | devsecopsdad.com | devsecopsdadattack.com
// Identifies top recipients of phishing emails and categorizes severity based on volume
EmailEvents
| where ThreatTypes has "Phish"
| summarize PhishCount = count() by RecipientEmailAddress, SenderFromDomain
// Assign severity level indicators based on PhishCount
| extend SeverityIndicator = case(
PhishCount >= 500,
"🔥 Extreme Volume",
PhishCount >= 200,
"🔴 Critical Volume",
PhishCount >= 100,
"🟠 Major Volume",
PhishCount >= 50,
"🟡 Moderate Volume",
"🟢 Low Volume"
)
// Apply color coding to PhishCount
| extend CountColor = case(
PhishCount >= 500,
"🔥",
PhishCount >= 200,
"🔴",
PhishCount >= 100,
"🟠",
PhishCount >= 50,
"🟡",
"🟢"
)
// Sort by the highest volume of phishing emails received
| top 10 by PhishCount desc
// Improve column naming for readability
| project
["Recipient Email"] = RecipientEmailAddress,
["Sender Domain"] = SenderFromDomain,
["Phishing Emails Received"] = strcat(CountColor, " ", PhishCount),
["Severity"] = SeverityIndicator