Legacy Exchange Protocols (IMAP, POP3, SMTP Auth) Audit Log Hunting
Legacy authentication protocols—including IMAP4, POP3, Authenticated SMTP, and older Exchange ActiveSync clients—cannot display interactive MFA challenges, making them prime vectors for password spraying and silent mail harvesting. AuditVane rule AV-002 automatically flags every event whose clientAppUsed or protocol signature uses legacy auth.
Detection Objective & Threat Scope
Many organizations proudly report 100% Conditional Access MFA enforcement—until an incident investigation uncovers a forgotten printer exception, a legacy service mailbox, or a Conditional Access policy excluding "Other clients" that left IMAP4 or Authenticated SMTP exposed to the internet.
Even though Microsoft deprecated legacy Basic Authentication globally across Exchange Online, OAuth-enabled legacy exceptions, SMTP Auth overrides, and residual non-modern protocol telemetry still surface regularly during password-spray sweeps and BEC investigations.
In Entra ID Sign-In JSON exports, inspect `clientAppUsed` carefully: modern browser and Office 365 clients log as `Browser` or `Mobile Apps and Desktop clients`, whereas legacy protocols log explicitly as `IMAP4`, `POP3`, `SMTP`, `Authenticated SMTP`, `Exchange ActiveSync`, `MAPI Over HTTP`, or `Other clients`.
AuditVane rule AV-002 flags all legacy `clientAppUsed` protocols as Critical—whether the login succeeded (`errorCode: 0`) or failed (`50126`/`53003`)—because failed legacy bursts prove automated password spraying targeting valid usernames.
Forensic Telemetry Fields & High-Signal Indicators
| Telemetry Field / Pattern | Meaning in M365 / Entra | High-Signal Threat Indicator |
|---|---|---|
clientAppUsed = IMAP4 / POP3 | Legacy non-MFA mailbox retrieval | High risk of silent bulk email harvesting |
clientAppUsed = Authenticated SMTP / SMTP | Legacy outbound SMTP mail relay auth | Abused for mass spam & phishing campaigns |
clientAppUsed = Exchange ActiveSync | Older mobile mail sync protocols | Verify MDM enrollment & modern auth support |
clientAppUsed = Other clients | Unclassified legacy ADAL / autodiscover / EWS | Frequently missed by narrow CA policies |
status.errorCode = 0 on legacy auth | Successful legacy login without MFA! | Treat as immediate Critical account compromise |
status.errorCode = 50126 on IMAP4 | Active credential spray hitting legacy endpoint | Block protocol at Exchange AuthenticationPolicy layer |
Hunt Legacy Auth in Sentinel KQL & Block at Exchange Front Door
// Sentinel KQL hunt:
SigninLogs
| where ClientAppUsed in ("IMAP4","POP3","SMTP","Authenticated SMTP","Exchange ActiveSync","Other clients")
| summarize Attempts=count(), Successes=countif(ResultType == 0), IPs=make_set(IPAddress) by UserPrincipalName, ClientAppUsed
# PowerShell: Enforce Exchange Authentication Policy + per-mailbox block
Set-AuthenticationPolicy -Identity "Block Legacy Auth" -AllowBasicAuthImap:$false -AllowBasicAuthPop:$false -AllowBasicAuthSmtp:$false
Get-CASMailbox -Identity "sales.rep@domain.com" | Set-CASMailbox -ImapEnabled $false -PopEnabled $false -SmtpClientAuthenticationDisabled $true
Sample Legacy Auth Hunting Summary
UserPrincipalName ClientAppUsed Attempts Successes IPs
----------------- ------------- -------- --------- ---
hr.lead@contoso-demo.invalid IMAP4 4 1 ["45.155.205.19"]
Blocking Legacy Auth: Conditional Access vs. Exchange Auth Policy
| Control Layer | Where It Evaluates | Why Both Layers Matter |
|---|---|---|
| Entra Conditional Access (Legacy Auth Block) | After primary username/password validation | Blocks token issuance (53003), but attackers can still validate passwords! |
| Exchange Set-AuthenticationPolicy | At the Exchange protocol front door | Rejects Basic Auth before password check—stops Smart Lockout & spray validation |
| Set-CASMailbox per-mailbox disable | Per individual user mailbox | Disables IMAP/POP/SMTP Auth completely unless explicitly required |
Legacy IMAP4 Sign-In JSON Record Bypassing Conditional Access
{
"createdDateTime": "2026-12-02T14:18:33Z",
"userPrincipalName": "hr.lead@contoso-demo.invalid",
"appDisplayName": "Legacy Mail Sync",
"clientAppUsed": "IMAP4",
"userAgent": "curl/8.7.1",
"ipAddress": "45.155.205.19",
"conditionalAccessStatus": "notApplied",
"status": { "errorCode": 0 }
}
Notice conditionalAccessStatus = "notApplied" combined with clientAppUsed = "IMAP4" and status.errorCode = 0—proving the attacker found an unguarded legacy gap and authenticated directly without MFA.
Real-World Incident Walkthrough
A manufacturing firm blocks modern browser logins from outside the US via Conditional Access, yet forgets to enable Authenticated SMTP blocking on a legacy scan-to-email exception group. Attackers spray stolen breach-list credentials against `IMAP4` and `Authenticated SMTP` from Bucharest (`45.155.205.19`) using `curl/8.7.1`.
Dropping the Entra Sign-In JSON into AuditVane immediately fires `AV-002` (Critical) alongside `AV-003` (`curl/8.7.1`), exposing both the successful `errorCode: 0` IMAP session and 38 sprayed accounts.
Step-by-Step Triage, Containment & Verification
- Export Entra Sign-In JSON (Interactive + Non-Interactive) and load into AuditVane to surface all AV-002 hits.
- Separate successful legacy logins (errorCode 0) for immediate password reset + containment from failed spray attempts (50126 / 53003).
- Check conditionalAccessStatus on every legacy hit—if "notApplied", locate which exclusion group or policy gap missed it.
- Deploy a tenant-wide Conditional Access policy blocking "Exchange ActiveSync clients" and "Other clients" with zero broad user exclusions.
- Enforce Set-AuthenticationPolicy and disable SmtpClientAuthenticationDisabled=$false exceptions across mailboxes using Set-CASMailbox.
- Migrate remaining scan-to-email copiers to OAuth/SMTP relay connectors or Azure Communication Services rather than leaving user SMTP Auth enabled.
How to Verify Containment Completed Cleanly
- Zero successful legacy clientAppUsed logins observed across 30 days.
- Conditional Access policy targeting legacy clients set to On (not Report-Only).
- Exchange OrganizationConfig SmtpClientAuthenticationDisabled verified True globally.
Analyst Blind Spots, Licensing Quirks & False Positives
Blocking legacy auth solely via Conditional Access still permits password validation against Entra before CA triggers—letting password sprayers identify valid passwords via error 53003 vs. 50126! Always combine Conditional Access with Exchange Authentication Policies.
Be especially careful with "Other clients" in Conditional Access—many admins target Exchange ActiveSync only and forget to check the "Other clients" checkbox.
Frequently Asked Questions
Did Microsoft already turn off Basic Authentication in Exchange Online?
Microsoft deprecated Basic Auth for IMAP/POP/EWS, yet SMTP Auth exceptions, OAuth-wrapped IMAP clients, and legacy telemetry still appear in Entra logs and must be blocked explicitly.
What does clientAppUsed = Other clients cover?
It represents legacy non-browser protocols including older Office clients, MAPI/RPC basic auth, Autodiscover, and older EWS integrations.
Does AuditVane flag failed IMAP4 password sprays too?
Yes, AV-002 alerts on all legacy clientAppUsed entries regardless of errorCode so you spot active spray campaigns early.
How do I disable SMTP Auth globally across Exchange Online?
Run Set-TransportConfig -SmtpClientAuthenticationDisabled $true and enable it only per dedicated relay mailbox if genuinely required.