How device code phishing works
The real page, real MFA, and the tokens go to the attacker
How the abuse works, what changed in 2026, and how to find, block and respond to it in Microsoft Entra ID.
Kevin Keller · kevinkeller.org
Why it matters
In 2026 it became a product anyone could rent
No stolen password and no fake login page. The victim signs in on Microsoft's own page and completes real multifactor authentication. A technique used by a few state-aligned groups became phishing as a service.
The legitimate flow
The protocol assumes the device and the person share a room
- Built for smart TVs, meeting room consoles and command-line tools
- The device keeps the long
device_codeand shows the shortuser_code - The person signs in elsewhere while the device polls for tokens
- Nothing ties the device that asked to the person who types the code
Source: RFC 8628
The abuse
The attacker plays the part of the device
- The attacker requests a code from
/devicecode - A lure: "Enter this code to open the document"
- The victim enters it on the real Microsoft page, MFA included
- The attacker's polling returns access and refresh tokens
- Then: mail, files, a registered device, inbox rules
Why the usual advice fails
Three properties make it hard to stop
- The page is real: correct URL, valid certificate
- MFA is satisfied, not bypassed: even a passkey, because the site is real
- A refresh token: 90 days by default, renewed on use
- A trusted name: a well-known Microsoft client ID on the prompt
What changed in 2026
The 15-minute limit was engineered away
A code pasted into an email expired 15 minutes later, usually before the victim read it. In the 2026 campaigns the code is generated when the victim clicks, copied to the clipboard, and polled every few seconds. Generative AI wrote the lures.
Source: Microsoft Security blog, 6 April 2026
The timeline
From targeted campaigns to a rentable kit
| When | What was reported |
|---|---|
| Feb 2025 | Microsoft describes Storm-2372 |
| Mid-Feb 2026 | EvilTokens kit appears on Telegram |
| 20 Mar 2026 | Huntress: 340+ Microsoft 365 organisations |
| 22 Sep 2026 | Microsoft: 12,000+ inboxes, infrastructure disrupted |
Sources: Microsoft, Sekoia, Huntress, as of November 2026
Finding it in your logs
A first device code sign-in from an unfamiliar address
- Filter
SigninLogsonAuthenticationProtocol == "deviceCode" - Inventory first: in most organisations a few accounts use the flow
- Then flag successes from an address that user never signed in from
- Error 50199 followed by a success is the pause while the user confirms
The fix
Get as close as possible to a unilateral block on device code flow.
A Conditional Access policy for all users and all resources, blocking the device code authentication flow. Exclude emergency access accounts. Report-only first, then On.
New tenants created from 1 July 2026 block it in security defaults. Check yours.
When a user entered a code
Assume the attacker holds a valid refresh token
- Disable the account and revoke its sessions
- Issued access tokens stay valid for up to an hour
- Remove devices the user doesn't recognise
- Check inbox rules, forwarding and new authentication methods
- Only then reset the password and re-enable
Common mistakes
The ones that keep the attacker in
- "MFA covers it": completing MFA is the attack
- Password reset only: the refresh token is the credential
- Checking the URL: the URL is correct
- No inventory first: meeting rooms break, the policy goes off
- Broad exceptions: "all developers" undoes it
- Report-only forever: it blocks nothing
The takeaway
Never enter a code someone sent you, and block the flow you don't need.
Read the full article · Try the device code flow playground
Kevin Keller · kevinkeller.org