
Device Code Phishing
Device code phishing is phishing that tricks a person into typing a short code into a real sign-in page. The attacker's own device asked for that code, so when the person signs in, completing their password and multi-factor authentication if asked, the attacker's device is let into their account.
CyberRecaps is supported by its readers. We may earn an affiliate commission at no extra cost to you if you buy through a link on this page.


Explain It Like I'm 10
Imagine your friend's new games console has no keyboard, so it shows a short code and asks you to type it on your phone to log it in. That's normal and handy.
Now imagine a stranger sends you a code from their own console and says it's from your friend. You type it on your phone with your real password, and the stranger's console is now logged in as you. The smart move is to only type a code when you started the sign-in yourself, from something you meant to connect to your account. If a code arrives in a message, or a web page you were sent to shows you one, stop and ask someone you trust.
Device Code Phishing Quiz
Test your knowledge about Device Code Phishing - maybe you already know everything about it.
What does the victim enter the attacker-supplied code on?

How device code phishing works
Phishing is an attempt to get someone to hand over information, money or access by pretending to be a party they trust. Device code sign-in is a real feature of OAuth, the system many apps use to get access to an account. Microsoft's documentation describes it as a way to sign in on devices with limited input, such as a smart TV, an IoT device or a printer. The device shows a short code, and the person finishes signing in in a browser on another device, such as a phone or laptop.
The program asking for the sign-in is called the client application. It requests the permissions it needs, and once the person signs in, it receives two kinds of token:
- An access token: lets the application reach a resource, such as a mailbox, for a limited time (by default one hour in Microsoft Entra, Microsoft's identity service).
- A refresh token: can be used to get new access tokens, so it keeps the access going.
For a personal Microsoft account, the person is also asked to consent to the permissions the application requested.
Device code phishing turns that around. The attacker's own client application starts the sign-in on a device they control, gets a code, and sends it to the target with a link to the real sign-in page. Microsoft's campaign reports describe the target entering the attacker's code into a legitimate sign-in page. When the target signs in, the tokens go to the attacker's device. The target's own sign-in is what lets the attacker in. MITRE ATT&CK, a public catalogue of attacker techniques, lists "device code phishing" under T1566.002, Spearphishing Link.
Why MFA alone may not stop it
If the target isn't already signed in, the real page asks for their password and multi-factor authentication (MFA), which means two or more proofs of identity. The target can pass those checks, because they are the one signing in. What they authorize is the attacker's sign-in, so the attacker's device ends up holding a live access token.
That is why this is a risk to plan for, not a reason to switch MFA off. Microsoft still describes MFA as an essential part of identity security. Keep MFA enabled, and add protection on top of it by restricting device code sign-in where it isn't needed (see the administrator steps below).
The access lasts as long as the tokens remain valid, according to Microsoft's report on the Storm-2372 campaign. That is why changing the password alone may not end it; the signed-in session has to be cut off.
Why an expiring code can still be abused
A device code does expire, and that limits the attack window. Microsoft's documented default is 15 minutes from the moment the request is sent. That is Microsoft's default, not a rule for every OAuth service: the standard leaves the lifetime to the service that issues the code.
Expiry cannot prevent every attempt made in real time. RFC 8628, the standard that defines device code sign-in, saw this in 2019. Its section "Remote Phishing" says a short lifetime limits the usefulness of codes sent by email or text message, but does not stop a phisher from presenting a fresh code, especially when interacting with the user in real time. A fresh code starts a new validity window; it does not extend a code that has already expired. The 2026 campaign Microsoft described made each code at the moment the user clicked the phishing link, so the code was fresh when the victim saw it.

Device code phishing vs consent phishing and AiTM phishing
- Phishing: the general trick. Device code phishing gets the person to sign in for the attacker's device instead of handing over a password.
- Consent phishing: centers on getting a person to grant a malicious application permissions through deception. Device code phishing centers on a different action: tricking the person into completing a sign-in that the attacker started. The device flow can include consent to requested permissions, so the two can overlap.
- AiTM phishing: a fake page relays the sign-in and takes the session it produces. In device code phishing the page is real.

Recent campaigns, and how fast attempts are growing
In February 2025, Microsoft described a campaign by a group it calls Storm-2372, active since August 2024 against governments, non-governmental organizations (NGOs) and a wide range of industries. The group posed as "a prominent person relevant to the target" on WhatsApp, Signal and Microsoft Teams to build rapport, then sent invitations to online events or meetings by email. The sign-in page those invitations led to was the real one.
In April 2026, Microsoft reported a campaign that used AI to write emails tailored to the victim's role, on themes such as invoices. A page the attacker controlled displayed the code on the victim's screen, created at the moment of the click, next to a button to Microsoft's real device login page. After the breach the attackers worked to keep access: in some cases they registered new devices on the account within 10 minutes, and in others they waited several hours before creating malicious inbox rules.
How fast attempts are growing
CrowdStrike's published summary of its 2026 threat hunting report, dated 3 August 2026, says: "Monthly device code phishing attempts jumped 15x in the past six months." The count is what CrowdStrike's own threat teams observed, and the summary gives no starting number, so it shows a fast rise, not how many attacks there are or how many succeeded.

What to do about a request to enter a code
Before you enter a code
- The one rule: only enter a code during a sign-in you started yourself, from an application or device you meant to connect to your account. This is not only about new hardware. Command-line tools such as the Azure CLI can also ask you to enter a code shown in your terminal.
- Check what you are approving: look at the application and the account the sign-in page names, and go ahead only if both are what you expect.
- An unexpected code request: don't enter a code that arrives in an email, chat or meeting invitation, or after a page asks you to verify your identity to open a document, even if the sign-in page is real.
- A code on your own screen is not proof: a page the attacker controls can display the code on your screen, as in the April 2026 campaign above.
- At work: if you're unsure, ask your IT department through a contact you already have.
If you already entered a code
- A work account: tell your IT department straight away. They can revoke the account's sessions and tokens, and may need to disable the account for a while while they contain the problem.
- A personal Microsoft account: use Sign out everywhere in your account's Advanced security options. Microsoft's support page says this signs you out of browsers, apps and other places your account is used to sign in within 24 hours, except an Xbox console, which has its own sign-out steps.
- Your password: changing it is sensible, but on its own it may not end the attacker's access.
For IT administrators
- Block device code sign-in where you can: Microsoft recommends getting "as close as possible to a unilateral block on device code flow", allowing it only "in well documented and secured use cases, like legacy tooling that can't be updated". Keep MFA enabled alongside it.
- Revoke the sessions, and check what is still working: if device code phishing is suspected, revoke the user's sessions and refresh tokens. Revoking does not guarantee that all existing access ends at once: applications using access tokens lose access when the token expires (by default after an hour), and applications with their own sessions follow their own rules. Microsoft's April 2026 report advises temporarily disabling the compromised account for immediate containment.
- Remove what the attacker added: look for attacker-added device registrations, unfamiliar authentication methods, malicious mailbox rules and forwarding, the kind of persistence seen in the April 2026 campaign, which used new devices and inbox rules, and review the account's sign-in and audit activity to find what the attacker accessed or changed.
Reporting it
- In the US: report the phishing attempt to the FTC at ReportFraud.ftc.gov, and forward phishing emails to the Anti-Phishing Working Group at reportphishing@apwg.org.
- In the UK: forward a suspicious email to report@phishing.gov.uk.
- Elsewhere: look for your own country's national service for reporting phishing.