# 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 ([[raw/blog.doyensec.com/doyensec-common-oauth-vulnerabilities-3891|Doyensec]]). The flow deliberately **decouples the device that authenticates from the device that receives the tokens**. Phishing turns that decoupling against the user: 1. The attacker starts a device flow for a client ID of their choice and receives a `user_code`. 2. A lure (document share, Teams invite, vendor email) tells the victim to enter the code at the IdP's genuine device-login page ([[raw/scamdrill.com/device-code-phishing-the-microsoft-365-attack-that-walks-past-mfa-10744|Scamdrill]], [[raw/infosecwriteups.com/device-code-phishing-how-attackers-abuse-microsoft-s-legitimate-authen-10564|InfoSecWriteups]]). 3. 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 ([[raw/pushsecurity.com/analyzing-the-rise-in-device-code-phishing-attacks-in-2026-4957|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 ([[raw/obsidiansecurity.com/token-based-attacks-how-attackers-bypass-mfa-4363|Obsidian]]). - Device code is a legitimate feature used daily by CLIs (Azure, GitHub, AWS), which makes it hard to simply switch off ([[raw/pushsecurity.com/analyzing-the-rise-in-device-code-phishing-attacks-in-2026-4957|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 ([[raw/pushsecurity.com/analyzing-the-rise-in-device-code-phishing-attacks-in-2026-4957|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 ([[raw/weirdmachine64.github.io/13337-confused-deputy-google-idp-universal-account-takeover-via-device-10491|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)? ([[raw/wiz.io/3-oauth-ttps-seen-this-month-and-how-to-detect-them-with-entra-id-logs-9110|Wiz]]) - [ ] Legacy flows with similar effect, such as ROPC, also slip past conditional access ([[raw/wiz.io/3-oauth-ttps-seen-this-month-and-how-to-detect-them-with-entra-id-logs-9110|Wiz]]). - [ ] For IdP or authorization-server builders: - [ ] Is `client_id`/`scope` bound to the `device_code` server-side? - [ ] Is the verification session tied to the browser that started it? - [ ] Does `prompt=none` or similar skip the consent screen showing which app is being authorized? - [ ] 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`/`scope` weren't bound to the `device_code`. Together with `prompt=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 ([[raw/weirdmachine64.github.io/13337-confused-deputy-google-idp-universal-account-takeover-via-device-10491|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 ([[raw/pushsecurity.com/analyzing-the-rise-in-device-code-phishing-attacks-in-2026-4957|Push Security]]). - **Microsoft 365 commoditization**: kits such as Kali365 and EvilTokens, with campaigns documented by the FBI and Microsoft ([[raw/scamdrill.com/device-code-phishing-the-microsoft-365-attack-that-walks-past-mfa-10744|Scamdrill]]). - **Exposure in the wild**: fewer than 50% of Wiz customers enforce conditional access blocking device-code authentication ([[raw/wiz.io/3-oauth-ttps-seen-this-month-and-how-to-detect-them-with-entra-id-logs-9110|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) ([[raw/scamdrill.com/device-code-phishing-the-microsoft-365-attack-that-walks-past-mfa-10744|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 ([[raw/wiz.io/3-oauth-ttps-seen-this-month-and-how-to-detect-them-with-entra-id-logs-9110|Wiz]]). - Limit the blast radius of stolen tokens: shorter refresh-token lifetimes, device-bound tokens where supported, and fast revocation ([[raw/obsidiansecurity.com/token-based-attacks-how-attackers-bypass-mfa-4363|Obsidian]]). - IdP builders: bind `client_id`/`scope` to the `device_code`, bind the verification session to its browser, and always show the requesting app on a consent step ([[raw/weirdmachine64.github.io/13337-confused-deputy-google-idp-universal-account-takeover-via-device-10491|weirdmachine64]]). - Teach one reflex: only enter a code that your own screen just displayed ([[raw/scamdrill.com/device-code-phishing-the-microsoft-365-attack-that-walks-past-mfa-10744|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 - [[raw/pushsecurity.com/analyzing-the-rise-in-device-code-phishing-attacks-in-2026-4957|Analyzing the rise in device code phishing attacks in 2026]] - [[raw/infosecwriteups.com/device-code-phishing-how-attackers-abuse-microsoft-s-legitimate-authen-10564|Device Code Phishing: How Attackers Abuse Microsoft’s Legitimate Authentication Page]] - [[raw/scamdrill.com/device-code-phishing-the-microsoft-365-attack-that-walks-past-mfa-10744|Device Code Phishing: The Microsoft 365 Attack That Walks Past MFA]] - [[raw/wiz.io/3-oauth-ttps-seen-this-month-and-how-to-detect-them-with-entra-id-logs-9110|3 OAuth TTPs Seen This Month — and How to Detect Them with Entra ID Logs]] - [[raw/weirdmachine64.github.io/13337-confused-deputy-google-idp-universal-account-takeover-via-device-10491|($13337) Confused Deputy: Google IdP Universal Account Takeover via Device Code Flow Hijacking]] - [[raw/obsidiansecurity.com/token-based-attacks-how-attackers-bypass-mfa-4363|Token-Based Attacks: How Attackers Bypass MFA]] - [[raw/blog.doyensec.com/doyensec-common-oauth-vulnerabilities-3891|Doyensec: Common OAuth Vulnerabilities]]