Query Details
//Detecting TeamsPhisher attack with Azure Sentinel //https://www.linkedin.com/pulse/detecting-teamsphisher-attack-azure-sentinel-steven-lim/ OfficeActivity | where TimeGenerated > ago(1h) | where RecordType =~ 'MicrosoftTeams' | where Operation == "MessageCreatedHasLink" | where CommunicationType == "OneOnOne" or CommunicationType == "GroupChat" | where UserId !endswith "your_corporate_domain_1" // Filter off all internal teams user 1-to-1 message and UserId !endswith "your_corporate_domain_2" and UserId !endswith "your_corporate_domain_3" | extend UserDomains = tostring(split(UserId, '@')[1]) | extend UserIPs = tostring(split(ClientIP, '::ffff:')[1]) | where UserIPs != "" | distinct UserIPs | join ThreatIntelligenceIndicator on $left.UserIPs == $right.NetworkIP
This KQL (Kusto Query Language) query is designed to detect potential phishing attacks in Microsoft Teams using Azure Sentinel. Here's a simplified breakdown of what the query does:
OfficeActivity table.TimeGenerated > ago(1h)).RecordType =~ 'MicrosoftTeams').Operation == "MessageCreatedHasLink").CommunicationType == "OneOnOne" or CommunicationType == "GroupChat").UserId !endswith "your_corporate_domain_1", etc.).In essence, this query identifies external users sending messages with links in Microsoft Teams and checks if their IP addresses are flagged in threat intelligence databases, helping to detect potential phishing attacks.

Steven Lim
Released: August 2, 2024
Tables
Keywords
Operators