What is device code phishing?

The short answer

Device code phishing is a scam where the attacker's computer requests a sign-in code and you type it on Microsoft's real page, which signs their device into your account.

Animated diagram: What is device code phishing?

Device code phishing

Device code phishing is a scam that abuses a normal sign-in step. You’ve seen that step on smart TVs. The TV shows a short code, you approve it on your phone, and the TV is signed in. It’s a published standard called RFC 8628 (Request for Comments 8628), the OAuth 2.0 (Open Authorization) Device Authorization Grant, released by the IETF (Internet Engineering Task Force) in August 2019. The standard itself warns that the flow can be started on a device in an attacker’s possession.

That warning is the whole attack. The scammer’s computer plays the role of the TV. You type its code on Microsoft’s real sign-in page and approve it with MFA (multi-factor authentication). Nothing on the page is fake. Microsoft says it found no vulnerability in its code base. The trick is simply that the device you just signed in belongs to someone else.

What device code phishing actually does

First, the attacker’s server asks Microsoft’s device authorization endpoint, /oauth2/v2.0/devicecode, for a sign-in. The answer holds a long secret device_code that the attacker keeps and a short user_code meant for the victim. It also holds a verification_uri, an interval, a message and expires_in, which is 900 seconds, or 15 minutes, by default.

Then the server polls. Every few seconds it sends a request with grant_type=urn:ietf:params:oauth:grant-type:device_code. Until the victim finishes, the reply is authorization_pending. Once the victim completes sign-in, the next reply holds an access_token and a refresh_token. In Microsoft’s example response, the access token’s expires_in is 3599 seconds. The access token opens the mail. The refresh token renews it.

How the attack unfolds

  1. The attacker poses as a device. Their server asks Microsoft for a sign-in, just as a TV would. It keeps the secret device code for itself.
  2. The code arrives in disguise. The short user code reaches you as a meeting ID. Modern kits such as EvilTokens request it only when you land on their page, so the 15-minute clock starts at your click.
  3. You sign in for them. You open microsoft.com/devicelogin, paste the code and pass MFA yourself. MFA does its job. It just approves the wrong device.
  4. Their server collects the tokens. The next poll after you finish returns an access token and a refresh token. Now the attacker can read your mail.

The result is access to your inbox, and the attacker never needs your password. Microsoft disclosed Storm-2372 on February 13, 2025. The group had been active since August 2024, hid these codes in fake Teams meeting invites, and then searched victims’ mail for words like password, admin and credentials.

A real Microsoft page is not a safe sign-in

Most phishing advice says to check the web address. Here that doesn’t help, and Proofpoint says the same. The page at microsoft.com/devicelogin is Microsoft’s genuine page. Only the device on the other end is theirs. Admins can still see it. In Entra sign-in logs, the Authentication Protocol filter has a Device code option, and the original transfer method shows Device code flow. An error 50199 followed by a success is another sign of this flow.

What to do

  • Only type a code that is showing on a screen you’re using right now.
  • Treat a code that arrives in a message, chat or meeting invite as a sign-in for whoever sent it, and don’t enter it.
  • If you already typed one, tell your security team right away.
  • If you’re an admin, filter Entra sign-in logs by the Device code option and look for error 50199 followed by a success.

#devicecodephishing#phishing#oauth#microsoft365#entraid#mfa#cybersecurity#infosec#accountsecurity

Watch it in 60 seconds