
OAuth Device Code Flow Security: How to Detect and Prevent Device Code Phishing
OAuth’s Device Authorization Grant (RFC 8628) was designed for TVs, CLIs, and IoT devices that can’t open a browser. Unfortunately, attackers have turned it into one of the most effective MFA-bypass techniques of 2024–2026, targeting thousands of Microsoft 365 organizations per campaign. This guide explains how the attack works at the protocol level and gives you specific, actionable steps to block it in every major identity platform. Clone the companion repo: oauth-device-code-phishing-defense has idempotent, production-ready scripts for every mitigation below — Conditional Access deployment and anomaly scanning for Entra ID, realm/client-level disabling for Keycloak, grant-type removal for Auth0, tuned Sentinel/Splunk detection queries, and a full incident-response playbook script. ...
