Device Code Phishing: The Microsoft 365 Attack That Walks Past MFA
Bottom line up front
Device code phishing is the rare Microsoft 365 account takeover that needs no password and breaks no multi-factor authentication. An attacker sends your employee a code and a link to microsoft.com/devicelogin, Microsoft’s real sign-in page, and entering it signs the attacker’s device in. The fix is a Conditional Access policy in Microsoft Entra that blocks device code flow (report-only first; exclude break-glass accounts and any Teams Rooms that need it), plus one reflex for everyone: never enter a code your own screen didn’t just show you.
The email looks like a document share, a Teams invite, or a note from a vendor you actually do business with. It reads cleanly, because a machine wrote it for this exact recipient. Your employee clicks, lands on a page that says “to verify your identity, enter this code at microsoft.com/devicelogin,” and does as it asks. The page they end up on is genuinely Microsoft’s. The sign-in is real. The MFA prompt is real. Everything works the way it is supposed to, which turns out to be the entire problem.
A few minutes later, someone in another country is reading that mailbox. No password was stolen. No one-time code was intercepted. The FBI put out a public warning about this in a May 2026 alert, after a subscription kit called Kali365 turned the technique into something a low-skill buyer could rent and run. The same method, in more careful hands, has been used by a Russia-aligned espionage group since 2024. It is one of the cleaner ways into a Microsoft 365 tenant right now, and most of the defenses companies have invested in do not see it coming.
Five signs a “verify your identity” request is really an attack
Whether you are an employee or the person who runs the tenant, the tells are the same. If a sign-in request does any of the following, stop and treat it as hostile:
- You’re asked to enter a code you didn’t request. A real device-code login starts on a device you are holding, like a conference-room display or a printer. If a code arrives by email or chat, you didn’t start it, so someone else did.
- The code came in an email, attachment, or chat link. Microsoft does not email you a code to paste into a login page. The delivery method is the giveaway.
- The page is rushing you. A visible countdown, a “this expires in 15 minutes,” or a code that has already been copied to your clipboard are all pressure, not service.
- The sender is plausible but the ask is odd. A vendor, an invoice, an RFP, a shared file, anything that ends in “sign in to view” and routes you through a Microsoft login you didn’t expect.
- After you sign in, nothing opens. You “verified,” and the promised document never appears, because the only thing that needed your login was the attacker’s waiting session.
Any one of these is enough to walk away. In a real lure you will usually see several at once.
Definition
Device code phishing: an attack that abuses Microsoft’s legitimate device-code login flow, the one built for TVs and printers, by getting a target to enter an attacker-generated code on the real Microsoft sign-in page. The victim completes the login and MFA and unknowingly hands the attacker valid access and refresh tokens.
Why this matters: almost every phishing defense an organization buys is built to catch a stolen password or a fake login page. Device code phishing trips none of those wires. There is no spoofed site to block, no password to leak, and no MFA prompt to fail, because the employee authenticates on the genuine Microsoft page and the token that comes out the other side is routed to the attacker. Microsoft has been direct about this in its own writeups: the technique does not reflect a flaw in its code. It abuses a standard that is working exactly as designed.
Is microsoft.com/devicelogin legit?
Yes, and that is exactly why this attack works. microsoft.com/devicelogin is Microsoft’s own page for signing in a device that can’t show a normal login screen, like a smart TV, a printer, or a meeting-room panel. Microsoft’s Teams Rooms documentation uses it to sign in Teams Android devices remotely. The address is right, the sign-in is real, and the MFA prompt is real. Every check people have been taught to run on a link passes.
The danger is never the page. It’s the code. A legitimate device code is one you are looking at on a screen in front of you, because a device you are setting up just generated it, and it is good for 15 minutes from the moment it was requested. If the code came to you in an email, a Teams chat, a PDF, or a web page someone sent, you didn’t start this sign-in. Whoever did start it is waiting for you to finish it for them.
The rule for staff
Only type a code into microsoft.com/devicelogin if a device in your own hands is showing it to you right now. Anyone else’s code, from anyone, is an attack. After you sign in, the page names the app you’re authorizing; Microsoft’s own advice is to check that it’s the app you expected, and to stop if it isn’t.
Got a Microsoft code you didn’t request?
Two different things land in inboxes under that description, and they need different responses.
A security code from Microsoft that you didn’t ask for. This is the “your single-use code is…” email or text. Microsoft sent it because someone typed your email address or phone number into a Microsoft sign-in: a stranger who mistyped their own address, a delayed code you asked for earlier, or someone trying to get into your account. Microsoft’s guidance is to not respond to codes you didn’t request; without the code, the account is safe. Real codes come from an @accountprotection.microsoft.com address, and Microsoft says its support agents aren’t allowed to send you verification codes. If they keep coming, Microsoft’s suggested fix is to switch the account to passwordless sign-in. The one move that turns this into a breach is reading the code to someone who calls or messages asking for it.
A code someone else hands you, with instructions to enter it. “To view the document, go to microsoft.com/devicelogin and enter this code.” That is not Microsoft sending you a code. That is a stranger’s sign-in waiting for your approval, and it is device code phishing. Don’t enter it. Forward the message to whoever handles IT or security, and if you already entered the code and signed in, tell them now, not after lunch. The account needs to be disabled and its sessions revoked, which is covered in what to do if an account was already hit.
How the attack actually works
Once you see the sequence laid out, the strangeness of it makes sense: the victim is a participant, not a bystander. The FBI describes the chain in four moves, and Microsoft’s threat researchers fill in the mechanics. Here is the combined picture.
Source: ScamDrill analysis of FBI IC3 alert I-052126-PSA and Microsoft Threat Intelligence research, 2025–2026.
The lure is the part that has changed most. When operators write their own emails, quality varies. When a kit writes them, the copy is generated for the recipient’s role: invoices for the finance team, RFPs for sales, workflow notices for the people on a manufacturing line. Microsoft’s researchers documented exactly that kind of role-aware, AI-generated targeting in an April 2026 campaign. We have written before about how convincing machine-written lures have gotten, in our look at AI-driven neo-phishing; this is that same trend pointed at your login screen.
Why your MFA didn’t catch it
This is the part that catches security teams off guard, because it contradicts the thing everyone has been told. Multi-factor authentication is the backstop: even if a password leaks, the attacker still cannot produce the second factor. Device code phishing sidesteps that logic completely, because the legitimate user supplies the second factor. They get the push and approve it. They type the one-time code. All of it real, all of it on Microsoft’s own page. MFA did its job. It confirmed the right person was at the keyboard. It simply had no way to know that the session being authorized belonged to someone else’s device.
Source: ScamDrill, based on Microsoft Threat Intelligence guidance on device code phishing, 2025–2026.
So “we have MFA, we’re covered” is the dangerous assumption here. A push notification, an authenticator code, or a text message proves who is signing in. None of them binds that approval to the device that started the request, and that gap is the whole attack. The same blind spot powers adversary-in-the-middle phishing, which relays a real login through a look-alike page and steals the session cookie outright. It is the same reason we keep pushing organizations toward phishing-resistant methods and hardware-backed sign-in in our work on social engineering against smaller businesses: the goal is to stop trusting that a successful login means a trustworthy session.
The kits behind it: Kali365 and EvilTokens
What turned a careful, hands-on technique into an everyday risk is commoditization. When Microsoft first documented device code phishing at scale, in February 2025, the operator was Storm-2372, a group it assesses with moderate confidence aligns with Russian interests, active since August 2024 and going after governments, NGOs, defense, telecom, healthcare, and energy across several regions. In a July 2026 update, Microsoft went further and now assesses Storm-2372 as an initial-access sub-cluster of Midnight Blizzard, the Russian state actor. Their lures imitated WhatsApp, Signal, and Teams, and the operators built rapport first, posing as someone the target would expect to hear from, before sending the device-code invite. That is patient, expensive work.
A year later, you can rent it for the price of a team lunch. The FBI’s May 2026 alert named Kali365, a phishing-as-a-service platform first seen in April 2026 and distributed mainly through Telegram. Researchers who analyzed the kit put the price at $250 a month per tenant, or $2,000 a year. For that, a buyer with almost no technical skill gets AI-generated lures, ready-made campaign templates, a live dashboard tracking who has been hit, and automated OAuth token capture. A parallel kit, EvilTokens, launched in February 2026, was sold the same way, and bundled a built-in webmail interface and reconnaissance tools aimed squarely at business email compromise. Microsoft’s list of the industries its customers hit reads like a phone book: wholesale distribution, construction, financial services, real estate, higher education, and healthcare.
In September 2026, Microsoft’s Digital Crimes Unit, acting on a federal court order, seized 50 websites used to run EvilTokens and disabled more than 150 related domains. By then Microsoft had tied the service to more than 12,000 compromised inboxes across over 10,000 organizations, and UK police had arrested two men on suspicion of running it. That is a real dent, not an ending. Kali365 wasn’t part of the action, and the technique itself doesn’t need a kit: it rides on a standard sign-in flow that anyone can start. Microsoft’s technical write-up on the takedown repeats the advice in every one of its device-code reports: block device code flow wherever possible.
The 15-minute window stopped being a defense
The kits also fixed the one real weakness in the older version of this attack. A device code is valid for only 15 minutes. Early campaigns baked a pre-generated code into the email, so a slow target meant a dead code and a failed attempt: open the message 20 minutes late and the attack just expired on its own. The newer tooling solved that by generating the code the moment the victim lands on the page, copying it straight to their clipboard, and polling Microsoft every few seconds to catch the token the instant the login goes through. The countdown that used to protect targets now starts only when the victim is already at the keyboard.
A growing share of these lures now arrive through real platforms rather than lookalike domains. Our guide to phishing sent from DocuSign and other trusted services explains why sender checks miss them.
What happens after they’re in
Getting a token is the beginning, not the payoff. Microsoft watched operators register a new device within ten minutes of a breach to lock in durable access, then go quiet for hours before doing anything noisy. The quiet work is the dangerous part: malicious inbox rules that hide or forward replies, Microsoft Graph queries that map who reports to whom and who can move money, and keyword searches through the mailbox for words like “password,” “wire,” “invoice,” and “credentials.” In the 2025 Storm-2372 cases, operators even pivoted the stolen token into a registered device and a Primary Refresh Token, the credential that keeps an attacker inside long after the original session should have ended.
Where it usually goes from there is business email compromise. Once an attacker is reading a finance lead’s real mail, they don’t need malware, they need a plausible moment to redirect a payment. BEC remains one of the most expensive categories of cybercrime in the country: the FBI’s Internet Crime Complaint Center logged $2.77 billion in BEC losses in 2024 alone, and nearly $8.5 billion across the prior three years. A stolen token is often the first domino, which is why the same crews that run device code phishing also feed the wire-fraud and invoice-fraud schemes we cover in the business email and video compromise explainer and the NACHA fraud-monitoring rule.
EvilTokens turns up in other lures too. Coalition pointed to it when explaining this year’s rise in business email compromise claims, and one of the pretexts aimed at sales staff this year is a fake buyer’s quote request; see the fake buyer aimed at your sales team.
How to shut it down
The good news is that this attack has a hard off-switch most tenants have never flipped. Device code flow is a niche feature, built for input-constrained devices like smart TVs and printers, and the majority of organizations do not need it for daily work. Microsoft’s own guidance is to block it wherever possible. The controls below are ordered roughly by impact.
Sources: FBI IC3 alert I-052126-PSA; Microsoft Entra Conditional Access guidance, 2026.
Block device code flow in Conditional Access. In Microsoft Entra, a Conditional Access policy can switch the device-code authentication flow off for everyone, with narrow exceptions. Audit where it is legitimately used first so you don’t break a real workflow, then block the rest. Exclude your break-glass emergency accounts from the policy so a misconfiguration can never lock you out of your own tenant. This single setting is the closest thing to an off-switch the attack has, so it gets its own step-by-step below.
Move to phishing-resistant MFA. Passkeys and FIDO2 security keys raise the floor on nearly every other credential attack, and they are the direction Microsoft points defenders. One honest caveat: against device code phishing specifically, the decisive control is blocking the flow, because the user still completes a real sign-in. Phishing-resistant methods shut down the broader adversary-in-the-middle and credential-theft playbook the same crews run, so adopt them as a layer, not as the answer to this one attack.
Close the pivot. Restrict who can register devices in Entra and block authentication-transfer policies, so a stolen token cannot be upgraded into a registered device and a Primary Refresh Token. That is the step that turns a bad afternoon into a months-long intrusion, and it is preventable.
Watch the tells, and respond like the clock is running. Risky sign-in policies, alerts on new device registrations, and routine reviews of newly created inbox rules catch the post-compromise activity even when the login itself looked clean. And if you do suspect a compromise, revoking sessions is not enough on its own. Microsoft notes that standard revocation kills refresh tokens but can leave existing access tokens valid for up to an hour, which a hands-on attacker will spend. Disable the account to contain it, then revoke, then hunt for the new device and the inbox rules.
How to block device code flow in Microsoft Entra
This is the setting that ends the attack, and it takes less time to configure than to read about. It needs Conditional Access, which requires a Microsoft Entra ID P1 license or higher for the users in scope; Microsoft 365 Business Premium includes it. If your tenant runs on security defaults with no Conditional Access at all, that gap is the thing to raise with whoever manages your Microsoft 365.
Step 1: Check whether Microsoft already built the policy for you
Microsoft now ships a Microsoft-managed policy called “Block device code flow” to eligible tenants. It arrives in report-only mode, and Microsoft switches it on no less than 30 days later unless an admin turns it off, with an email and a Message center post two weeks before. In the Entra admin center, go to Entra ID > Conditional Access > Policies and look for Microsoft in the Created by column. If the policy is there, you can’t rename or delete it, but you can add exclusions and change its state. Work through Steps 2 and 4 before it goes live, so it doesn’t surprise a conference room.
Step 2: Find out who actually uses device code flow
Open the Entra sign-in logs and filter on Authentication protocol = Device code flow. In most small and mid-sized tenants the legitimate list is short: Teams Rooms on Android, Teams panels and phones, which use the flow to sign in and to re-authenticate after a password or policy change; developers and admins using command-line tools such as Azure CLI; and the odd legacy app. Anything else deserves a question, and a device-code sign-in nobody can explain deserves the steps in what to do if an account was already hit.
Step 3: Create the blocking policy in report-only mode
These are Microsoft’s documented steps, condensed:
- Sign in to the Microsoft Entra admin center as at least a Conditional Access Administrator.
- Go to Entra ID > Conditional Access > Policies, select New policy, and give it a name you’ll recognize in a year.
- Under Users, include All users. Exclude your emergency-access (break-glass) accounts and any exception groups from Step 4.
- Under Target resources, include All resources.
- Under Conditions > Authentication flows, set Configure to Yes and select Device code flow.
- Under Grant, select Block access.
- Set Enable policy to Report-only and create it.
Step 4: Carve out only the exceptions that genuinely need it
Microsoft’s Teams Rooms documentation is blunt that blocking the flow stops you from signing in a Teams Android device through microsoft.com/devicelogin. Its fix is not to weaken the policy for everyone. Put the Teams device resource accounts (the room or shared-device accounts, not the technician who sets them up) in a dedicated security group, exclude that group, and, if those devices register through device code flow, also exclude the Device Registration Service resource under Target resources, as Microsoft’s Teams device guidance requires. Add new room accounts to the group as you deploy them.
Two cautions from the same guidance. An exception is account-wide, so an excluded account can use device code flow for anything, not just the meeting room; keep the group small, owned, and reviewed. And for non-Teams uses like Azure CLI, Microsoft’s advice is to move people to browser-based or brokered sign-in, or to managed identities for automation, and to treat any exception that remains as a documented risk with a named owner. Don’t exclude whole departments.
Step 5: Review the results, then switch it on
Let report-only run long enough to cover your normal business cycle, then check the policy’s report-only results and the sign-in logs. You’re confirming that Teams devices still sign in, that device-code use now comes only from the accounts you approved, and that your break-glass accounts are out of scope. Then move Enable policy from Report-only to On. If a device gets signed out afterward, check Original transfer method in its sign-in log entry: Microsoft tracks sessions that began with device code flow through later token refreshes, so the policy can block a session that started with device code flow even when the current sign-in didn’t use it.
Step 6: Block authentication transfer in the same pass
The same Authentication flows condition has a second option, Authentication transfer, the QR-code handoff that moves a signed-in session from desktop Outlook to a phone. The FBI’s Kali365 alert recommends blocking it alongside device code flow. If your organization doesn’t rely on it, build a second policy with that option selected and the same break-glass exclusions.
What the policy won’t do
Blocking the flow stops new device-code sign-ins. It does not undo a token someone already stole. If Step 2 turned up device-code sign-ins nobody can account for, treat those accounts as compromised: disable them, revoke their sessions, and look for new devices and inbox rules before you do anything else.
The human moment that ends it
Every control above is worth doing, and not one of them will be fully in place in every tenant on the morning the email arrives. The last line of defense is a person: the employee looking at a code and a “verify your identity” button, deciding whether to follow the instructions. That decision is trainable, and the rule is short enough to survive a busy inbox: a code you didn’t ask for is not a login, it’s an attack. Microsoft’s real sign-in page even names the app you are about to authorize. A two-second pause to read it is often the entire defense.
The same reflex applies when someone phones about an urgent passkey migration.
This is where rehearsal beats a memo. An employee who has already seen a device-code lure once, in a safe drill, and clicked the wrong thing with no real consequence, recognizes the live one. A warning slide watched in a calm quarterly training tends to evaporate the moment a believable email lands during a deadline. A reflex, built by doing, does not. It is the same logic behind running a 30-day phishing simulation rather than relying on a one-time briefing, and it is why we built ScamDrill for organizations as well as families.
Your last line of defense is the person staring at the code.
ScamDrill runs realistic phishing and account-takeover drills, including device-code and OAuth lures, so your team builds the reflex before a real one lands in the inbox. Setup takes minutes.
Start free →If you think an account was already hit
Move fast and assume the stolen token is already working. Disable the affected account rather than just resetting the password, because a reset does nothing to a token that has already been issued. Revoke the account’s sign-in sessions, then look for what the attacker left behind: a device you do not recognize registered in Entra, inbox rules nobody created, mail forwarding you never set up. Pull the thread on anything financial the account could reach, especially pending invoices and wire instructions.
In one summer campaign Huntress tracked across 79 organizations, device-code tokens were followed within hours by rogue device registrations and swapped MFA methods. Here is why a password reset isn’t enough, and what to remove first.
Then treat it as an incident, not a one-off cleanup, because token theft is rarely a single account by the time you notice it. Our business scam incident response guide walks through the first hour, and the broader pattern of OAuth and token abuse, including a real-world case, is the subject of our writeup on the ShinyHunters OAuth breach. If an employee is staring at a suspicious message right now and isn’t sure, our free email scam checker gives a quick read on the tells before anyone clicks anything.
None of this requires a bigger security budget. It requires turning off a setting most companies never needed, hardening the way people sign in, and making sure the person at the keyboard has seen the trick before. Do those three things and device code phishing stops being the quiet way in.