Safe Attachments should be turned on for SharePoint, OneDrive and Teams
This check looks at whether Defender for Office 365 scans files in SharePoint, OneDrive and Microsoft Teams for malware. The safe setting is that the protection is turned on for the tenant; it requires a Defender for Office 365 plan.
Why it matters
Email filters only see files that arrive by email. Once a file is uploaded to a SharePoint library, a OneDrive folder or a Teams chat, it can be shared widely and opened by many people. If a malicious file gets in through a compromised account or an external share, nothing stops colleagues opening it. Safe Attachments for these services detects malicious files after upload and blocks them from being opened, moved, copied or shared.
See Microsoft's description in Safe Attachments for SharePoint, OneDrive, and Microsoft Teams.
How to check it yourself
In the Microsoft Defender portal go to Email & collaboration > Policies & rules > Threat policies > Safe Attachments, select Global settings and read Turn on Defender for Office 365 for SharePoint, OneDrive, and Microsoft Teams.
Read-only Exchange Online PowerShell, and a SharePoint Online check for the related download block:
Connect-ExchangeOnline
Get-AtpPolicyForO365 | Format-List EnableATPForSPOTeamsODB
Connect-SPOService -Url https://TENANT-admin.sharepoint.com
Get-SPOTenant | Format-List DisallowInfectedFileDownloadEnableATPForSPOTeamsODB should be True.
How to fix it
Confirm your tenant has a Defender for Office 365 plan, then turn the toggle on in Global settings and save. Settings can take up to 30 minutes to apply. Microsoft also recommends blocking downloads of detected files and creating an alert policy so admins are told about detections.
PowerShell (this changes your tenant, so run it yourself; ConfigCobra never changes your environment):
Set-AtpPolicyForO365 -EnableATPForSPOTeamsODB $true
Set-SPOTenant -DisallowInfectedFileDownload $trueWhat changes when you fix it
When a file is identified as malicious, users can no longer open, move, copy or share it, but they can still delete it. With the download block also on, nobody including admins can download the file, which matters if an admin needs to inspect a sample. Clean files are unaffected. Security administrators may receive alerts for detections, so decide who should get them. If your tenant does not have a Defender for Office 365 plan, the setting cannot be used, so check licensing before you plan the change. Tell SharePoint site owners and Teams users beforehand that a blocked file is expected behaviour and should be reported to the security team rather than worked around.
Included in
| Benchmark | CIS ID | Profile |
|---|---|---|
| CIS Microsoft 365 Foundations v7.0.0 | 2.1.5 | E5 Level 2 |
More checks in Microsoft Defender
- Safe Links for Office Applications should be enabledCIS 2.1.1
- The common attachment types filter should be enabledCIS 2.1.2
- Notifications for internal users sending malware should be enabledCIS 2.1.3
- Safe Attachments policy should be enabledCIS 2.1.4
- Exchange Online spam policies should notify administratorsCIS 2.1.6
Go further
- Microsoft Defender21 controls in this section
- CIS Microsoft 365 Foundations v7.0.0160 controls
- CIS Microsoft 365 Foundations checklistEvery control in one list, as CSV
- RemediationSee what a fix changes in your tenant before you apply it, then use the generated script
- Monitoring & DriftScheduled scans, drift detection and email alerts when a control regresses
Check this on your Microsoft 365
ConfigCobra runs this check with every other control of the CIS Microsoft 365 Foundations Benchmark, read-only.