This hypothesis targets adversaries leveraging the T1566 Phishing technique to deliver malicious payloads through Microsoft Teams, a common vector for initial access in modern cloud environments. Proactively hunting for these files allows the SOC to identify compromised users and isolate threats before lateral movement occurs, capitalizing on the integrated visibility provided by Microsoft Defender for Office 365 within Azure Sentinel.
//This query lists Microsoft Teams files detected with malware by Microsoft Defender for Office 365.
FileMaliciousContentInfo
| where Timestamp > ago(30d)
| where Workload == "MicrosoftTeams"
| where isnotempty(ThreatTypes)
| top 20 by Timestamp desc
| project ['Time']=Timestamp, ['File Name']=FileName, ['Threat Type']=tostring(ThreatTypes), ['Threat Names']=ThreatNames, ['File Location']=FolderPath, ['File Owner']=FileOwnerUpn, SHA256
id: 7ad7e727-44f3-4b5b-80a4-b6b54d5eba5a
name: Malicious files shared in Microsoft Teams
description: |
This query lists Microsoft Teams files detected with malware by Microsoft Defender for Office 365.
description-detailed: |
This query lists Microsoft Teams files detected with malware by Microsoft Defender for Office 365, using Advanced hunting in Microsoft Defender XDR.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
dataTypes:
- FileMaliciousContentInfo
tactics:
- InitialAccess
relevantTechniques:
- T1566
query: |
//This query lists Microsoft Teams files detected with malware by Microsoft Defender for Office 365.
FileMaliciousContentInfo
| where Timestamp > ago(30d)
| where Workload == "MicrosoftTeams"
| where isnotempty(ThreatTypes)
| top 20 by Timestamp desc
| project ['Time']=Timestamp, ['File Name']=FileName, ['Threat Type']=tostring(ThreatTypes), ['Threat Names']=ThreatNames, ['File Location']=FolderPath, ['File Owner']=FileOwnerUpn, SHA256
version: 1.0.0
UserDisplayName matches specific security team groups (e.g., “SOC-Analysis”, “BlueTeam”) or where the FileName contains standard test identifiers like EICAR, TEST, or SAMPLE..exe files for internal tools, Java JRE updates, or specific vendor agents like CrowdStrike or SentinelOne) that may be flagged as “PUA” (Potentially Unwanted Application) or have outdated signatures in Defender for Office 365.
FileType is exe and the FileName matches known internal tool names (e.g., setup.exe, installer.msi, agent.exe) or where the UserDisplayName is in the “IT-Admins” or “DevOps” group.ThreatType is “PUA” (Potentially Unwanted Application) rather than “Malware”, or exclude files where the FileExtension is in a whitelist of common media/document types (e.g., pptx, mp4, zip) and the UserDisplayName is in “Marketing” or “HR” groups.