Device Code Phishing Attack: How OAuth Logins Get Hijacked
A device code phishing attack hijacks OAuth logins without stealing a password. Here's how it works in 2026, who it targets, and how to block it.
By Babul Jack
A device code phishing attack tricks a real, logged-in user into approving an attacker's sign-in request on a genuine login page, handing over a valid OAuth access token without ever touching a password. It abuses the OAuth 2.0 Device Authorization Grant (RFC 8628), a flow built for TVs and CLIs, and in 2026 it became one of the fastest-growing account takeover techniques I've seen hit client systems.
I first ran into this pattern while hardening sign-in flows for a client's internal tooling, and it unsettled me more than most vulnerabilities I review: the victim isn't fooled by a fake domain or a cloned login page. They type a code into the real Microsoft or GitHub site. Nothing about the URL, the certificate, or the branding looks wrong, because none of it is wrong. Only the intent behind the request is malicious.
The device code flow exists for "input-constrained" devices — a smart TV, a printer, a conferencing bar, or a command-line tool — that can't easily host a password field. Instead of typing credentials into the TV, you visit a short URL on your phone or laptop, enter an eight-character code, and the TV silently receives an access token once you approve.
In a legitimate flow, the device itself requests the code and shows it to you. In a phishing attack, the attacker requests the code using a legitimate, often widely-trusted client ID — then sends that code to you by email, phone call, or chat message, usually disguised as an IT request, a license check, or a shared file notification. If you enter it, you've just authorized the attacker's session, not the device in front of you.
Okta's threat intelligence team summarized why this works so well: the device code authorization grant "does not require that the client app is authenticated or even registered with the authorization server," so there's nothing stopping an attacker from reusing a Client ID that your tenant already trusts, such as Microsoft Office's. Okta calls it phishing with dynamite, because a single tool built around one common, trusted endpoint can target almost any Microsoft 365 tenant on the planet.
Why 2026 turned this into an industrial-scale problem
Device code phishing isn't new — RFC 8628 itself dates back years — but 2026 is the year it got productized. Push Security researchers (cited by Okta) measured a 15x increase in device code phishing attacks against Microsoft 365 users since the start of the year.
The biggest driver was EvilTokens, a phishing-as-a-service kit tracked by Microsoft as run by threat actor Storm-2992. According to Microsoft's detailed teardown, EvilTokens compromised more than 12,000 inboxes across over 10,000 organizations worldwide before Microsoft's Digital Crimes Unit helped disrupt its infrastructure in September 2026. The kit sold for $1,500 upfront plus a $500 monthly fee, came with 44 lure themes, an AI assistant to rewrite phishing emails from stolen inbox content, and built-in Microsoft Graph reconnaissance to map a victim's organization after compromise.
None of this requires sophisticated malware. It requires one person entering an eight-character code on a page that is, technically, completely legitimate.
How the attack actually runs
The attacker starts a device code request against a public identity endpoint (for example, Microsoft's shared /common/oauth2/devicecode endpoint) using a trusted, publicly known client ID.
The authorization server returns a short user code and a verification URL — both perfectly real.
The attacker sends that code to the victim, framed as an IT task, a shared document, or a Copilot license renewal.
The victim opens the real login page, signs in normally, and enters the code.
The attacker's client, which has been silently polling the token endpoint, receives a valid access and refresh token the moment the victim approves — no password, no MFA prompt to bypass, because MFA already happened as part of the victim's normal sign-in.
That last point is what makes it dangerous for teams that assume MFA is the finish line. The attacker isn't defeating MFA; they're getting the victim to complete it for them, on an unrelated session.
Device code phishing is now coming for AI coding agents, too
In November 2026, Microsoft published lab research showing the same technique applied to GitHub Copilot CLI, which — like many CLI tools — supports the OAuth device flow for sign-in. In a controlled simulation, after a test account approved a phished device code, Microsoft found four possible outcomes, each gated by the account's permissions and enabled features:
Steering an active, remote-control-enabled Copilot CLI session to run commands on the victim's machine.
Writing misleading entries into the agent's persistent memory to influence later sessions.
Reading Copilot CLI sessions that had synced to the cloud.
Accessing private repositories available to the compromised account.
Microsoft is explicit that these were proof-of-concept results from a lab, not attacks observed in the wild, and each outcome depends on specific settings being enabled. But the implication for anyone building or deploying AI agents is direct: any public client that supports the device flow is a candidate for this attack, and the blast radius now includes what an agent can read, remember, and execute — not just what a mailbox can leak. That's exactly the class of risk I cover when I help teams design AI agent authentication for agent-to-API calls, and it overlaps with the broader lessons in AI agent supply chain security.
How do you stop device code phishing?
The consistent advice from Microsoft, Okta, and the FBI's Internet Crime Complaint Center is the same: block the device code flow entirely unless you have a specific, documented reason to allow it, and treat every exception as a named, monitored risk.
Steps for Microsoft Entra ID
Go to Entra ID > Conditional Access > Policies and create a new policy.
Under Assignments > Users, include all users; under Exclude, add only break-glass/emergency accounts.
Under Conditions > Authentication flows, set Configure to Yes and select Device code flow.
Under Access controls > Grant, choose Block access.
Run the policy in Report-only mode first and filter sign-in logs for the device code authentication protocol to see who actually depends on it, per Microsoft's own guidance.
Switch the policy to On once the audit confirms it's safe.
Steps for Okta-protected apps
If you genuinely need the flow for a client registered in Okta, restrict it rather than leave it open: allowlist the IP range allowed to request a token for that client under Applications > General > Network IP, and monitor for anomalous token grants, as Okta recommends.
A quick comparison of mitigation options
Control
Where it applies
What it stops
Block device code flow via Conditional Access
Microsoft Entra ID tenants
Stops the flow outright for all but named exceptions
IP allowlisting per client
Okta-registered OAuth clients
Denies token issuance from outside approved networks
Authentication transfer policy block
Microsoft 365
Prevents moving an authenticated session from desktop to mobile
User rule: never enter a code someone sent you
Every organization
Removes the social-engineering step the whole attack depends on
If your product accepts OAuth connections or payment credentials from third parties, this is also the moment to review the rest of your login and authorization surface — it's the kind of hardening work I do as part of web app development engagements, alongside broader authentication reviews.
Where passkeys fit in
Phishing-resistant authentication such as FIDO2 passkeys doesn't directly stop device code phishing, because the attack never touches the password or the MFA prompt — it rides on top of a session the user themselves authenticated. Still, reducing standing password and OTP use closes other doors attackers pivot through after a device code compromise, which is one reason adoption is still catching up, as I covered in why passkeys haven't replaced passwords yet.
Frequently asked questions
Does device code phishing bypass MFA?
Not technically — the victim completes their own normal MFA challenge. The attack bypasses MFA's purpose by getting the victim to authorize a session the attacker controls, so the token issued at the end is valid and MFA-backed from the authorization server's point of view.
Which platforms are affected by device code phishing?
Any service implementing RFC 8628's device authorization grant can be targeted, but Microsoft 365 has been the dominant target in 2026 because of its single shared /common authentication endpoint and widely trusted first-party client IDs. GitHub's device flow, used by CLI tools including Copilot CLI, has also been demonstrated as exploitable.
Can I just disable the device code flow everywhere?
In most organizations, yes, with a short list of named exceptions such as Teams meeting-room devices or specific CLI tools used by administrators. Audit sign-in logs in report-only mode first so you don't lock out a legitimate dependency.
What should I tell employees to watch for?
Teach one simple rule: never enter a sign-in code that someone else sent you, even if the login page is genuinely the real Microsoft or GitHub site and even if the request is framed as routine IT work.
Key takeaways
A device code phishing attack abuses the OAuth 2.0 Device Authorization Grant (RFC 8628) to get a real user to authorize an attacker-controlled session on a genuine login page.
Device code phishing attacks against Microsoft 365 rose roughly 15x in 2026, driven largely by the EvilTokens phishing-as-a-service kit, which compromised over 12,000 inboxes before its September 2026 disruption.
The technique doesn't bypass MFA technically — it gets the victim to complete MFA for the attacker's session instead of their own.
Microsoft's November 2026 research shows the same attack can extend to AI coding agents like GitHub Copilot CLI, reaching remote sessions, agent memory, and private repositories.
The most effective fix is blocking the device code flow by default via Conditional Access (or client IP allowlisting on Okta), with narrow, monitored exceptions only where truly needed.