Written by Ruben Selby, founder and penetration tester at Wolfcore. Last reviewed 1 December 2026.
Part of the Wolfcore Resources library: Social engineering and human risk.
In one sentence: Device code phishing tricks an employee into typing an attacker’s short code into a genuine Microsoft sign-in page, which hands the attacker a logged-in session without ever needing the password.
What it is
Some devices cannot show a full sign-in page, such as a smart TV, a meeting-room screen or a printer. For these, Microsoft and other providers offer a “device code” sign-in. The device shows a short code. You type that code into a sign-in page on your phone or laptop and approve it. The device is then signed in.
Attackers abuse this. They start a genuine device code request themselves, then persuade a person to enter the code. The page is real. The code is real. The person is simply approving the attacker’s login. Microsoft describes the result as the attacker capturing the access and refresh tokens (digital passes that prove you are signed in) and using them to reach the account’s data.
Microsoft is clear that this is not a flaw in its code. The flow is an industry standard and was used as designed.
How it works
- The attacker requests a device code from the sign-in service. This gives them a code and a way to wait for approval.
- They send a lure that makes the code look routine. Microsoft documented fake Microsoft Teams meeting invitations, and rapport built first over WhatsApp or Signal by someone posing as a prominent person the target knows.
- The victim opens the genuine device sign-in page and enters the code, then signs in as normal, including any multi-factor prompt.
- The attacker’s waiting request completes and they receive valid tokens.
- They use the tokens to read mail and files. Microsoft saw attackers searching mailboxes through Microsoft Graph for words such as password, admin and credentials, then exfiltrating the matching messages.
- They send the same lure from the victim’s mailbox to colleagues, which is far more convincing than a message from a stranger.
Microsoft also reported a later shift to a specific client ID (the Microsoft Authentication Broker) that let the attacker register their own device in Entra ID and obtain a Primary Refresh Token. That is why Microsoft also advises restricting who can enrol devices.
Who it affects and how badly
Microsoft listed targets across government, non-governmental organisations, IT services, defence, telecoms, health, higher education and energy, in Europe, North America, Africa and the Middle East. Any business on Microsoft 365 or Entra ID, in any country, is exposed to the technique if device code flow is allowed.
- Small business (up to 10 staff): one compromised mailbox can mean invoice fraud, client data exposure and a few days of clean-up while access is revoked.
- Mid-sized business (50 to 250): the attacker uses the first mailbox to phish colleagues. Expect several accounts, password resets and a data-protection assessment.
- Regulated business (legal, accountancy, healthcare, fintech): mailboxes hold client and patient data, so a regulator and clients may need to be told. Recruitment and estate agents hold identity documents and bank details in email.
Worked example (illustration, not a real case): a 15-person recruitment agency receives a message on WhatsApp from someone who appears to be a client director, followed by an email inviting a consultant to a “secure candidate review meeting” with a code to enter. She enters the code. Within the hour the attacker is reading candidate CVs and a payroll thread, and sends the same invite to three colleagues. The cost is a day of lost billing, forced sign-outs for everyone, and calls to affected candidates. The fix that would have prevented it takes about ten minutes: a Conditional Access policy that blocks device code flow.
What we check on a test
On an engagement that includes the Microsoft 365 tenant, a Wolfcore tester looks at the following. This describes method, not findings.
- Whether a Conditional Access policy using the Authentication Flows condition blocks device code flow, and who is excluded.
- Whether any legitimate device code use exists (meeting-room devices, legacy tools) and whether it is scoped narrowly.
- Whether ordinary users can register or join devices, since that widens what a stolen token can do.
- Whether sign-in risk policies and token revocation steps exist and have been rehearsed.
- Whether staff would recognise the lure, using an agreed phishing simulation.
Rules and regulators
- UK: the ICO says the UK GDPR requires appropriate technical and organisational measures to keep personal data secure, and that password systems must resist theft and guessing. A mailbox takeover that exposes personal data is a security failure under that test.
- EU: Article 32 of the GDPR requires controllers and processors to apply appropriate technical and organisational measures, taking account of the state of the art and the risk.
- US: no single federal rule covers this. Sector rules and state breach-notification laws apply once personal data is exposed.
How to detect it
- In Microsoft Entra, review sign-in logs for device code sign-ins by users who never use meeting-room or TV devices. Put a Conditional Access policy that blocks device code flow into report-only mode first so you can see who would be affected.
- Review the risky sign-ins report in Entra ID Protection. Microsoft recommends it for regular monitoring.
- Watch for a new device registered close in time to unusual token activity. Microsoft says this pattern can reveal the Authentication Broker variant.
- Look for unexpected mailbox searches and sent items that your user did not write, and for internal invitations that contain a code.
- Ask staff to report any message that asks them to enter a code from an invitation.
How to fix or prevent it
- Block device code flow with Conditional Access: Entra ID, Conditional Access, new policy, all users, all resources, Conditions, Authentication Flows, Device code flow, Block access. Test in report-only first, then switch on.
- Exclude only your emergency access (break-glass) accounts and audit that list regularly. If you use Teams Rooms devices, follow Microsoft’s separate guidance to allow them narrowly.
- Turn on Microsoft’s managed policy “Block device code flow” if it appears in your tenant. Microsoft enables managed policies after at least 30 days left in report-only unless you opt out.
- Add a sign-in risk policy so risky sign-ins are blocked or challenged.
- Restrict who can enrol devices in Entra ID.
- If you suspect a hit, revoke the user’s refresh tokens with revokeSignInSessions, then reset the password and review mailbox rules.
- Use phishing-resistant sign-in (FIDO2 keys or passkeys) and keep MFA on. Microsoft says MFA remains essential even though this attack tries to get around it.
- Teach staff one rule: never enter a code from an email or chat unless they started the sign-in on a device in front of them.
FAQ
Does MFA stop device code phishing? Not by itself. The victim completes the MFA prompt themselves, but the session goes to the attacker. Blocking device code flow is the direct fix.
Is this a Microsoft vulnerability? Microsoft says no. It found no vulnerability in its code and describes the tokens as an industry standard.
What does the block break? Devices that rely on device code sign-in, such as some meeting-room hardware. Use report-only mode to find them first.
Related terms
- Phishing-resistant MFA
- What is an MFA fatigue attack? How push bombing wears people down
- Conditional Access Policies: A Baseline for Small Business
- How session hijacking works: stolen cookies, tokens and how to stop them
- What is phishing? How to spot it and protect your business
- What is password spraying? How it works and how to stop it
More in the Social engineering hub.
Sources
- Microsoft Threat Intelligence, Storm-2372 conducts device code phishing campaign: https://www.microsoft.com/en-us/security/blog/2025/02/13/storm-2372-conducts-device-code-phishing-campaign/
- Microsoft Learn, Block authentication flows with Conditional Access policy: https://learn.microsoft.com/en-us/entra/identity/conditional-access/policy-block-authentication-flows
- Microsoft Learn, Microsoft-managed Conditional Access policies: https://learn.microsoft.com/en-us/entra/identity/conditional-access/managed-policies
- ICO, Passwords in online services: https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/security/a-guide-to-data-security/passwords-in-online-services/
- GDPR Article 32: https://gdpr-info.eu/art-32-gdpr/
How Wolfcore helps
Phishy runs realistic phishing simulations against your own staff and shows you who clicked, so you can train the people attackers target. See the phishing simulation software.
We also covered a live campaign in device code phishing and fake AI event invites. To see how your own staff respond to a lure like this, try phishing simulation software free for 14 days at Phishy free trial. For a wider review of sign-in controls, see our penetration testing.
Wolfcore
Would your staff click a phishing email?
Run a real, safe phishing test on your team with Phishy. Free for 14 days, up to 10 staff, no card. We help you set it up.
Start a free phishing testFree website security scanor book a 30 minute call