# Zero-hour auto purge (ZAP) is enabled for malware, phishing, and spam in email

Email content can be judged clean at the moment of delivery and later be reclassified as malware, phishing, or spam once new threat intelligence arrives.

Source: https://maester.dev/docs/tests/ZTA.41039

<!-- This file is generated by website/scripts/generate-test-docs.mjs. Do not edit manually. -->

## Overview

Email content can be judged clean at the moment of delivery and later be reclassified as malware, phishing, or spam once new threat intelligence arrives. Without zero-hour auto purge, that reclassified message stays in the user's inbox, the user opens the attachment or follows the link in the minutes or hours after delivery, and the threat actor obtains the credential or executes the payload — the protection arrived but never reached the user. Zero-hour auto purge, a capability of Exchange Online Protection available to all cloud mailboxes, retroactively moves the message to quarantine or the Junk Email folder after the verdict changes, closing the gap between delivery and detection. This check confirms zero-hour auto purge is enabled for malware, phishing, and spam in email, so a delayed verdict still results in containment.

## Remediation

- [Zero-hour auto purge (ZAP) in Exchange Online](https://learn.microsoft.com/en-us/defender-office-365/zero-hour-auto-purge)
- [Set-MalwareFilterPolicy](https://learn.microsoft.com/en-us/powershell/module/exchange/set-malwarefilterpolicy)
- [Set-HostedContentFilterPolicy](https://learn.microsoft.com/en-us/powershell/module/exchange/set-hostedcontentfilterpolicy)

## Run it

The check runs as part of the whole assessment, with the ZeroTrustAssessment module installed:

```powershell
Install-Module ZeroTrustAssessment -Scope CurrentUser
Connect-Maester
Invoke-Maester -Pack ZTA -SkipBuiltIn
```

Leave out `-SkipBuiltIn` to run Maester's own checks in the same run.

<details>
<summary>About this check</summary>

| | |
| --- | --- |
| Severity | High |
| Effort to fix | Low |
| Impact on users | Low |
| Pillar | SecOps |
| Category | Email and collaboration security |
| Product | [Defender](/docs/tests/products/defender) |
| Feature | Zero-hour auto purge |
| Area | Email and collaboration protection |
| ATT&CK | [T1566](/docs/tests?mitre=T1566) Phishing |
| Licence | EXCHANGE_S_STANDARD |
| Tenant | Workforce |

Product, feature, area and ATT&CK are Maester's: the assessment does not record them, so Maester keeps them in the pack's `taxonomy.json`.

</details>

<p class="mt-ms-note not-content"><svg class="mt-ms-note__logo" viewBox="0 0 21 21" aria-hidden="true"><rect width="10" height="10" fill="#f25022"/><rect x="11" width="10" height="10" fill="#7fba00"/><rect y="11" width="10" height="10" fill="#00a4ef"/><rect x="11" y="11" width="10" height="10" fill="#ffb900"/></svg><span>A Microsoft check, part of the <a href="/docs/tests/packs/zero-trust-assessment">Zero Trust Assessment</a> pack. Text from ZeroTrustAssessment 3.1.0, © Microsoft, <a href="/docs/tests/packs/zero-trust-assessment#licence">MIT licence</a>.</span></p>
