
What Is Device Code Phishing?
Start here
Welcome. Maybe you’ve seen “device code phishing” in the news or on social media, heard about the enormous financial losses it’s caused businesses, or maybe someone at work brought it up, and now you’re curious how a hacker actually pulls it off. You’ve come to the right place to learn how it works in a Microsoft 365 cloud environment, starting with the basics. If the topic feels a bit nebulous (hazy and hard to pin down) right now, that’s completely normal. It sounds technical, and it can be confusing at first.
In short: Device code phishing is a scam where a hacker gets a sign-in code from Microsoft, then tricks your employee into entering it at microsoft.com/devicelogin. Your employee signs in and approves MFA, but the hacker gets access to their Microsoft 365 account. No fake sign-in page, no stolen password. Your own employee signed the hacker in. |
I’ve done my best to keep this simple. We start with the fundamentals here (the light layer, written for owners and leaders). The advanced material comes later in the series, and that’s the part your technologists will want, because they’ll need more detail to protect your business.
We’re focused on one place: your business’s Microsoft 365 account (the email, files and Teams your people sign in to every day). This article will elucidate (make clear) a few questions:
How does a hacker get in without ever stealing a password?
Why doesn’t MFA (the extra sign-in check on your phone) stop them?
What’s the one habit that shuts it down?
You’ll get the basics first, then see who’s involved (the hacker, your employee and Microsoft 365), then press play and watch it happen. Want to see it right now? Skip ahead to the simulator, then come back for the basics anytime.
Jump to the simulatorJump to the beginner simulatorJump to the advanced simulator
Have a question as you read? Contact Shawn to schedule a call.
The basics
How does device code flow work in Microsoft 365?
Every work sign-in to Microsoft 365 goes through Microsoft Entra ID (Microsoft’s sign-in service, the front desk that checks who you are). Usually you sign in on the device in front of you. But some devices can’t show a sign-in page, so they use device code flow (Microsoft’s version of an OAuth 2.0 standard).
At work, that’s a Teams meeting-room console or desk display, or a server with no web browser where your IT staff run the Azure CLI (a command-line tool). When that happens, the device shows a code, and someone signs it in from their own computer. (Work accounts, not the smart TV at home.)
Here’s how it works:
The device asks Microsoft Entra ID for a code.
It then shows you the code and a web address (microsoft.com/devicelogin).
You open that address on your own computer or phone, type the code, sign in and approve MFA (the code expires after 15 minutes).
Then Microsoft Entra ID sends the access to the device that asked for the code, not to the computer you signed in on.
How does device code phishing abuse this flow?
Here’s the catch. Device code phishing flips the roles. The hacker (labeled Attacker in the simulator) requests the code, then sends it to your employee with a believable reason (a Teams invite, a shared file, a voicemail). Your employee then types it on Microsoft’s legitimate page and approves MFA, so step 4 hands the access to the hacker.
That’s the whole trick. Now watch it happen.
What you’ll see
Before you press play
The simulator replays this attack in about 12 seconds (it’s a teaching model, not a live tenant). So here’s what you’re looking at.
Attacker (top left)The criminal’s computer. It starts the sign-in. | Employee (top right)Dana in Finance or Marcus, an admin. You pick who gets phished before you press play. |
Microsoft 365 | Entra ID (bottom center)Microsoft’s sign-in service and the data behind it. | The arrows Blue: the normal device code steps (asking for a code and getting it back) Red: the attack Green: the MFA approval |
While it plays, watch one thing: which box ends up holding the access token (the digital pass that lets an app back in without a password).
Try it yourself Watch it happenPick who gets phished, then press play and follow the attack one step at a time.
|
How to use the device code phishing simulator
|
This simulator is an illustration based on documented attacks. Dana and Marcus are made up, and the simulator also assumes nothing in the tenant blocks device code flow.
Not sure whether device code flow is open in your tenant? Then contact Shawn to schedule a call.
Why it works
Why doesn’t MFA stop device code phishing?
MFA checks that it’s really you signing in (your password plus the approval on your phone). But it doesn’t check which device ends up with the access.
Attacker gets a code → sends it to you → you enter it and approve MFA → the attacker’s computer is signed in
So Microsoft Entra ID sends the access to the device that asked for the code (here, the attacker’s computer). From there it can get into your email and files and stay in until its tokens expire or IT cuts them off. It also never needed your password.
Stay safe The one habit that stops device code phishingOnly enter a device code when you started the sign-in yourself, on a device or machine you’re working on (a Teams device you’re setting up, or a server where you just ran the Azure CLI). So if a code shows up in an email, a chat or a meeting invite, don’t type it in. Instead, report it to your IT team or service desk. Microsoft’s advice for IT teams goes further: block device code flow wherever possible (in Microsoft Entra ID, that’s done with Conditional Access). The FBI then gave the same advice in May 2026. |
Want to learn how to shut device code phishing down in your own tenant? Start with the free lecture, or talk it through with Shawn instead.
Join the free lecture Schedule a call
Frequently asked questionsWhat is a device code phishing attack?It’s a scam where a hacker gets a sign-in code from Microsoft, then tricks your employee into typing it at microsoft.com/devicelogin (Microsoft’s legitimate page for signing in a device). The hacker sends the code with a specious (believable, but false) reason, like a Teams invite, a shared file or a voicemail. Your employee signs in and approves MFA (the extra sign-in check on their phone), but the hacker gets access to their Microsoft 365 account. There’s no fake sign-in page and no stolen password. Should I block device code flow?Yes. Microsoft advises IT teams to block device code flow (Microsoft’s way to sign in a device that can’t show its own sign-in page) wherever possible. The FBI’s advice in May 2026 hews to (follows closely) Microsoft’s. Device code phishing (a scam that tricks you into typing in a hacker’s sign-in code) abuses that same flow, and MFA (the extra sign-in check on your phone) doesn’t stop it. How to block device code authentication?Your IT team blocks device code flow (Microsoft’s way to sign in a device that can’t show its own sign-in page) with Conditional Access (Microsoft’s security controls for anyone entering or using Microsoft 365). They set that up in Microsoft Entra ID (Microsoft’s cloud sign-in service). Microsoft advises IT teams to block it wherever possible. How to access device code?On a legitimate sign-in, the device or machine you’re working on shows the device code (a short sign-in code) on its own screen, along with the address microsoft.com/devicelogin. You open that address on your own computer or phone, type the code, sign in and approve MFA (the extra sign-in check on your phone). If a code shows up in an email, a chat or a meeting invite instead, don’t type it in. Report it to your IT team or service desk. What does device code mean?A device code is a short code a device shows you, so you can sign that device in at microsoft.com/devicelogin from your own computer or phone. Devices that can’t show a sign-in page use it, like a Teams meeting-room console or a server with no web browser. Microsoft’s codes expire after 15 minutes. What is device code flow in Microsoft?It’s Microsoft’s way to sign in a device that can’t show its own sign-in page, like a Teams meeting-room console or a server with no web browser. The device asks Microsoft Entra ID (Microsoft’s cloud sign-in service) for a code, then shows you the code and the address microsoft.com/devicelogin. You type the code there on your own computer or phone, sign in and approve MFA (the extra sign-in check on your phone). Microsoft Entra ID then sends the access to the device that asked for the code, not to the computer you signed in on. |
Glossary
|
Sources
Microsoft sources:
Microsoft identity platform and the OAuth 2.0 device authorization grant flow
Inside an AI-enabled device code phishing campaign (April 2026)
FBI warning:
Security research:
Malwarebytes: How device code phishing gives scammers access to your account
Palisade: Does phishing-resistant MFA stop device code phishing?
OAuth standard:

