Device Code Phishing: Bypassing MFA With a URL

Device Code Phishing in 2026: How Attackers Bypass MFA with a Simple URL

📋 Key Takeaways
  • The attack needs no intercepted SMS codes, no adversary-in-the-middle proxy, and no stolen session cookies.
  • RFC 8628 was designed for devices with limited input capability.
  • The attacker registers (or reuses) an OAuth application with the target identity provider — Microsoft Entra ID, Google, GitHub, or AWS — and requests a device code scoped to high-privilege permissions like mail.read, files.readwrite.all, or Directory.ReadWrite.All.
  • The attack does not bypass MFA. It uses MFA as part of the attack.
9 min read · 1,789 words
Educational & Ethical Use Only — This article is provided for educational and ethical cybersecurity research purposes only. The techniques described should only be used on systems you own or have explicit permission to test. Always follow responsible disclosure and the laws applicable to you. Mitigations are included so engineers can harden real systems.
Security· 9 min read

Multi-factor authentication was supposed to be the silver bullet. In 2026, attackers stopped trying to break it — they made the victim complete it for them. Device code phishing detections spiked 37x, and the technique is now a criminal commodity.

Quick Answer

Device code phishing abuses the OAuth 2.0 device authorization grant (RFC 8628). The victim authenticates legitimately — real password, real MFA, real provider domain. But the resulting access and refresh tokens go to the attacker’s polling client. Detections spiked 37x in H1 2026. More than 18 kits now sell on underground markets from $50, and every major AiTM platform has integrated the technique. Immediate defenses: disable the device code flow where it is unused, govern OAuth consent (admin consent for high-privilege apps), enable token protection and continuous access evaluation, and alert when the sign-in protocol is DeviceCode.

The MFA Bypass Nobody Talks About

The attack needs no intercepted SMS codes, no adversary-in-the-middle proxy, and no stolen session cookies. It is called device code phishing. It exploits the OAuth 2.0 device authorization grant — the flow used legitimately by CLI tools, IoT devices, smart TVs, and kiosks. The trick: get the user to hand an authenticated session directly to the attacker.

Push Security and other researchers have tracked the explosion: a 37x spike in detections in the first half of 2026. At least 18 dedicated kits sell on underground markets, some priced as low as $50. The technique was once espionage-grade, used by nation-state actors (Chinese APT groups documented by Microsoft MSTIC). Today it is a criminal commodity, and every major adversary-in-the-middle vendor has integrated it.

What the Device Authorization Grant Actually Does

RFC 8628 was designed for devices with limited input capability. The legitimate flow:

  1. Device requests a code — the client asks the authorization server for a user code and verification URL
  2. User enters the code — on any device with a browser, the user visits the URL and types the short code
  3. User authenticates and consents — normal login, normal MFA, plus an OAuth consent prompt
  4. Device polls for the token — the client polls until authentication completes, then receives access and refresh tokens

Legitimate users include AWS CLI, GitHub device flow, Azure CLI, and Google Cloud SDK. The problem: an attacker can initiate this flow and socially engineer the victim into completing it on the attacker’s behalf — without ever touching a password or MFA device.

Anatomy of the Attack

Step 1: Attacker Initiates the Flow

The attacker registers (or reuses) an OAuth application with the target identity provider — Microsoft Entra ID, Google, GitHub, or AWS — and requests a device code scoped to high-privilege permissions like mail.read, files.readwrite.all, or Directory.ReadWrite.All.

Step 2: Social Engineering the Victim

The lure delivers a real verification URL and code: “Your organization requires a security verification. Visit microsoft.com/devicelogin and enter code XXXX-XXXX.” The page is genuine — it is the legitimate page. There is no lookalike domain, so URL inspection and email gateways have nothing to flag.

Step 3: The Victim Authenticates — Fully

The victim enters the code, logs in, completes MFA, and approves a consent prompt that looks routine. Every signal on their side checks out. Conditional access policies pass, because the authentication genuinely is the user’s.

Step 4: The Attacker Collects Tokens

The attacker’s polling client receives the access token — and usually a refresh token that survives password changes. The result: session hijacking that looks identical to a legitimate login in audit logs.

Why Traditional Defenses Fail

Traditional Control Why It Doesn’t Help
MFA / push approval The victim completes the real MFA challenge themselves
Credential monitoring No password is ever captured
URL / domain reputation The flow uses the provider’s genuine domain
Phishing page detection There is no fake page to detect
Conditional access (location/device) Authentication comes from the victim’s normal device and location

The attack does not bypass MFA. It uses MFA as part of the attack. One gap remains for defenders: the token is consumed from infrastructure different from where the login happened, and the flow itself is visible in sign-in logs.

The 2026 Landscape: Kits, Lawsuits, Scale

  • 18+ kits circulate on underground forums. Many run as Phishing-as-a-Service, with victim-tracking dashboards and multi-provider support (Microsoft, Google, GitHub, AWS, Salesforce). Common extras: session-cookie extraction, ransomware pipeline integration, and residential proxy rotation
  • 37x detection spike reported by vendors across H1 2026
  • Google filed suit (June 2026) against the Chinese phishing operation “Outsider Enterprise” over AI-powered phishing at scale; the FBI moved to disrupt the same PhaaS operation
  • Signal added security warnings for social engineering and device code attacks (June 2026)

The pattern echoes what we tracked in the week-two June intelligence report: token theft has become the preferred path past MFA everywhere, from VS Code one-click GitHub token theft to OAuth device flows.

Detection and Monitoring

What to watch in identity provider audit logs:

  • Device code grant events — in Microsoft Entra ID, filter sign-in logs where the authentication protocol is DeviceCode; alert on flows from unexpected locations, user agents, or off-hours windows
  • Suspicious app registrations — new OAuth apps requesting high-privilege scopes with minimal verification, or publisher verification disabled
  • Consent grants to unknown apps — users approving permissions they should not recognize
  • Geographic split — token issued where the victim lives, then consumed from elsewhere within minutes. Correlate grant and usage events; do not treat them separately
  • Rapid token polling — automated polling patterns that precede user authentication completion

Defense Strategies That Actually Work

1. Restrict or Disable the Device Code Flow

Many organizations never use it. In Microsoft Entra ID, disable or restrict device code flow via Conditional Access policies targeting specific applications or requiring compliant devices; Google offers equivalent controls.

Require admin consent for high-privilege applications. Block consent to unverified publishers. Audit granted consents on a schedule and revoke anything unnecessary. Treat OAuth consent governance with the same urgency as credential protection.

3. Token Protection and Binding

Enable token protection (proof-of-possession) where available. Entra ID can bind tokens to the device that requested them. Stolen tokens then become unusable on attacker infrastructure, even when the authentication was legitimate.

4. Continuous Access Evaluation

CAE revokes sessions when risk signals change instead of waiting for token expiry. That directly shrinks the value of a stolen refresh token. It is the same identity-centric hardening we recommend for zero-trust architectures and non-human agent identities.

5. Phishing-Resistant MFA and User Training

FIDO2/passkeys raise the bar, though they do not fully stop consent-based attacks. Update awareness training with device-code specifics. Teach the warning signs: unexpected code-entry requests, artificial urgency (“this code expires in 15 minutes”), and codes requested outside normal IT channels. Show users how to read a consent prompt before approving.

Testing Your Defenses

Red-team tooling for validating resilience:

  • ROADtools — Azure AD token acquisition and analysis
  • DeviceCodePhish — open-source device code phishing simulation
  • TokenTactics — token enumeration and exchange for Azure AD
  • PhishingCatcher — detection toolkit for OAuth phishing campaigns

Run purple-team exercises that simulate device code phishing end to end. Verify your DeviceCode sign-in alerts actually fire. The practice pairs well with our red-teaming playbook and AI agent attack-surface analysis.

Frequently Asked Questions

How does device code phishing bypass MFA?

It does not bypass MFA — it recruits it. The victim completes a fully legitimate authentication (password plus MFA) on the real provider’s domain. But the tokens from that flow go to the attacker’s polling client. Nothing is intercepted and nothing is faked. That is why traditional anti-phishing controls see nothing.

What is the device authorization grant (RFC 8628)?

An OAuth 2.0 extension for devices with limited input: CLI tools, smart TVs, IoT. The device displays a short code. The user enters it at a verification URL on another device. The device then receives tokens once the user authenticates. Device code phishing inverts this. The attacker’s “device” starts the flow, and the victim supplies the authentication.

How big is the 2026 device code phishing spike?

Detections are up 37x year-over-year in H1 2026, with 18+ attack kits available — some from $50 — and every major adversary-in-the-middle platform integrating the technique. Google’s June 2026 lawsuit against the Outsider Enterprise phishing operation and the FBI’s disruption of the same network mark its arrival as mainstream criminal infrastructure.

How do I detect device code phishing in Entra ID?

Filter sign-in logs for the authentication protocol “DeviceCode”. Alert on unusual source locations, off-hours flows, bursts in short windows, and tokens consumed far from where the login happened. Pair this with consent-grant auditing and app-registration monitoring for high-privilege scopes.

{“@context”:”https://schema.org”,”@type”:”FAQPage”,”mainEntity”:[{“@type”:”Question”,”name”:”How does device code phishing bypass MFA?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”It doesn’t bypass MFA — it recruits it. The victim completes a fully legitimate authentication on the real provider’s domain, but the resulting access and refresh tokens are issued to the attacker’s polling client. Nothing is intercepted or faked, so traditional anti-phishing controls see nothing.”}},{“@type”:”Question”,”name”:”What is the device authorization grant (RFC 8628)?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”An OAuth 2.0 extension for devices with limited input — CLI tools, smart TVs, and IoT. The device shows a short code, the user enters it at a verification URL, and the device receives tokens once the user authenticates. Device code phishing inverts this by having the attacker’s client initiate the flow and the victim supply the authentication.”}},{“@type”:”Question”,”name”:”How big is the 2026 device code phishing spike?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”Detections rose 37x year-over-year in H1 2026, with 18+ attack kits — some priced from $50 — and every major adversary-in-the-middle platform integrating the technique. Google’s lawsuit against Outsider Enterprise and the FBI’s disruption of the operation mark its mainstream arrival.”}},{“@type”:”Question”,”name”:”How do I detect device code phishing in Entra ID?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”Filter sign-in logs for authentication protocol DeviceCode and alert on unusual source locations, off-hours flows, flow bursts, and tokens consumed from geographies different from the authentication event. Pair with consent-grant auditing and app-registration monitoring for high-privilege scopes.”}}]}

References

The closing operational note: device-code phishing is defeated by teaching users the one asymmetry that matters — legitimate device-code flows always start from a device the user controls, so a code that arrives by email or chat asking to be entered elsewhere is definitionally hostile. Conditional-access policies blocking legacy authentication flows, and identity-platform logging that flags token issuance for unfamiliar devices from unfamiliar locations, complete the control stack. The technique is simple; so is the defense — but only for organizations that deployed both the policy and the training before the campaign rather than after.

Hmmnm
Published by Hmmnm

Hands-on cybersecurity tutorials, CVE breakdowns, and guided learning paths — written and lab-tested by the Hmmnm team.

This article is part of the guided learning path Identity & Authentication Attacks — track your progress there.
Need this kind of testing done for your organization? Hmmnm Phishing Simulation service — fixed quote after a free scoping call.
Keep going — the structured way
This post is one step. The learning paths chain the next ones for you, with progress tracking and no account needed.
Follow a learning path →

Prabhu Kalyan Samal

Application Security Consultant at TCS. Certifications: CompTIA SecurityX, Burp Suite Certified Practitioner, Azure Security Engineer, Azure AI Engineer, Certified Red Team Operator, eWPTX v3, LPT, CompTIA PenTest+, Professional Cloud Security Engineer, SC-900, SC-200, PSPO I, CEH, Oracle Java SE 8, ISP, Six Sigma Green Belt, DELF, AutoCAD. Writing about ethical hacking, security tutorials, and tech education at Hmmnm.