Defender for Office 365: Anti-Phishing & Safe Links
Implement advanced email threat protection using Microsoft Defender for Office 365: Safe Links, Safe Attachments Dynamic Delivery, and impersonation defense.
Overview
Microsoft Defender for Office 365 (MDO) provides cloud-native perimeter and post-delivery email security defending organizations against sophisticated phishing, credential harvesting, business email compromise (BEC), zero-day malware, and malicious URLs.
Its flagship defense pillars include:
- Safe Attachments: Sandboxes all inbound email attachments in an isolated Microsoft virtual environment, detonate-testing executable payloads before releasing to user mailboxes. Features Dynamic Delivery to eliminate email latency.
- Safe Links: Provides real-time Time-of-Click URL verification. Re-writes inbound links so that if a clean URL turns malicious hours after email delivery, users are intercepted and blocked when clicking.
- Anti-Phishing & Impersonation Protection: Uses machine learning to detect user impersonation (CEO fraud) and domain spoofing.
---
When to Use: Policy Configuration Baseline
| Threat Vector | MDO Protection Feature | Recommended Production Setting |
|---|---|---|
| Unknown Malware in Attachments | Safe Attachments Policy | Dynamic Delivery (Delivers email text immediately while scanning attachment in background). |
| Malicious Links & Time-Delayed URLs | Safe Links Policy | On (Real-time URL scanning, do not rewrite links internally, do not let users click through). |
| Executive VIP Impersonation | Anti-Phishing Policy | Targeted User Protection (Protect top 100 VIP executives from display name spoofing). |
| Domain Spoofing | Anti-Phishing Mailbox Intelligence | Enabled (Quarantine impersonated messages immediately). |
---
Prerequisites
Licensing:
- Microsoft 365 E5, Office 365 E5, Microsoft 365 Business Premium, or Defender for Office 365 Plan 1 / Plan 2 add-on.
Administrative Roles:
- Security Administrator or Exchange Administrator in Microsoft Defender XDR portal (
security.microsoft.com).
---
Portal Path
Microsoft Defender XDR Portal (https://security.microsoft.com)
└── Email & collaboration
└── Policies & rules
└── Threat policies
├── Safe Attachments
├── Safe Links
└── Anti-phishing---
Step-by-Step Implementation
Step 1: Configure Safe Attachments with Dynamic Delivery
- Navigate to Defender Portal (
security.microsoft.com) > Email & collaboration > Policies & rules > Threat policies > Safe Attachments. - Click Create. Name:
MDO-SafeAttachments-Default. - Under Users, groups, and domains: Target your primary domain (e.g.,
contoso.com). - Under Safe Attachments detection response, select:
- Dynamic Delivery (Preview message with attachment placeholder).
- Redirect messages with detected attachments:
Yes> Enter security admin quarantine mailbox.
- Save policy. (Users receive the email body immediately while an attachment preview animation displays until the cloud sandbox finishes detonation).
Step 2: Configure Safe Links (Time-of-Click URL Protection)
- In Threat policies, select Safe Links > Click Create.
- Name:
MDO-SafeLinks-Enterprise. - Under URL & click protection settings:
- On: Safe Links checks a list of known, malicious links when users click links in email.
- Apply Safe Links to email messages sent within the organization:
Yes. - Apply real-time URL scanning for suspicious links and links that point to files:
Yes. - Wait for URL scanning to complete before delivering the message:
Yes. - Apply Safe Links to Microsoft Teams:
Yes. - Do not let users click through to the original URL:
Checked(Strict enforcement).
- Assign to all domains.
Step 3: Configure VIP Impersonation Protection
- In Threat policies, select Anti-phishing > Edit or create policy.
- Under Phishing threshold & sensitivity:
- Enable Protect specified users: Add executive email addresses and real display names.
- Enable Protect specified domains: Include your owned custom domains.
- Action: If impersonation is detected, Quarantine the message.
---
PowerShell Automation
Connect to Exchange Online PowerShell:
Connect-ExchangeOnline -UserPrincipalName admin@contoso.com
# Inspect active Safe Links policy settings
Get-SafeLinksPolicy | Select-Object Name, IsEnabled, ScanUrls, EnableSafeLinksForTeams, AllowClickThrough
# Inspect active Safe Attachments policy settings
Get-SafeAttachmentPolicy | Select-Object Name, Action, Redirect, RedirectAddress---
Microsoft Graph Automation
Query Email Threat Detections via Microsoft Graph Security API:
Connect-MgGraph -Scopes "SecurityEvents.Read.All"
# List recent high-severity email security alerts
Get-MgSecurityAlert_v2 -Filter "serviceSource eq 'microsoftDefenderForOffice365'" -Top 10 |
Select-Object id, title, severity, category, createdDateTime---
Verification Checklist
Diagnostic Logs & Channels
| Tool / Location | Path | Purpose |
|---|---|---|
| Threat Explorer | Defender Portal > Email & collaboration > Explorer | Interactive visual hunting tool tracking all emails, URLs, malware hashes, and clicks. |
| URL Click Protection Report | Reports > Email & collaboration > URL protection report | Audits user click activity: Clicks allowed, blocked, clicked through, or bypassed. |
---
Troubleshooting Matrix
| Error Code / Symptom | Root Cause | Exact Resolution |
|---|---|---|
| Email delivery delayed by 5+ minutes | Safe Attachments was set to Block instead of Dynamic Delivery. | Switch policy action to Dynamic Delivery to eliminate user delivery delay. |
| False positive blocks legitimate partner link | URL reputation engine flagged newly registered domain or redirection chain. | Add the URL to Tenant Allow/Block Lists under URLs as an Allow indicator. |
| Safe Links not protecting Teams chat | Apply Safe Links to Microsoft Teams checkbox was not enabled in policy. | Open Safe Links policy properties and check the Teams protection checkbox. |
---
Production Best Practices
Use Preset Security Policies (Standard vs Strict):
Instead of manually tuning dozens of individual anti-spam, anti-malware, and phishing policies, utilize Microsoft's Preset Security Policies (Strict for VIPs and IT admins; Standard for broad users). Microsoft maintains and updates optimal threshold configurations automatically.
---
MS-102 Exam Notes
High-Frequency Exam Objectives & Traps:
- Dynamic Delivery: Dynamic Delivery delivers the email text immediately while placing a placeholder icon on the attachment while scanning in the cloud sandbox.
- Time-of-Click Advantage: Safe Links protects against attacks where a legitimate website is compromised after the email has already landed in the user's inbox.
- Priority Order: Custom policies always take precedence over default policies; highest priority number evaluates first.
---