How device code phishing works: nothing broke and the attacker still got in, shown as seven steps inside Microsoft Entra ID that all work as designed.

How Device Code Phishing Works When Nothing Is Broken

December 03, 2026•15 min read

How device code phishing works · Part 3 of 4

In Part 1 of this series, Dana typed a short code from a Teams invite on Microsoft's legitimate sign-in page. She approved the same MFA prompt she approves every day, and an attacker left with her access. But nothing she did was careless, and nothing on her screen looked wrong.

This part is for the people who get the call afterward (the ones who read the sign-in logs and have to answer "how did they get in?"). It walks the seven steps inside Microsoft Entra ID and shows how each of Microsoft's three documented attacks bends them. It also covers what Entra ID writes down along the way. Then it marks where each of the five tenant situations from Part 1 brings the attack to a stop.

In short: Device code phishing works through a legitimate sign-in flow, in seven steps. The attacker asks Microsoft for a code, gets an employee to enter it at microsoft.com/devicelogin within 15 minutes, and the employee signs in with MFA. Entra ID then hands an access token and a refresh token to the attacker's app, which has been polling for them. In the five situations from Part 1, the attack stops only where security defaults or a Conditional Access policy blocks the device code sign-in itself.

The seven steps

What actually happens when someone types the code?

Device code flow is an open industry standard before it's a Microsoft feature. The standard describes a short exchange: the device asks an authorization server for two codes and shows a person the short one and a web address. Then it keeps asking whether that person has finished signing in somewhere else.

The IETF (the Internet Engineering Task Force, the body that publishes internet standards) published it as RFC 8628 (the OAuth 2.0 device authorization grant) for devices that can't easily take a password, like a smart TV or a meeting-room screen.

Microsoft's version, device code flow in Microsoft Entra ID, hews closely to the standard. Here's how it maps to the seven steps the simulator walks through:

How device code phishing works, step by step

  • Step 1, attacker requests device code. An app asks Entra ID's device code endpoint for a code, naming itself (a client ID) and the permissions it wants (scopes, in OAuth terms). In an attack, the attacker picks both.

  • Step 2, device code returned. Entra ID answers with a short user code for a person, a long device code the app keeps, and the address microsoft.com/devicelogin. The countdown starts here: by default, the person has 15 minutes.

  • Step 3, attacker sends the code. This step isn't in the standard at all. It's the lure, the impetus to type the code (a meeting invite, an invoice, a phone call from "IT").

  • Step 4, employee enters device code. On Microsoft's legitimate page, often wearing your company's own branding (logo, background and sign-in text).

  • Step 5, employee signs in with MFA. Password and MFA, the same prompt your people approve every day.

  • Step 6, attacker gains access. All this time, the attacker's app has been polling Entra ID's token endpoint (asking again and again whether the sign-in is done) and hearing "authorization pending." The first poll after the sign-in completes returns an access token (good for about an hour in Microsoft's example). When the app asked for ongoing access, it also returns a refresh token that lasts 90 days by default.

  • Step 7, attacker uses the access. Whatever the employee can reach, within what that app has permission to do on the employee's behalf (delegated access).

Why every step of device code phishing works as designed

One detail matters more than the rest. The code ties the sign-in inextricably to the app that asked for it, not to the person or the device typing it. Microsoft says Entra ID has no reliable way to confirm that the person entering the code is on the device that requested it. Every step works exactly as designed. So a technologist who knows the flow sees this attack sooner than one who only knows the tools.

How device code phishing works in seven steps inside Microsoft Entra ID: the attacker requests a code, the employee enters it and signs in with MFA, and Entra ID issues tokens to the attacker's app.

Want to walk these seven steps against your own tenant? Contact Shawn to schedule a call.

Documented campaigns

What changes in each of the three device code phishing attacks?

The seven steps never change. What changes is how attackers handle the two hard parts: the 15-minute limit and a believable reason to type the code. Microsoft has documented three very different approaches.

Storm-2372: the meeting code that was ready too early

In the campaign Microsoft tracked as Storm-2372 (now assessed as part of Midnight Blizzard), step 3 started well before the invite. The attackers built rapport over WhatsApp, Signal and Teams while posing as a prominent contact. Then they sent a fake Teams meeting invite with the code as the purported meeting ID. Because the code was already in the invite, its 15 minutes had already started when the invite landed.

After step 6, they used Microsoft Graph (the single API that reaches Microsoft 365 and Entra ID data) to search mailboxes for words like "password," "admin" and "credentials," took the matching mail, and phished coworkers from the victim's own account. Then they changed one detail at step 1.

In a February 14, 2025 update, Microsoft reported that they'd begun requesting codes as Microsoft Authentication Broker, whose refresh token can request a token for the Device Registration Service. With it, they registered a device they controlled in Entra ID and used it to obtain a Primary Refresh Token (a long-lived sign-in credential tied to that device). They also routed sign-ins through proxies near each target, likely to make them look ordinary.

April 2026: the code made on the click

The campaign Microsoft described in April 2026 surmounted the 15-minute limit. Lures the attackers wrote with AI matched each target's role (invoices, requests for proposal), and the campaign also used shared-document, e-signature and voicemail themes. Links bounced through redirects on well-known hosting services to confound URL scanners. Steps 1 and 2 didn't happen until the person clicked. As Microsoft puts it, the 15-minute countdown began only when the victim landed on the malicious page, and the page often copied the fresh code to the clipboard.

At step 5, Microsoft notes a detail worth knowing. Someone with no active session enters a password and MFA, but someone already signed in only has to paste the code and confirm. After the sign-in, the page sent the person on to an ordinary site (DocuSign, Google or Microsoft). In some cases the attackers registered a new device within 10 minutes to get a Primary Refresh Token. In others they waited hours, then mapped the organization through Microsoft Graph, hunted for wire transfer details and pending invoices, and set inbox rules to hide messages.

September 2026: the call from "IT"

In the activity Microsoft reported in September 2026, step 3 was a call or text to a personal phone from someone claiming to be the help desk. The pretext: a passkey, MFA or single sign-on setting needed an urgent update. Device code phishing was one of three paths Microsoft saw behind that pretext (the others were adversary-in-the-middle phishing and compromised credentials, where an authenticator app already on the account satisfied MFA).

Once in, the attackers registered an MFA method they controlled (a software token, for example). Then they used Microsoft Graph to inventory users, groups, directory roles, authentication methods and applications. They also worked through SharePoint, OneDrive and email at a deliberate pace (fewer than 1,000 files or emails in any one hour) for hours to days. Microsoft adds a point every service desk should hear. When the lure arrives on a personal phone, the employee's memory of the call can be the earliest, and sometimes the only, evidence.

The code was hers, the access wasn't: an employee enters a code at home during a call from "IT" while an attacker's screen changes from pending to success.

That's why Part 1 spent time on the service desk (an illustration, not a documented case). When Sam calls in because his code timed out, oblivious to the attack, he's handing your technician that earliest evidence. A technician who knows these seven steps hears "IT called me about a code" and recognizes step 3 in progress. But one who doesn't helps Sam finish it.

The sign-in record

What does Entra ID write down when device code phishing works?

If you read sign-in logs for a living, here's the uncomfortable part: almost everything Entra ID records is accurate. The employee did sign in. The employee satisfied MFA. The app did get access.

Here's roughly what the record holds at each step (a description, not a hunting guide):

  • Steps 1 to 3. These happen between the attacker, Microsoft's device code endpoint and your employee's inbox or phone. Microsoft's documentation doesn't describe a sign-in record for the code request itself, so don't count on one.

  • Steps 4 and 5. The sign-in carries the authentication protocol "Device code" in the sign-in logs, along with the employee's name, the app the attacker chose, and a successful result.

  • Step 6. Later token refreshes in that session are more equivocal: they may not show device code as the authentication protocol at all. Entra ID keeps a separate property, Original transfer method, set to "Device code flow," because it follows the session through every refresh (Microsoft calls this protocol tracking).

  • Step 7. What the attacker does next lands in other records: Microsoft Graph activity, mailbox access and new inbox rules, a new device registration, or a newly registered MFA method (an "Update user" event with a new software token, in Microsoft's September report).

But read one event at a time and none of it looks like an attack. The craft is knowing which of those records belong together, and in what order. Part 4 picks up from here: what the signs look like after the fact, and why they're so hard to catch.

Three documented device code phishing attacks compared (Storm-2372, April 2026 and September 2026) by lure, timing, persistence and target.

The five situations

Where does each tenant stop device code phishing?

Where the attack ends depends on your tenant (your organization's Microsoft 365 and Entra ID environment) and two Microsoft protections: security defaults (free, preset and either all on or all off) and Conditional Access (the sign-in policy engine that comes with Entra ID P1).

Part 1 of this series sorted tenants into five situations by which of these is in place, and Part 2 covered what each one costs the business.

Which situation is your tenant in?

Here's where the seven steps end in each situation (where the attack stops, not how to configure anything):

  • No protection. Security defaults are off, and no Conditional Access policy blocks device code flow. Nothing stops the attack, and all seven steps run.

  • Security defaults on, tenant created on or after July 1, 2026. Microsoft says security defaults block device code sign-ins, and every new tenant has had that block since July 1, 2026. The sign-in fails at step 5, so no token reaches the attacker. A meeting-room screen that legitimately signs in with a code fails at the same step, because security defaults allow no exceptions.

  • Security defaults on, tenant created before July 1, 2026. Same block. Microsoft's security defaults page ties it to security defaults being on, and Microsoft's Warehouse Management page says existing tenants with them on have it too. The sign-in fails at step 5.

  • Conditional Access, but no device code policy. A tenant has to turn security defaults off to use Conditional Access, so that block is gone too. With no policy that blocks device code flow (and Microsoft's managed one still in report-only mode, if it's there), all seven steps run. A license on its own blocks nothing.

  • Conditional Access with a policy that blocks device code flow. The policy can be one your team built or Microsoft's managed block policy once it's turned on. The sign-in fails at step 5, so no token reaches the attacker. Entra ID also tracks which sessions started with device code flow (protocol tracking). So the block applies when one of those sessions later refreshes its tokens, not only at the first sign-in.

Set up once, never checked again: a dusty Conditional Access setup binder beside a sign-in log that shows a successful device code sign-in.

Why set up once isn't the same as protected

This is where one belief does the most damage: "We set it up, so we don't have to think about it anymore." It's an understandable belief, especially in a tenant that's run well for years. But device code flow was never part of anyone's setup. Its permission is tacit: it stays available until something blocks it.

Microsoft's managed policy can sit in report-only mode (watching, not blocking) until Microsoft turns it on (usually no less than 30 days after it appears) or someone sets it to Off. And a Teams device exception is account-scoped. The excluded account can use device code flow for any app the policy covers, for as long as nobody looks at it again. A sharp technologist re-checks where the tenant stands, because the answer can change without anyone in the tenant touching a setting (a managed policy switching on, for example).

Where each of five tenant situations stops device code phishing: without a block all seven steps run; a blocking setup stops the sign-in at step 5.

Start with how device code phishing works

Picture the next time leadership asks, "Could this happen to us?" Instead of "I think we're covered," you walk them through the seven steps in five minutes. You show where the code comes from, why MFA doesn't stop it, what the logs will and won't show, and the exact step where your tenant stops it (or doesn't). That answer comes from craft, and you can learn the craft. Leadership gets an answer it can defend, and the board, the auditor and the insurer all hear the same one.

Seven steps, one clear answer: a technologist walks leadership through how device code phishing works and circles step 5, where the tenant stops it.

One thing to do today: open the Intermediate level of the Device Code Phishing What-If Simulator and walk the seven steps against the situation your tenant is in. Then tell your team the step where your tenant stops it, and show them how you know.

Schedule a call

For your executives (the two to hand the people you report to):

Next for you:

  • Part 4: Why Device Code Phishing Is Hard to Catch and Close covers what MFA and tenant defaults miss, the signs it already happened and the legitimate uses your team will need to keep.

Frequently asked questions

Should I block device code flow?

Yes. Device code flow (a sign-in for devices without a keyboard) has tacit permission (nobody grants it out loud): it stays available until something blocks it, and device code phishing (luring an employee into typing an attacker's code) stops only at that block. Security defaults (free, preset protections that are all on or all off) or a Conditional Access (the sign-in policy engine that comes with Entra ID P1) policy can block it, but security defaults allow no exceptions, so a meeting-room screen that signs in with a code fails too.

What does device code mean?

A device code is the long code an app keeps during device code flow (a sign-in for devices that can't easily take a password, like a smart TV or a meeting-room screen). The app asks for two codes: the device code, which it uses to collect its tokens (the passes it shows to reach email, files or Teams), and a short user code that a person types at microsoft.com/devicelogin. The short code ties the sign-in inextricably (so tightly nothing can pull them apart) to the app that asked for it, not to the person or the device typing it.

Related reading: How to Read a Conditional Access Policy Without Trusting the Name, Conditional Access Exclusions: A Hygiene Guide for IT Managers and Security Control Decay: The Risk You Already Signed Off On.

Glossary

  • Device code flow: Microsoft's name for the OAuth 2.0 device authorization grant, a sign-in built for devices without a keyboard.

  • RFC 8628: The open industry standard that defines the device authorization grant.

  • User code: The short code a person types at microsoft.com/devicelogin.

  • Device code: The long code the requesting app keeps and uses to collect its tokens.

  • Polling: The app asking Entra ID's token endpoint, again and again, whether the sign-in is done.

  • Access token: The pass an app shows to reach email, files or Teams, good for a short time.

  • Refresh token: A longer-lived pass an app uses to get new access tokens without the person signing in again.

  • Primary Refresh Token (PRT): A long-lived sign-in credential tied to a registered device.

  • Device Registration Service: The Microsoft service that registers devices in Entra ID.

  • Protocol tracking: How Entra ID remembers, through every later refresh, that a session began with device code flow.

  • Delegated access: An app acting on a person's behalf, limited to what both the app and the person may do.

Sources

From Microsoft:

Other sources:

Independent educational content from Dynamic Technical Solutions (DTS). DTS isn't affiliated with, endorsed by or sponsored by Microsoft. Microsoft, Microsoft Entra, Microsoft 365, Microsoft Teams, SharePoint and OneDrive are trademarks of the Microsoft group of companies. Other names belong to their owners. Based on Microsoft documentation as of November 2026.

Disclaimer

This article provides independent educational guidance from Dynamic Technical Solutions (DTS), based on information and Microsoft documentation available at the time of publication or most recent revision. Microsoft may change features, settings, policies, and procedures. Review the linked Microsoft sources for current guidance and confirm applicability to your environment before making changes.

DTS is not affiliated with, endorsed by, or sponsored by Microsoft. Microsoft, Microsoft 365, Microsoft Entra, Microsoft Graph, Microsoft Teams, SharePoint, and OneDrive are trademarks of the Microsoft group of companies. All other product names and trademarks belong to their respective owners.

Back to Blog

About the author

Shawn May, Principal Security Architect at Dynamic Technical Solutions

Written by Shawn May, founder of Dynamic Technical Solutions (DTS). Enterprise identity and security architect with over 30 years of IT experience, specializing in Microsoft identity security, IAM, and technical mentoring. LinkedIn · My story · Contact

On This Page

The links to this article’s sections fill in here when the page loads.

Shawn May

Talk to Shawn

Questions about your own tenant?

Disclaimer

This article provides independent educational guidance from Dynamic Technical Solutions (DTS), based on information and Microsoft documentation available at the time of publication or most recent revision. Microsoft may change features, settings, policies, and procedures. Review the linked Microsoft sources for current guidance and confirm applicability to your environment before making changes.

DTS is not affiliated with, endorsed by, or sponsored by Microsoft. Microsoft, Microsoft 365, Microsoft Entra, Microsoft Graph, Microsoft Teams, SharePoint, and OneDrive are trademarks of the Microsoft group of companies. All other product names and trademarks belong to their respective owners.