← All Posts

Device code phishing: how attackers add their own device to your Microsoft 365, and how to stop it

How device code phishing works: a staff member types a code on Microsoft's genuine sign-in page, the attacker receives sign-in tokens and registers a rogue device that survives a password reset. Three fixes: block device code sign-in, limit who can register devices, revoke sessions and delete the device.
Active campaign
Who's at riskAny organization on Microsoft 365
Password stolen?No, a code is
Does a password reset fix it?Not on its own
FixBlock device code sign-in, limit device registration

An active phishing campaign is getting into Microsoft 365 accounts without stealing a single password. Staff are tricked into typing a short code on Microsoft's own, genuine sign-in page. That one step hands the attacker a working sign-in, and in this campaign the attacker then adds their own computer to your organization's Microsoft 365 directory. That rogue device can keep access even after the person changes their password.

On December 3, 2026, the security company Huntress reported 468 rogue device registrations, traced to 326 compromised accounts at 305 organizations, in November alone, and said the campaign is still active. Microsoft first described the same trick in February 2025, and its advice hasn't changed: block this type of sign-in wherever you can.

The good news: for most small and medium organizations, the fixes are a few settings, and the most important habit for staff takes one sentence to explain.

What happened, in plain words

Some devices, like smart TVs, conference-room systems and command-line tools, have no easy way to type a password. Microsoft's answer is device code sign-in: the device shows a short code, and you type it on Microsoft's sign-in page on your phone or computer to approve it.

Attackers abuse that. They start a sign-in themselves, then send your staff the code with a convincing story. In the campaign Huntress described, the lure looked like a non-disclosure agreement "protected" by Adobe. The person goes to the real Microsoft page, enters the code, signs in as usual (multifactor authentication included) and, without realizing it, approves the attacker's sign-in.

The lure

An email or message asks the person to enter a code to view a document.

The code

They type it on Microsoft's genuine sign-in page and approve it. The attacker receives sign-in tokens. No password changes hands.

The rogue device

The attacker registers their own Windows device in your Microsoft 365 directory, which gives them a long-lasting sign-in.

The access

Huntress saw the attackers reach Office, and in some cases OneDrive, SharePoint and Exchange email.

The rogue device is what makes this campaign nasty. Microsoft explains that an attacker can use the stolen sign-in to "register an actor-controlled device within Entra ID" (Entra ID is the sign-in and directory service behind Microsoft 365) and then obtain a long-lived sign-in token for it. Huntress found that token survives a password reset, because it didn't come from the password in the first place. Changing the password isn't enough: the device has to be found and removed.

Ordinary phishing

A fake page steals your password

Look-alike website. Check the address, use MFA, change the password and you're usually back in control.

≠
Device code phishing

The real page, the wrong approval

The address really is Microsoft's. MFA is completed by your own staff member. A password reset alone doesn't remove the attacker's device.

Does this affect you?

1

Does your organization use Microsoft 365 (Outlook, Teams, OneDrive or SharePoint)?

2

Has anyone checked whether device code sign-in is blocked for your staff?

3

Has anyone limited who can add devices to your Microsoft 365, and do they review new ones?

Yes to 1, and "no" or "not sure" to 2 or 3?
Then this campaign can reach you. The technique works against any Microsoft 365 organization, whatever its size or location.

What to do today: tell your staff one thing

This is the step anyone can take, right now, without touching a setting:

If you didn't start the sign-in yourself, on a device in front of you, don't enter the code. Not for a document, not for a voicemail, not for "IT".

Legitimate device codes come from a screen you're looking at, such as a meeting-room system you're setting up. A code that arrives by email, chat or phone call is a red flag, even if the page you're sent to is genuinely Microsoft's. If someone already entered one, they should report it straight away: speed matters more than embarrassment. Our security awareness training covers exactly this kind of lure.

What your IT person or provider should do

Hand this section to whoever manages your Microsoft 365. Every step below is from Microsoft's own documentation.

Block device codeLock down devicesHuntClean up

1. Block device code sign-in

Microsoft "recommends blocking device code flow wherever possible." Its Conditional Access guidance says organizations should "get as close as possible to a unilateral block," allowing it only for well-documented exceptions. Conditional Access needs Microsoft Entra ID P1, which Microsoft 365 Business Premium customers can use.

Microsoft Entra admin center
Entra ID > Conditional Access > Policies > New policy
  Users:      All users (exclude your break-glass accounts)
  Resources:  All resources
  Conditions: Authentication flows > Device code flow
  Grant:      Block access
  Enable:     Report-only first, then On

Start in report-only mode, as Microsoft recommends, to see whether anything legitimate (a meeting-room system, an admin script) still uses device codes, then switch the policy on.

2. Lock down who can add devices

Under Entra ID > Devices > Device settings, Microsoft's defaults are generous: Users may join devices to Microsoft Entra ID is set to All, Require multifactor authentication to register or join devices is No, and the Maximum number of devices per user is 50.

  • Limit joining to the people who actually set up computers.
  • Require MFA to register or join devices. Microsoft recommends it, preferably through the Conditional Access "Register or join devices" user action.
  • Lower the device limit to what a person really needs.
  • No Business Premium? Huntress suggests at least turning on Microsoft's free security defaults, which Microsoft makes available to every customer. That's a baseline, not a fix for device codes: plan a move to Conditional Access. (Why MFA matters in the first place: why MFA is essential.)

3. Look for rogue devices and odd sign-ins

Huntress published what it saw, so you can check your own directory:

Device names

Most rogue devices were named MH- followed by 16 letters and numbers (for example MH-51FB898341CEA47A).

Old Windows builds

The devices reported an old Windows 10 build, 10.0.19041.928, with no hardware details.

Sign-in logs

Search interactive and non-interactive sign-in logs for device code sign-ins your staff didn't make.

Mailbox rules

Check compromised accounts for inbox rules that hide, forward or delete mail.

4. If you find one, clean up properly

  1. Delete or disable the rogue device in Entra ID. Microsoft notes that disabling a device revokes its long-lived sign-in token and refresh tokens.
  2. Revoke the person's sessions: Entra ID > Users > select the user > Revoke sessions.
  3. Reset their password, and remove any MFA methods or registered devices the person doesn't recognize.
  4. Keep the audit and sign-in logs for the investigation, and consider whether privacy rules require you to report what was accessed.

The Canadian angle

This isn't the only campaign of its kind. On October 28, 2026, the Canadian Centre for Cyber Security warned (alert AL26-028) of an ongoing campaign against Canadian organizations, especially legal and financial firms, in which callers pose as the internal IT help desk. Different trick, same outcome: attackers get past multifactor authentication, register their own sign-in methods or devices, and pull data out of Microsoft 365. The Cyber Centre recommends phishing-resistant MFA, Conditional Access that requires managed devices, stronger checks on new device enrolments and, after a compromise, revoking sessions and tokens.

For an Alberta organization, an attacker sitting quietly in your email and files is also a privacy problem: client records, payroll and contracts live there. If Conditional Access is new to you, we explained it in plain words in how Conditional Access might save your business.

How we can help

If you're not sure whether device code sign-in is blocked in your Microsoft 365, or who can add devices to it, that's a quick thing to check. Our cybersecurity team and managed IT services can review these settings with you, test a Conditional Access policy in report-only mode before switching it on, and look for devices that shouldn't be there. Talk to us.

Sources and further reading

Have a question? Let's talk.