Skip to content
Account takeover Write-up Advanced

Device Code Phishing – Add Your Own Sign-In Methods on Entra ID

After a successful device code phishing attack, an attacker can register new authentication methods such as security keys, TOTP, email or phone on the victim's Entra ID account. This allows the attacker to backdoor the account or perform self-service password reset using the newly registered methods.

Felix Aeppli Follow

Published on blog.compass-security.com

TL;DR An attacker is able to register new security keys (FIDO) or other authentication methods (TOTP, Email, Phone etc.) after a successful device code phishing attack. This allows an attacker to backdoor the account or perform the self-service password reset for the account with the newly registered sign-in methods.

Felix Aeppli, on blog.compass-security.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application that manages sign-in methods accepts tokens from a family of client IDs (FOCI) that have permission to update security info, and only requires a recent MFA claim for adding a security key, so tokens obtained via device code phishing can be used to register new authentication methods.

Impact

An attacker could backdoor the account or perform self-service password reset using the newly registered sign-in methods, but adding a security key requires the ngcmfa claim which is only valid for about 15 minutes after authentication.

What the attacker needed

Victim completes device code flow; attacker has tokens from phishing; ngcmfa claim within 15 minutes for security key

The fix

Microsoft stated the functionality is behaving as designed, so no fix was applied; prevention relies on restrictive Conditional Access policies and monitoring sign-in logs for device code authentication.

How it was found

  1. Initiate the device code flow with the required parameters.
  2. Send the user code to the victim; the victim logs in and provides consent.
  3. Request the required tokens (sessionCtx) and initiate registration of a new security token.
  4. Open Chrome to interact with the security key via the webauthn interface.
  5. Complete the registration when the security key is registered.
  6. Log in as the user without a password or 2FA key.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Device code phishing tricks a user into completing a login flow that an attacker started, giving the attacker tokens for the user's account. The report shows that with those tokens, the attacker can add their own sign-in methods, like a security key, so they can log in later even without the password. This is like copying someone's house key and then adding your own lock.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

More from Microsoft

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.