Get a free trial →

Push Logo

Device code phishing: how to detect and stop it

Geometry graphic

Device code phishing bypasses MFA and passkeys by targeting the authorization layer

How device code phishing works

  1. The attacker initiates a device authorization request with the target identity provider, generating a legitimate device code tied to an application they control
  2. The victim receives a phishing lure — via email, Teams message, LinkedIn DM, voice call, malvertising, or a compromised website — containing a link to the identity provider's real device code entry page
  3. The phishing page typically auto-polls for a fresh code on load, so the code is live and valid when the user arrives
  4. The victim enters the code on the genuine login page (e.g., microsoft.com/devicelogin). If not already signed in, they authenticate normally, including completing MFA
  5. The identity provider completes the authorization — connecting the attacker's app instance to the victim's account with full OAuth access
  6. The attacker now controls an authorized app instance with persistent access to the victim's email, files, and cloud applications

Why most security tools miss device code phishing

Push Security consent audit view showing OAuth permissions granted by users, helping security teams identify suspicious integrations and stop persistent access.

How do you stop device code phishing?

Push Security OAuth detection alert flagging a high-risk consent phishing attempt requesting excessive application permissions in the browser.

How Push detects and blocks device code phishing

Push Security OAuth detection alert flagging a high-risk consent phishing attempt requesting excessive application permissions in the browser.

Frequently asked questions

Device code phishing is a phishing technique that abuses the OAuth 2.0 device authorization grant (RFC 8628) to connect an attacker-controlled app instance to the victim's account. The attacker generates a legitimate device code tied to an app they control, delivers it to the victim via a phishing page, and the victim enters the code on the real identity provider page — authenticating normally, completing MFA, and authorizing the attacker's app on their account.

It is a form of authorization phishing: the attack targets the authorization layer rather than authentication, so every form of MFA including passkeys is bypassed.

AiTM phishing targets authentication — a reverse proxy sits between the user and the real login page, intercepting credentials, MFA tokens, and the resulting session cookie as they pass through. Device code phishing attacks authorization — the user visits the real identity provider page, authenticates normally, and the attacker's app instance is authorized on the victim's account. AiTM defeats MFA by proxying it; device code phishing makes MFA irrelevant because the authentication succeeds legitimately. The post-compromise outcomes differ too: AiTM produces a stolen session cookie with a limited lifetime, while device code phishing grants the attacker a persistent app connection with OAuth refresh tokens that can last indefinitely and be exchanged across applications via FOCI.

No. Device code phishing targets the authorization layer, which operates after authentication has succeeded. The user authenticates on the real identity provider page with their real credentials and MFA — including passkeys. Passkeys verify that the domain is genuine, and it is: the user is on microsoft.com or accounts.google.com. The attack tricks the user into authorizing an attacker-controlled app, not into revealing credentials or session tokens. Passkeys remain the strongest defense against authentication phishing (AiTM, credential theft), but they're irrelevant to authorization phishing.

Some can, but effectiveness is configuration-dependent and Microsoft-specific. "Block device code flow" is effective but also blocks legitimate use cases (Azure CLI, developer tooling, conference room hardware). "Require compliant device" blocks device code phishing because the flow can't present device compliance proofs. "Require phishing-resistant authentication" doesn't apply — the authentication in device code phishing is already legitimate. Token Protection (currently in preview) has limited applicability. Testing is essential: it's common to find conditional access policies in report-only mode or exceptions that leave the attack surface open. See the full conditional access analysis in Push's authorization phishing research.

Microsoft has the broadest exposure because of unrestricted scopes, reusable first-party client IDs, and FOCI token exchange, which is why the overwhelming majority of observed attacks target Entra ID. But the technique is not Microsoft-exclusive. GitHub is an obvious target — device code flow is the default CLI sign-in method, and broad scopes including full repository access are available. Salesforce was targeted in the 2025 ShinyHunters campaign. AWS also supports the flow. Google is lower risk for device code phishing specifically — Google explicitly limits which scopes are accessible through the device code flow, making Gmail, Calendar, and most Workspace APIs unavailable through this mechanism. Any platform that supports the device authorization grant is a potential target. Push's device code phishing detection is app-agnostic and works across identity providers.

In Microsoft environments, if the attacker targets the Microsoft Authentication Broker, they can register a virtual device against the victim's account and escalate to a full Primary Refresh Token (PRT). A PRT provides browser-level SSO — the attacker gets an interactive session that can move laterally across every SSO-joined application, equivalent to owning the user's authenticated browser. Even without PRT escalation, FOCI (Family of Client IDs) allows tokens obtained for one Microsoft app to be silently exchanged for access to others — Outlook, Teams, OneDrive, SharePoint, and more. A single device code phishing success can cascade into access across the entire Microsoft ecosystem.

FOCI (Family of Client IDs) is a Microsoft mechanism that allows tokens obtained for one first-party app to be exchanged for tokens to other apps in the same family — without additional consent or authentication. If an attacker obtains a token for Azure CLI through device code phishing, they can silently exchange it for access to Outlook, Teams, OneDrive, SharePoint, and dozens of other Microsoft applications. FOCI is what turns device code phishing from a single-app compromise into full ecosystem access. The same token-exchange mechanism applies to ConsentFix, which targets the authorization code grant rather than the device code flow but produces functionally identical post-compromise outcomes.

Start with your authentication logs. In Microsoft Entra ID, sign-in logs show device code grants — filter for the device code authentication protocol and look for anomalies: grants where the IP address at authorization differs from the IP used for subsequent account activity, grants against apps your organization doesn't typically use via device code, or unusual volumes of device code grants from non-developer users. These signals aren't conclusive on their own — a legitimate remote worker using Azure CLI will also show split IPs — but they establish a baseline and surface outliers worth investigating.

For platforms beyond Microsoft, log coverage varies. GitHub audit logs capture device code grants; Salesforce and AWS provide equivalent logging if enabled. Ensuring you're actually collecting these logs across every app that supports the device authorization grant is the first step — many organizations discover gaps only after an incident.

The core detection challenge is that a phishing-initiated device code grant looks identical to a legitimate one at the IdP layer. The authorization is real, the app is a legitimate first-party app, and the user authenticated normally. This is why browser-level detection adds a fundamentally different signal: Push detects and blocks the phishing kit that delivers the device code, not the grant itself, and blocks it before the user completes the authorization flow. Push also provides configurable warnings on device code login pages — in "Acknowledge" mode, any user who encounters a device code page generates a security alert, giving you app-agnostic visibility into device code authentication activity across your environment.

No single tool covers the full attack chain. Conditional access can block the device code flow for Microsoft, but only for users and apps you've scoped — and it doesn't apply to other platforms. Email security can flag lures delivered by email, but misses Teams, LinkedIn, voice, and malvertising delivery. IdP logs show device code grants, but can't distinguish legitimate from phishing-initiated grants without additional context. Browser-level detection is the most effective interception point because Push sees the phishing page itself, regardless of which platform is targeted or how the lure was delivered. Push detects and blocks device code phishing kits in real time before the authorization flow completes, and provides app-agnostic warnings on device code login pages as a supporting control.