Rogue two-factor devices
| Class | Persistence, Authentication |
|---|---|
| Also known as | Device registration, rogue MFA enrolment |
| OWASP Top 10 | A07:2025 Authentication Failures |
| MITRE ATT&CK | T1098.005 Account Manipulation: Device Registration |
| Tactics | Persistence, Privilege Escalation |
| Typical severity | High |
| Affects | Accounts that accept more than one second factor: identity providers such as Okta, Duo and Microsoft Entra ID, code hosts such as GitHub, and apps with their own two-factor settings |
MFA systems such as Duo and Okta let a user attach devices to an account as second factors, and whoever registers one can sign in with it from then on. An attacker who gets into an account once, with a stolen password or a copied session, can add a factor of their own and pass every later two-factor authentication check without the owner.1 A password change leaves the factor in place, because an enrolled authenticator-app secret stays valid after the password changes.2
Why accounts take more than one factor
Accounts accept several factors so that a lost phone does not force the owner into Account recovery. NIST's authentication guideline requires services to allow more than one per account and encourages users to keep at least two.3 It also sets two conditions on adding one. The person adding it must first prove themselves at the highest assurance level the account already supports (or at the level the new factor will serve, if that is lower), and the service must tell the owner through a channel separate from the one used for the change.3 Changing the phone number that receives codes counts as adding a factor under these rules.3
An app that skips the first condition lets any signed-in session add a factor. A session taken by Session hijacking or relayed by a phishing proxy is then enough, because the settings page never asks for something the attacker lacks. Asking again for a code from a factor already enrolled stops a stolen session from adding one, since the cookie does not carry the factor itself.2 Without the second condition, the owner gets no message and has no reason to check the account.
Accounts with no factor yet
An account with no second factor yet is the easiest target. Some self-enrolment flows ask only for the username and password before the first device is added, and some do the same for an account that has been inactive.1 An attacker who guesses or steals that password then holds the account's first and only second factor. APT29 enrolled a device after guessing the password of a dormant account, and Scattered Spider registered MFA devices during campaign C0027 to keep its access through victims' VPNs.1
The 2021 Duo case
A joint FBI and CISA advisory of March 2022 describes an intrusion at a non-governmental organisation that began as early as May 2021.4 The attackers guessed the simple password of an account that Duo had un-enrolled after a long time without use, while the account stayed active in Active Directory, the organisation's Windows user directory. Duo's default settings let a dormant account enrol a new device, so the attackers registered theirs and reached the network.4
With that foothold they used PrintNightmare (CVE-2021-34527), a flaw in the Windows print service, to get administrator rights, and edited a domain controller's hosts file (the local list that maps names to addresses) so the Duo server's name pointed at the local machine, and relied on the default of Duo for Windows to let sign-ins through when its server could not be reached. Other accounts then had no working second factor, and the attackers went on to the VPN, cloud storage and email.4 The advisory's first fixes were to review MFA settings for re-enrolment and "fail open" behaviour, and to disable inactive accounts in every system, the MFA service included.4
Devices joined to a directory
The technique also covers devices registered in a company directory or device management system rather than as a factor.1 In a campaign Microsoft reported in January 2022, attackers phished passwords and then joined their own Windows 10 machine to a victim organisation's Azure AD, which did not ask for MFA at that step. From that device they sent phishing mail to over 8,500 users inside and outside the organisation, and the internal messages, coming from a device the domain recognised, lacked many of the marks that usually expose phishing.5 Microsoft recommended requiring MFA to register or join a device.5
Adding factors safely in an app
In Supabase Auth the session's access token carries the level: aal1 after the first factor, aal2 once a second factor has been verified.6 The documented setup flow calls the enrol API from an aal1 session, which suits a user's first factor.7 Once the user has a verified factor, the Auth server refuses to enrol another from an aal1 session and returns the error code insufficient_aal ("AAL2 required to enroll a new factor").8 The app's part is to send the user through challenge and verify first. getAuthenticatorAssuranceLevel() reports that state as currentLevel aal1 with nextLevel aal2:7
const { data: lvl } = await supabase.auth.mfa.getAuthenticatorAssuranceLevel();
if (lvl.nextLevel === 'aal2' && lvl.currentLevel !== 'aal2') {
// Ask for a code from an existing factor (challenge and verify) first
return showMfaChallenge();
}
const { data, error } = await supabase.auth.mfa.enroll({ factorType: 'totp' });Removing a verified factor needs aal2 as well.8 Rules the app adds itself, such as asking for aal2 before the account email changes, belong in its API routes and database policies, since MFA shown only in the interface adds no security.62 Adding a factor should send the owner an email, and removing one should as well.32 For high-value accounts, a delay before a new factor takes effect gives the owner time to act on that email.2
Find where this app lets a signed-in user add, replace or remove a second factor (authenticator app, phone number, security key, passkey). If the user already has a verified factor, require a fresh code from that factor before the change, checked on the server and not only in the interface. After every change, send the user an email with the time and device, and write the event to the audit log. List the files you changed.
Finding and removing one
GitHub writes two_factor_authentication.add_factor, security_key.register, passkey.register and trusted_device.register to a user's security log, and two_factor_authentication.update_fallback when the fallback method changes.9 One of these entries that the owner did not make suggests a takeover. Remove every factor the owner does not recognise.3 A TOTP secret that may have been copied is replaced by enrolling a new one.2 The wider response, covering sessions and tokens, is in Responding to an administrator account takeover.
In SecFlash
SecFlash reports a member of a Cloudflare account who signs in with a password alone as SF-CLD-313, and the same for a Supabase account as SF-CLD-529, both on the Cloud page. An account in that state is the one where an attacker's device can become the first second factor.
See also
- Multi-factor authentication
- Passkeys and WebAuthn
- Responding to an administrator account takeover
- Session hijacking
- Adversary-in-the-middle phishing
- MFA push fatigue
- Additional cloud credentials
- Category: Persistence
References
- a b c d MITRE (version 1.4, 4 November 2026). "Account Manipulation: Device Registration, T1098.005". MITRE ATT&CK.
- a b c d e f "Multifactor Authentication Cheat Sheet". OWASP Cheat Sheet Series.
- a b c d e NIST (August 2025). "SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management". National Institute of Standards and Technology.
- a b c d FBI and CISA (15 March 2022, revised 2 May 2022). "Russian State-Sponsored Cyber Actors Gain Network Access by Exploiting Default Multifactor Authentication Protocols and “PrintNightmare” Vulnerability", AA22-074A. CISA.
- a b Microsoft 365 Defender Threat Intelligence Team (26 January 2022). "Evolved phishing: Device registration trick adds to phishers’ toolbox for victims without MFA". Microsoft Security Blog.
- a b Supabase (n.d.). "Multi-Factor Authentication". Supabase Docs.
- a b Supabase (n.d.). "Multi-Factor Authentication (TOTP)". Supabase Docs.
- a b Supabase (n.d.). "internal/api/mfa.go". supabase/auth on GitHub.
- back GitHub (n.d.). "Security log events". GitHub Docs.
External links
- Multifactor Authentication Cheat Sheet, OWASP Cheat Sheet Series