Back to all lessons
Awareness Lessons
4 days ago

Device Code Phishing Bypasses MFA to Hijack Microsoft 365 Accounts

Written by AI from the linked story. Not reviewed by an editor. How this works

The MadApe phishing kit exploits Microsoft's legitimate Device Code authentication flow, tricking victims into authorizing attacker-controlled sessions on a real Microsoft domain — meaning no password is ever stolen and MFA provides no protection. The attack succeeds because users are conditioned to trust Microsoft-branded sign-in pages and device code prompts, while the underlying OAuth token granted gives attackers persistent access to mailboxes and files. This matters because traditional defenses like password complexity policies and standard MFA are entirely bypassed, leaving organizations reliant solely on user awareness and identity governance controls. Without controls that restrict or monitor Device Code flow usage, any user who clicks the link and follows the prompt silently hands over their account.

Tactical Insight

Immediate actions

  • Disable or restrict the OAuth Device Code authentication flow in Azure AD/Entra ID Conditional Access policies for users who do not require it.
  • Block or quarantine emails containing PDF attachments with embedded links pointing to unknown or suspicious domains.

Long-term improvements

  • Implement Conditional Access policies that require compliant, managed devices and limit token issuance to known, trusted applications.
  • Conduct targeted security awareness training specifically covering OAuth phishing and device code abuse so users recognize and refuse unexpected authorization prompts.
  • Regularly audit granted OAuth application permissions and active refresh tokens, revoking any that are unrecognized or no longer needed.

Detection measures

  • Enable and monitor Azure AD sign-in logs and Defender for Cloud Apps alerts for anomalous Device Code flow authentications, especially from new or foreign IP addresses.
  • Alert on access token usage originating from IP addresses or user agents inconsistent with the authenticating user's normal behavior.

Back this up with a control

All controls and vendors

Training helps people spot this. These controls make the attack fail even on the day someone does not.