Device Code Phishing
Device code phishing abuses the OAuth 2.0 Device Authorization Grant (RFC 8628). The victim enters an attacker-initiated code on the identity provider’s real sign-in page, which authorizes the attacker’s session and gives the attacker tokens, with no fake page and no password theft.
How it works
The device flow exists for input-constrained clients such as TVs and CLIs. The client gets a device_code and a short user_code and polls the token endpoint. Meanwhile the user goes to a verification URL on another device, signs in, and enters the code (Doyensec). The flow deliberately decouples the device that authenticates from the device that receives the tokens. Phishing turns that decoupling against the user:
- The attacker starts a device flow for a client ID of their choice and receives a
user_code. - A lure (document share, Teams invite, vendor email) tells the victim to enter the code at the IdP’s genuine device-login page (Scamdrill, InfoSecWriteups).
- The victim authenticates with their own password, MFA or even a passkey, on the real domain. The attacker’s polling client then receives access and refresh tokens (Push Security).
Why it works:
- Nothing is spoofed, so URL-checking training and phishing-resistant factors don’t help. The factor protects the login, not the token’s destination.
- The tokens bypass MFA after issue (Obsidian).
- Device code is a legitimate feature used daily by CLIs (Azure, GitHub, AWS), which makes it hard to simply switch off (Push Security).
Kits now generate codes on demand when the victim opens the page, which works around the short code lifetime. They host on trusted platforms (workers.dev, vercel.app, github.io) and use anti-bot gating (Push Security).
Implementation bugs in the IdP’s device flow make it worse. If the device session can be transferred, or if client_id/scope aren’t bound server-side to the device_code, the attack can become silent, with no consent screen (weirdmachine64).
What to check
- Tenant or IdP policy: is the device authorization grant allowed for all users and apps, or blocked or limited to the populations that need it?
- Sign-in logs: are device-code authentications visible and alerted on (authentication protocol, unusual client apps, new device registrations after a device-code sign-in)? (Wiz)
- Legacy flows with similar effect, such as ROPC, also slip past conditional access (Wiz).
- For IdP or authorization-server builders:
- Is
client_id/scopebound to thedevice_codeserver-side? - Is the verification session tied to the browser that started it?
- Does
prompt=noneor similar skip the consent screen showing which app is being authorized?
- Is
- User awareness: do users know never to enter a code their own screen didn’t just generate?
Notable cases
- Google IdP confused deputy ($13,337, fixed March 2026): two stacked bugs. The device-code sign-in session was transferable between browsers, and
client_id/scopeweren’t bound to thedevice_code. Together withprompt=none, a single link silently produced an access token for an arbitrary Google-registered client, with no consent or 2FA prompt. Google VRP initially closed it twice as social engineering (weirdmachine64). - 2026 surge: Push Security saw a 15x rise in device-code phishing pages by March 2026, mainly driven by the EvilTokens kit, with others including Venom, Tycoon2FA and CYB3R. Targets include Microsoft (most), Google, Salesforce, GitHub and AWS (Push Security).
- Microsoft 365 commoditization: kits such as Kali365 and EvilTokens, with campaigns documented by the FBI and Microsoft (Scamdrill).
- Exposure in the wild: fewer than 50% of Wiz customers enforce conditional access blocking device-code authentication (Wiz).
Defenses
- Block the device code flow with conditional access. Roll out in report-only mode first, and exclude break-glass accounts and devices that genuinely need it (for example meeting-room devices) (Scamdrill).
- Detect it: alert on device-code sign-ins by users who don’t normally use CLIs, and on device registration or token use from new infrastructure right afterwards (Wiz).
- Limit the blast radius of stolen tokens: shorter refresh-token lifetimes, device-bound tokens where supported, and fast revocation (Obsidian).
- IdP builders: bind
client_id/scopeto thedevice_code, bind the verification session to its browser, and always show the requesting app on a consent step (weirdmachine64). - Teach one reflex: only enter a code that your own screen just displayed (Scamdrill).
Related
- Authentication Security · OAuth 2.0 Vulnerabilities · OAuth Consent Phishing · Adversary-in-the-Middle Phishing · MFA Bypass · Account Takeover
- JSON Web Tokens · API Security
Sources
- Analyzing the rise in device code phishing attacks in 2026 · original
- Device Code Phishing: How Attackers Abuse Microsoft’s Legitimate Authentication Page · original
- Device Code Phishing: The Microsoft 365 Attack That Walks Past MFA · original
- 3 OAuth TTPs Seen This Month — and How to Detect Them with Entra ID Logs · original
- ($13337) Confused Deputy: Google IdP Universal Account Takeover via Device Code Flow Hijacking · original
- Token-Based Attacks: How Attackers Bypass MFA · original
- Doyensec: Common OAuth Vulnerabilities · original