DEV Community

Cover image for Locking Down Microsoft 365 Against Phishing: DMARC, Conditional Access, and Device Code Flow
Uprite Services
Uprite Services

Posted on

Locking Down Microsoft 365 Against Phishing: DMARC, Conditional Access, and Device Code Flow

I pulled 51 Fort Worth business domains from our CRM last month and checked their public DNS records. Not a scientific study. Just wanted to see how the DMARC situation looked for companies we actually talk to.

Forty-seven of those domains receive email. Twenty-four of them, 51%, have no DMARC enforcement. Ten never published a record. Fourteen published one and left the policy at p=none, which collects reports and blocks nothing. Of the 27 running Microsoft 365, nine still don't enforce DMARC.

That's the starting point for this post. If you're managing a Microsoft 365 tenant for a company under a few hundred people, here's the order I'd lock things down.

What's Beating MFA Right Now

Two attack paths matter here because they don't care about your authenticator app.

Adversary-in-the-middle kits work like this: attacker spins up a reverse proxy between the target and Microsoft's real login page. Everything passes through. The employee types their password, gets the MFA prompt, approves it. Normal experience. But the proxy captures the session token that Microsoft sends back. Attacker has a fully authenticated session. Text codes don't help. Push notifications don't help. TOTP doesn't help. The second factor completes successfully, and that's exactly the problem.

Device code phishing is weirder. It abuses the OAuth device authorization grant, the flow designed for devices that don't have a browser. Smart TVs, IoT hardware, that kind of thing. Attacker generates a device code through Microsoft's API, then emails it to the target. "Enter this code at microsoft.com/devicelogin to view the shared document." Target goes to that URL. It's real. Microsoft's actual page. They authenticate, and the attacker's registered application receives the tokens on the other end. No fake login page anywhere in the chain.

The FBI IC3 2025 report recorded $3.05 billion in BEC losses. Texas filed 97,912 complaints. Second only to California. These mechanisms are what's driving those numbers now, not the spray-and-pray credential harvesting from five years ago.

Layer 1: Getting DMARC to Reject

DMARC tells a receiving server what to do when email fails SPF or DKIM alignment for your domain. At p=none it just reports. At p=reject it drops the message. The difference between those two settings is the difference between knowing you're being spoofed and actually stopping it.

Here's the sequence that works without breaking legitimate mail:

Publish at p=none first. TXT record goes at _dmarc.yourdomain.com. Set rua to an address you'll actually check. This starts collecting XML reports showing who's sending as your domain.

Spend two to four weeks reading those reports. You're looking for services that send legitimate email on your behalf but fail alignment. Newsletter platforms, CRMs, transactional email from your app, ticketing systems. Get their SPF and DKIM records sorted before you tighten anything.

Move to p=quarantine. Failing messages land in spam now. Keep watching for a week or two. If somebody's vendor emails start disappearing, you missed a sender.

Move to p=reject. Failing messages get dropped. Total timeline from first publish to enforcement: usually four to eight weeks.

Gotcha: check your SPF termination. Nineteen of the 47 domains in that metro check ended in ~all instead of -all. Soft fail is a suggestion. Hard fail is an instruction. Switch to -all once you've confirmed your senders are covered.

Gotcha: SPF has a 10-DNS-lookup limit. Stack too many include: statements that chain to other includes and you silently exceed it. The whole record fails open. MXToolbox or dmarcian will tell you where you stand. Flatten or consolidate before it breaks something quietly.

Layer 2: Block Device Code Flow in Conditional Access

If nobody in your org signs into Microsoft 365 from a device without a browser, you can shut this door completely.

You need Conditional Access, which means Entra ID P1. That's included in Microsoft 365 Business Premium, so most SMBs already have it and don't realize it.

Create a new policy. Target all users or a pilot group. Under Conditions > Client apps, pick Device code flow and Authentication transfer. Set to Report-only. Leave it for a week. Check the sign-in logs for anything legitimate using device code auth. If it's clean, switch to Block.

Do legacy authentication at the same time. These protocols predate modern auth entirely. They don't support MFA. Period. If they're still allowed in your tenant, they're an open door you forgot to close.

Gotcha: test before enforcing. I've seen orgs block device code flow and immediately break a conference room display that was using it for calendar. Not a security incident, but a lot of annoyed people. Report-only mode exists for this exact reason.

Layer 3: Phishing-Resistant Authentication

Passkeys and FIDO2 keys bind the authentication to the origin domain cryptographically. A phishing site on a different domain cannot trigger the key. That's not a policy that could be bypassed. It's how the cryptography works.

Rollout priority that makes sense for a small company:

Admins first. Global admins, Exchange admins, anyone with privileged roles in Entra ID. These are the accounts where a compromise causes the most damage.
Finance and payment approvers next. BEC specifically targets these roles because they control the money.
Everybody else after those two groups are stable.

For users without phones or who won't carry a hardware key, Authenticator with number matching is better than simple push. It's not phishing-resistant though. NIST SP 800-63B-4 and CISA advisory AA23-320A both draw the line at FIDO2.

What None of This Fixes

I want to be specific about limits. You can configure Entra ID perfectly and still lose money to a compromised mailbox if your payment process relies on email alone. An attacker who's been reading threads for weeks will reply inside a real conversation with new bank details. The email is authentic. It came from the real account. Conditional Access won't flag it because the attacker already has a valid session.

The fix is a policy, not a setting. Phone callback to a known number before any bank detail change. Second approver above a threshold. The number has to come from your records, not from the email.

Same for help desk resets. CISA's Scattered Spider advisory describes attackers calling help desks and social engineering their way to password and MFA resets. If your process doesn't require a callback to verify the caller, your Entra ID config doesn't matter.

Three things in order. DMARC at reject. Device code flow blocked. Phishing-resistant sign-in on privileged accounts. All of this ships with Microsoft 365 Business Premium or happens in DNS. Weeks, not months.

Top comments (0)