Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zero Trust Email Security

Platform Defender for Office 365 Safe Attachments Safe Links Anti-Phishing Secure Score PowerShell License

Zero Trust Pillar: Email | Part of a 7-project Microsoft 365 Security Portfolio
← Project 2: Device Trust | Project 4: TVM →


Overview

This project implements a Zero Trust email security framework using Microsoft Defender for Office 365 Plan 2 across the Patchthecloud.onmicrosoft.com tenant. Email is treated as an untrusted entry point — every attachment is detonated before delivery, every link is inspected at click time, and sender identity is continuously validated against known impersonation patterns.

The implementation covers the full defence-in-depth stack: pre-delivery sandbox analysis (Safe Attachments), click-time URL inspection (Safe Links), identity-based phishing detection (Anti-Phishing with mailbox and spoof intelligence), user-reported threat visibility, and post-delivery automated remediation. Secure Score increased by +55 points across the two-day implementation window.


Business Problem

Layer Problem
Attachment threats Malicious files reach user mailboxes without pre-delivery analysis
URL-based attacks Phishing links embedded in email bypass perimeter controls after delivery
Impersonation / BEC CEO fraud and domain spoofing exploit trusted sender relationships
User behaviour gap Users have no structured mechanism to report and escalate suspicious email
Visibility SOC has no unified telemetry for email-borne threats, clicks, or remediation events

Objectives

  • Deploy Safe Attachments with Block action and quarantine using AdminOnlyAccessPolicy
  • Deploy Safe Links with full URL rewriting, real-time scanning, and Teams/Office app coverage
  • Configure anti-phishing with mailbox intelligence, domain impersonation protection, and spoof intelligence
  • Enable user-reported phishing and validate via attack simulation
  • Demonstrate measurable Secure Score improvement as evidence of controls applied

Environment

Component Value
Tenant Patchthecloud.onmicrosoft.com
Licence Microsoft 365 Business Premium / Defender for Office 365 Plan 2
Test Mailbox Johnsen@Patchthecloud.onmicrosoft.com
External Test Sender tara@msteamsexternalone.com
Defender Portal security.microsoft.com
Implementation Date 10–11 January 2026

Architecture

flowchart TD
    A[External Sender] --> B[Exchange Online\nInbound Mail Flow]
    B --> C{Defender for Office 365\nEmail Inspection Pipeline}

    C --> D[Safe Attachments\nSandbox Detonation]
    C --> E[Anti-Phishing\nImpersonation + Spoof Intelligence]
    C --> F[Anti-Malware\nSignature Scan]

    D -->|Clean| G[Deliver to Mailbox]
    D -->|Malware detected| H[Block + Quarantine\nAdminOnlyAccessPolicy]

    E -->|Legitimate| G
    E -->|Impersonation / Spoof| I[Quarantine\nAdminOnlyAccessPolicy]

    G --> J[User Mailbox\nPatchthecloud.onmicrosoft.com]

    J --> K{User Action}
    K -->|Click link| L[Safe Links\nReal-time URL Scan]
    L -->|Safe URL| M[Allow — Redirect to destination]
    L -->|Malicious URL| N[Block page displayed]

    K -->|Report suspicious mail| O[User-Reported Phishing\nDefender Ingestion]
    O --> P[Threat Intelligence\nDefender XDR Correlation]

    subgraph PostDelivery["Post-Delivery Protection — Assume Breach"]
        Q[Zero-Hour Auto Purge\nZAP]
        R[Historical email scan\nRetroactive quarantine]
    end

    J --> PostDelivery

    subgraph Visibility["Control & Visibility Plane"]
        S[Defender XDR\nIncidents & Alerts]
        T[Microsoft Secure Score\n+55 pts increase]
    end

    H --> S
    I --> S
    P --> S
    PostDelivery --> S
Loading

Microsoft Technologies

Technology Role
Microsoft Defender for Office 365 Plan 2 Unified email threat protection platform
Safe Attachments Pre-delivery sandbox detonation of all email attachments
Safe Links Click-time URL rewriting and inspection (Email, Teams, Office apps)
Anti-Phishing Policy Mailbox intelligence, domain impersonation, spoof intelligence
User-Reported Phishing Converts user reports into Defender threat signals
Zero-Hour Auto Purge (ZAP) Retroactive post-delivery removal of detected threats
Microsoft Secure Score Measurable security posture improvement tracking
Attack Simulation Training Real-world phishing simulation and user awareness validation

Configuration Overview

Safe Attachments — Safe Attachments

Setting Value
Action Block — current and future messages with detected malware
Quarantine policy AdminOnlyAccessPolicy
Redirect attachments Disabled
Applied to All recipients
Date configured 10 January 2026

Enterprise rationale: Block action prevents any attachment from reaching users when malware is detected — including blocking subsequent messages from the same sender. AdminOnlyAccessPolicy ensures quarantined items require administrator review before release.

Safe Links — Safe Links Policy

Setting Value
Priority 0 (highest)
Status On
Email — Safe Links enabled On
Apply to internal email On
Real-time URL scanning On
Wait for scan before delivery On
Do not rewrite (API-only mode) On
Teams On
Office 365 Apps On
Date configured 11 January 2026

Enterprise rationale: Wait for URL scanning before delivery eliminates the race condition where users receive email before links are evaluated. Teams and Office app coverage closes the gap where attackers pivot to non-email channels.

Anti-Phishing — Create impersonation protection Policy

Setting Value
Scope Patchthecloud.onmicrosoft.com (all mailboxes)
Phishing threshold 1 — Standard
User impersonation protection On
Domain impersonation — owned domains On
Mailbox intelligence On
Mailbox intelligence for impersonations On
Spoof intelligence On
Action — user impersonation Quarantine (AdminOnlyAccessPolicy)
Action — domain impersonation Quarantine (AdminOnlyAccessPolicy)
Action — mailbox intelligence match Quarantine (AdminOnlyAccessPolicy)
Action — spoof + DMARC quarantine Move to Junk Email
Action — spoof + DMARC reject Quarantine (Default full access policy)
Action — spoof intelligence Move to Junk Email
First contact safety tip On
User impersonation safety tip On
Domain impersonation safety tip On
Date configured 11 January 2026

Security Controls

Control Implementation Zero Trust Principle
Pre-delivery attachment scanning Safe Attachments — Block + AdminOnlyAccessPolicy quarantine Verify Explicitly
Click-time URL protection Safe Links — real-time scan + rewrite Verify Explicitly
Identity-based phishing detection Anti-phishing — mailbox + spoof intelligence Verify Explicitly
User-driven threat visibility User-reported phishing → Defender ingestion Assume Breach
Post-delivery remediation Zero-Hour Auto Purge (ZAP) Assume Breach
Email security posture measurement Secure Score +55 pts Least Privilege access to email

Validation & Testing

Test Method Result
Safe Attachments active Policy list: Safe Attachments — On, Priority 0 ✅ Confirmed
Safe Links active Policy list: Safe Links Policy — On, Priority 0 ✅ Confirmed
Anti-phishing policy created Confirmation banner: policy created, in effect immediately ✅ Confirmed
Attack simulation — user response John Sen correctly reported phish from tara@msteamsexternalone.com ✅ Passed
Secure Score improvement +55 points across 10–11 January 2026 ✅ Confirmed (CSV)

See docs/06-validation-testing.md for full test case documentation.


Secure Score Impact

Points gained directly from this implementation (verified from exports/Microsoft-Secure-Score.csv):

Action Points Date
Enable impersonated user protection 8/8 11 Jan 2026
Move messages detected by mailbox intelligence 8/8 11 Jan 2026
Quarantine messages from impersonated users 6/6 11 Jan 2026
Quarantine messages from impersonated domains 6/6 11 Jan 2026
Ensure intelligence for impersonation protection enabled 8/8 11 Jan 2026
Enable user impersonation safety tip 3/3 11 Jan 2026
Enable domain impersonation safety tip 3/3 11 Jan 2026
Enable user impersonation unusual characters safety tip 3/3 11 Jan 2026
Defender for Office 365 in SharePoint/OneDrive/Teams 5/5 10 Jan 2026
Turn on Safe Documents for Office Clients 5/5 10 Jan 2026
Total +55 pts

PowerShell Scripts

Script Purpose
New-DefenderEmailPolicies.ps1 Deploy Safe Attachments, Safe Links, and Anti-Phishing policies via Exchange Online PowerShell
Get-SecureScoreReport.ps1 Export Secure Score history and recommended actions to CSV via Microsoft Graph
Get-EmailThreatReport.ps1 Export email threat detection summary from Defender for Office 365 via Graph

Screenshots

Reference File Shows
A1 images/A1-safe-attachments/ Safe Attachments policy list — On, Priority 0
A2 images/A2-safe-links/ Safe Links policy list — On, Priority 0
A3 images/A3-impersonation-protection/ Anti-phishing policy created confirmation
A4 images/A4-report-phishing/ Attack simulation result — user correctly reported phish
A5 images/A5-secure-score/ Secure Score graph showing upward trend post-implementation

See docs/screenshots-placement-guide.md for source → destination mapping.


Lessons Learned

  • Safe Attachments Block mode delays delivery. Sandbox detonation adds latency. Communicate to users before enabling in production.
  • "Do not rewrite URLs" + API-only mode is not reduced security. Defender still evaluates every URL via the Safe Links API — this mode prevents URL modification in email body, improving compatibility with mail clients that break rewritten links.
  • Anti-phishing threshold 1 (Standard) is appropriate for most tenants. Increasing to 4 (Aggressive) significantly increases false positives on internal business email. Tune based on SOC capacity to review quarantine.
  • User-reported phishing single reports may not generate alerts. This is documented Defender behaviour — alerts are generated when reports correlate with other signals. Single-user reports still contribute to threat intelligence.
  • Secure Score is a lagging indicator. Points register after Defender detects and scores the control, not immediately after policy creation.

Troubleshooting

Symptom Likely Cause Resolution
Legitimate email quarantined Anti-phishing false positive Review quarantine → release + add sender to trusted senders list
URL not being rewritten API-only mode enabled Expected behaviour — Defender still scans via API
Safe Attachments delay Sandbox detonation in progress Inform users; configure Wait for scanning only on high-risk groups if latency unacceptable
Secure Score not updating Score refreshes every 24 hours Wait 24h; verify policy is saved and assigned
Attack simulation blocked by Safe Links Safe Links evaluated the test URL Use Microsoft-provided simulation URLs from Attack Simulation Training to avoid false blocks

Future Improvements

  • Increase anti-phishing threshold to 2 (Aggressive) for executive accounts
  • Add named VIP users to user impersonation protection list
  • Enable Attack Simulation Training recurring campaigns for user resilience measurement
  • Connect Defender for Office 365 alerts to Microsoft Sentinel for unified SOC visibility
  • Configure DMARC p=reject on Patchthecloud domain to prevent outbound spoofing
  • Enable Safe Documents (block exit from Protected View) for high-risk user groups

References

About

Zero Trust email security implementation using Microsoft Defender for Office 365 — Safe Attachments, Safe Links, anti-phishing, and automated post-delivery remediation.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages