How to Stop Device-Code Phishing in Microsoft 365

How to Stop Device-Code Phishing in Microsoft 365

Device-code phishing is a Microsoft 365 attack that tricks people into approving a sign-in for someone else. The attacker can then use the stolen access token to reach email, files, and other company services.

Device codes hide the login

Device code flow helps devices that have limited keyboards or no web browser. A user enters a short code on another device. The service then completes the sign-in.

Attackers abuse this normal process. They send a message about a meeting link, document review, or account warning. The message directs the target to a fake sign-in page.

The page starts a real Microsoft sign-in request. It then tells the target to enter a code. The target may see a familiar Microsoft screen and trust the request.

Microsoft reported an AI-enabled device-code phishing campaign on April 6, 2026. The campaign used automation, dynamic codes, and fake technical pages. (Microsoft Security Blog)

Token theft outlives passwords

A successful device-code attack can give the attacker an access token. A token is digital proof that a service has authenticated a user.

The attacker may use that proof without knowing the victim’s password. The token can provide access to connected services and stored data. Microsoft says the technique can support account access, data theft, and lateral movement. (Microsoft Digital Defense Report 2025)

The victim may complete multifactor authentication. The attacker can still receive valid access and refresh tokens. The victim’s credentials may never be exposed. (Microsoft Security Blog)

That difference matters. Microsoft says standard session revocation may leave existing access tokens active for up to one hour.

Organizations should review sign-in activity after suspected token theft. They should also revoke refresh tokens and consider temporarily disabling the account. (Microsoft Security Blog)

Microsoft 365 defenses

Microsoft recommends blocking device code flow by default. The control is available through Microsoft Entra Conditional Access policies.

Device code flow should remain enabled only for approved devices or services that need it. Microsoft describes the flow as useful for input-constrained devices. Administrators can block it when legitimate use is uncommon. (Microsoft Entra identity guidance)

Security teams should also watch for unusual device-code authentication. Microsoft Defender for Identity includes alerts for activity that differs from a user’s normal sign-in pattern.

Those alerts can identify unusual applications, locations, or network addresses. They can help teams investigate possible token abuse. (Microsoft Defender for Identity alerts)

Safer sign-in habits

Never enter a device code because an unexpected message tells you to do so. Treat codes from chat messages, email, and social networks as suspicious.

Check the application name shown during authentication. A request for an unfamiliar application is a warning sign. Cancel the request when the application does not match your task.

Open Microsoft services through a saved bookmark or a known company portal. Do not rely on a link supplied by an unknown sender. A familiar logo does not prove that a page is genuine.

Use phishing-resistant authentication for important accounts. FIDO and WebAuthn authentication use cryptographic checks that fake websites have difficulty copying.

CISA describes phishing-resistant multifactor authentication as the gold standard. It also says SMS and one-time password methods remain vulnerable to phishing. (CISA phishing-resistant MFA guidance)

If you entered a device code after following an unexpected message, report it quickly. Contact your organization’s security team or Microsoft 365 administrator. Include the message, time, website address, and application name.

Device-code phishing works because the sign-in request can be real. The deception happens before approval. Blocking unnecessary device-code flow and questioning unexpected prompts removes much of the attacker’s advantage.

References

Cybersecurity and Infrastructure Security Agency. (2022, October). Implementing phishing-resistant MFA. https://www.cisa.gov/sites/default/files/publications/fact-sheet-implementing-phishing-resistant-mfa-508c.pdf

Microsoft. (2025). Microsoft Digital Defense Report 2025: Safeguarding trust in the AI era. https://cdn-dynmedia-1.microsoft.com/is/content/microsoftcorp/microsoft/bade/documents/products-and-services/en-us/security/Microsoft-Digital-Defense-Report-2025-v4-05Nov25.pdf

Microsoft Defender Security Research Team. (2026, April 6). Inside an AI-enabled device code phishing campaign. Microsoft Security Blog. https://www.microsoft.com/en-us/security/blog/2026/04/06/ai-enabled-device-code-phishing-campaign-april-2026/

Microsoft. (n.d.). Configure Microsoft Entra for Zero Trust: Protect identities and secrets. Microsoft Learn. https://learn.microsoft.com/en-us/entra/fundamentals/zero-trust-protect-identities

Microsoft. (n.d.). Microsoft Defender for Identity alerts in Microsoft Defender format. Microsoft Learn. https://learn.microsoft.com/en-us/defender-for-identity/alerts-xdr