As reported by BleepingComputer, an ongoing device code phishing campaign has registered over 400 rogue Windows devices across 305 Microsoft Entra ID tenants, granting attackers persistent access that survives password resets. This is not a vulnerability in the traditional sense — it is the inevitable consequence of an authentication flow designed for convenience being weaponized at scale.
Why Device Code Phishing Works So Well
Device code flow was built for environments where a user cannot interactively sign in — think smart TVs, IoT devices, and CLI tools. The trade-off is fundamental: the user authenticates on a separate device by entering a code, and the requesting device receives tokens. There is no out-of-band confirmation that the device requesting tokens is actually the one the user intended to authorize. Attackers exploit this by generating codes themselves and tricking users into completing the sign-in on Microsoft's legitimate login page.
What makes this campaign particularly damaging is the attacker's next step — registering a rogue device in Entra ID and obtaining a Primary Refresh Token (PRT). A PRT is a cryptographic token that asserts device-level trust. Once an attacker holds a PRT, they effectively become a "trusted device" in your tenant. MFA re-prompts, conditional access policies, and even password resets may not disrupt their session because the trust was established at the device level, not the credential level.
The ROADtools Connection
Huntress noted that all registered devices reported a Windows build matching the default in ROADtools, an open-source toolkit for Entra ID security testing. This is significant: the attacker is not deploying custom malware or sophisticated infrastructure. They are leveraging a legitimate red-team tool to enumerate, register, and maintain access. The barrier to entry is minimal, which explains the volume — 468 registrations across 305 organizations in a single month.
The device naming pattern ("MH-" followed by 16 uppercase hex characters) and the reuse of device names across up to 24 unrelated organizations suggests a single threat actor or campaign operator running a semi-automated pipeline.
Who Is Most at Risk
Detection Opportunities
Defenders should hunt for the following indicators in Entra ID audit logs:
- Device registration events with names matching the "MH-" + 16 hex character pattern
- Devices reporting Windows build 10.0.19041.928 (ROADtools default)
- Device registrations from IP addresses or geographies inconsistent with the user's normal sign-in patterns
- Sign-ins using device code flow (
authenticationProtocol= deviceCode) followed by rapid device registration - Multiple devices registered to the same identity in a short window
Key Microsoft Graph / Entra ID log sources to query: AuditLogs (device registration events), SignInLogs (filter for device code authentication method), and DeviceEvents in Microsoft Defender for Endpoint if the rogue device attempted endpoint enrollment.
Shield53 Recommendations
Immediate Actions
- Disable device code flow if not required — In Entra ID, restrict the device code flow via conditional access or disable it entirely for user populations that do not need it. Microsoft allows tenant-level control over this authentication method.
- Review recently registered devices — Query Entra ID for all devices registered in the last 30 days. Look for the naming pattern, the specific Windows build, or devices with no corresponding Intune/MDM enrollment record.
- Revoke active sessions for any compromised identities — Do not just reset passwords. Use
Revoke-AzureADUserAllRefreshTokenor the Graph API equivalent to invalidate all tokens, including PRTs. - Remove rogue device objects from Entra ID — Delete the device objects to invalidate device-bound tokens.
- Enforce device registration policies — Require that only compliant, Intune-managed, or domain-joined devices can register. Limit who can register devices via Entra ID's device settings.
Longer-Term Hardening
- Implement conditional access requiring compliant devices for access to SharePoint, Exchange, and OneDrive
- Deploy phishing-resistant MFA (FIDO2, Windows Hello for Business) and deprecate push-based MFA where feasible
- Monitor for device code authentication events as a high-fidelity detection rule — legitimate usage should be rare and auditable
- Conduct regular device hygiene reviews — stale or unexpected device objects in Entra ID are a blind spot many teams never audit
This campaign underscores a broader truth: identity is the new perimeter, and device trust is part of that identity. When attackers can register a "trusted device" with nothing more than a phished code and an open-source tool, the entire concept of device-based conditional access becomes a liability rather than a control — unless you actively govern who can register devices and monitor what gets registered.