Cybersecurity researchers have uncovered a sophisticated technique to bypass Microsoft’s phishing-resistant multi-factor authentication (MFA) by exploiting the device code authentication flow and Primary Refresh Tokens (PRTs).
This method allows attackers to register Windows Hello for Business keys, effectively creating a persistent backdoor even in environments with strict MFA policies.
The technique was initially developed for an internal “EntraIDiots” Capture The Flag (CTF) competition, where participants had to overcome a challenge that only permitted access using phishing-resistant MFA.
Researchers found they could force MFA during authentication by manipulating request parameters, regardless of existing security policies.
“After a quick test our assumption was correct!” the researchers noted, referring to their discovery that the “amr_values=ngcmfa” parameter could force users to perform MFA during authentication flows.
The attack leverages device code phishing combined with an adversary-in-the-middle (AiTM) approach. It begins when a victim visits a malicious page that retrieves Microsoft’s login interface using a specially crafted URL containing specific parameters:
When users complete authentication (including MFA), attackers obtain authorization codes that can be exchanged for access and refresh tokens. With these tokens, attackers can:
This attack is particularly concerning because it’s difficult to detect. “From a user perspective it’s quite difficult to detect that a new WHFB key was added,” the researchers explained. The compromised authentication method doesn’t appear in the user’s account page that lists other authentication methods.
Detecting these malicious keys is challenging even for administrators. Microsoft’s design prevents administrators from viewing their own authentication methods in Entra ID, requiring another admin to check for suspicious activity.
The researchers outlined several prevention strategies:
However, detection remains problematic. Due to limitations in Entra ID’s audit logging capabilities, the research team encountered difficulties correlating interactive sign-ins with device creation or WHFB key registration.
This technique builds upon previous work by security researcher Dirk-jan Mollema, who demonstrated similar PRT phishing attacks in 2023. The current advancement focuses on reliably forcing MFA during authentication, making it possible to execute the full attack chain against environments with stringent security policies.
As organizations increasingly rely on passwordless authentication methods like Windows Hello, this research highlights the importance of a defense-in-depth approach rather than depending solely on phishing-resistant MFA.
Are you from the SOC and DFIR Teams? – Analyse Malware Incidents & get live Access with ANY.RUN -> Start Now for Free.