Skip to content

Back to the catalog

We Need to Talk About Device Code Phishing
huntress.comarticle

We Need to Talk About Device Code Phishing

Huntress recaps a Tradecraft Tuesday episode explaining device code phishing, where attackers generate legitimate Microsoft OAuth device authorization codes and phish victims into entering them, instantly receiving valid session tokens that bypass MFA. It covers the technique's origin (Dr. Nestori Syynimaa/AADInternals, 2020), Storm-2372's February 2025 Teams-lure campaign, and a March 2026 EvilTokens PhaaS campaign that abused Railway.com as a clean-IP token-harvesting relay against 344 organizations, plus mitigations like Microsoft's Conditional Access block, device registration monitoring, and disabling device code flow.

TL;DR Explainer on OAuth device-code phishing (Storm-2372, EvilTokens/Kali365 PhaaS) that steals MFA-protected sessions, with Huntress detection/mitigation guidance.
Document

What it is

A Huntress explainer on device code phishing — abuse of the OAuth 2.0 device authorization grant (a 2019 extension meant for input-constrained devices like TVs) to steal Microsoft 365 / Entra ID OAuth tokens. The technique was first published by Dr. Nestori Syynimaa (AADInternals) in 2020; the summary names the campaigns, this piece supplies the mechanics and the detection-relevant infrastructure.

How it works

The attacker — not the victim's device — generates the legitimate 8-character device code. A phishing lure then tricks the target into entering that attacker-controlled code at the real microsoft.com/devicelogin page and approving the prompt. The attacker's backend immediately receives valid OAuth tokens.

flowchart LR
  A[Attacker generates<br/>device code] --> B[Lure delivers code<br/>to victim]
  B --> C[Victim enters code at<br/>real microsoft.com/devicelogin]
  C --> D[Victim approves prompt]
  D --> E[Attacker backend<br/>receives OAuth tokens]
  CA[Conditional Access:<br/>block device code flow] -. cuts .-> C

The reason this is hard to defend: because the victim authenticates on the genuine Microsoft login page, trained phishing red flags (sketchy domains, fake login forms) do not apply — and stealing the resulting token sidesteps MFA entirely.

Preconditions / Affected

Microsoft 365 / Entra ID tenants where device code flow is not blocked. The March 2026 EvilTokens campaign shows the operational tells: threat actors abused Railway.com (a developer PaaS) as a token-harvesting engine specifically to borrow its clean IP reputation and bypass Microsoft's risk scoring, and routed victims through multi-hop redirect chains — compromised websites, security-vendor URL rewriters, and Cloudflare Workers pages. Lures were highly personalized: construction RFPs, DocuSign, voicemail notifications. Storm-2372 built rapport first over WhatsApp, Signal, or Teams while impersonating prominent individuals.

What to do

The only mitigation the page names is Microsoft Conditional Access in Entra ID — policies that evaluate each sign-in on signals (user, location, device, risk) and apply controls. The article points to a Microsoft-managed Conditional Access policy that blocks device code flow (the text is cut off mid-sentence and gives no configuration steps). Huntress sardonically labels reliance on anything weaker "hope-as-a-service."

Caveats

This is a recap of a June 2026 Tradecraft Tuesday episode, not an advisory — no detection queries, IOCs, or step-by-step Conditional Access configuration are provided, and the block-device-code-flow guidance is truncated. Treat the Railway.com / redirect-chain details as hunt leads to develop, not a finished detection.

Organisations named here

  • Nestori Syynimaa

Technologies named here

  • Microsoft Entra ID / Azure AD
  • AADInternals
  • Conditional Access
  • Microsoft 365 / Office apps
  • OAuth 2.0 device authorization grant
  • Railway.com
  • Cloudflare Workers
  • OAuth
  • Microsoft Entra ID
  • Microsoft 365
  • Railway

Techniques named here

  • Device code phishing
  • Rapport-building social engineering via messaging apps
  • Multi-hop redirect chains

Threat actors named here

  • Storm-2372
  • EvilTokens
  • Kali365