This hypothesis targets adversaries who leverage phishing (T1566) to deliver known malware families via file attachments in SharePoint, OneDrive, or Teams, subsequently using command and script interpreter execution (T1080) to establish a foothold. Proactively hunting for these detections allows the SOC to identify compromised user accounts and lateral movement vectors early, mitigating the risk of persistent threats hidden within collaborative file storage before they escalate to broader infrastructure impact.
// DetectionMethods "Antimalware engine" indicates the built-in SharePoint Online antivirus.
FileMaliciousContentInfo
| where Timestamp > ago(30d)
| where isnotempty(ThreatTypes)
| where tostring(DetectionMethods) has "Antimalware engine"
| summarize Files = count() by ThreatName = ThreatNames
| top 50 by Files desc
id: e4f87c4a-0a56-4514-acfa-d662450132fa
name: File Malware Top Families by SharePoint Antivirus (SharePoint, OneDrive and Teams)
description: |
This query lists the top malware families detected in files across SharePoint, OneDrive and Teams by the built-in SharePoint Online antivirus, using the FileMaliciousContentInfo table.
description-detailed: |
The built-in SharePoint Online antivirus scans files uploaded to SharePoint, OneDrive and Teams. This query lists the malware families from those antivirus detections. It uses the DetectionMethods field in FileMaliciousContentInfo to separate the built-in antivirus from Microsoft Defender for Office 365 detonation, which is more precise than inferring the source from CloudAppEvents.
This query is part of the Microsoft Defender for Office 365 Detections and Insights workbook in Microsoft Sentinel: https://techcommunity.microsoft.com/blog/microsoftdefenderforoffice365blog/part-3-build-custom-email-security-reports-with-power-bi-and-workbooks-in-micros/4490127
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
dataTypes:
- FileMaliciousContentInfo
tactics:
- InitialAccess
- LateralMovement
relevantTechniques:
- T1566
- T1080
query: |
// DetectionMethods "Antimalware engine" indicates the built-in SharePoint Online antivirus.
FileMaliciousContentInfo
| where Timestamp > ago(30d)
| where isnotempty(ThreatTypes)
| where tostring(DetectionMethods) has "Antimalware engine"
| summarize Files = count() by ThreatName = ThreatNames
| top 50 by Files desc
version: 1.0.0
Legacy .NET Installer Packages: Development teams or IT admins frequently upload large, self-contained .NET installer packages (e.g., Setup.exe from Visual Studio, JetBrains, or Oracle) to SharePoint/OneDrive for distribution. These installers often contain embedded payloads or obfuscated code that the generic antivirus engine may flag as “Generic” or specific families like “Win32/Install” or “Trojan.Generic” due to their complex structure.
.msi, .msix, or .exe where the file path contains /Installers/, /Deploy/, or /Tools/ and the file size exceeds 50MB. Alternatively, whitelist specific known SHA-256 hashes of standard enterprise installers.Portable Development Environments: Developers often store portable versions of IDEs or runtimes (e.g., python-3.11.9-embed-amd64.zip extracted to a folder, or node.exe from a portable Node.js distribution) in OneDrive or SharePoint for quick access. The executable binaries (python.exe, node.exe, java.exe) can be flagged by AV engines as “Generic” or “Win32/Trojan” because they lack standard digital signatures or match heuristic patterns for packed executables.
portable, embed, or runtime where the parent folder contains a README.md or LICENSE file. Specifically, whitelist python.exe, node.exe, and java.exe if they reside in a folder containing site-packages or node_modules.Scheduled Backup or Log Archiving Jobs: IT operations teams use Power Automate or scheduled tasks to move large log archives or backup files (e.g., `backup_202310