# GhostCode attackers abuse device codes to take over Microsoft 365 accounts

DevFeed: [GhostCode attackers abuse device codes to take over Microsoft 365 accounts](<https://devfeed.tech/articles/ghostcode-attackers-abuse-device-codes-to-take-over-microsoft-365-accounts-50519.md>)

Original publisher: [Read original article](<https://www.computerworld.com/article/4223889/ghostcode-attackers-abuse-device-codes-to-take-over-microsoft-365-accounts.html>)

Author: Shweta Sharma

Published: 2026-09-18T15:16:22Z

Content type: news

Language: en

Sources: [Computerworld](<https://devfeed.tech/sources/computerworld.md>)

Topics: [microsoft 365](<https://devfeed.tech/topics/microsoft-365.md>), [OAuth 2.0](<https://devfeed.tech/topics/oauth2.md>), [Social engineering](<https://devfeed.tech/topics/social-engineering.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [Entra ID](<https://devfeed.tech/topics/entra-id.md>), [MFA](<https://devfeed.tech/topics/mfa.md>), [API](<https://devfeed.tech/topics/api.md>), [Internet of things](<https://devfeed.tech/topics/iot.md>)

Tags: [access-control](<https://devfeed.tech/tags/access-control.md>), [access-control-authentication-cybercrime-identity-and-access-management-microsoft-microsoft-365](<https://devfeed.tech/tags/access-control-authentication-cybercrime-identity-and-access-management-microsoft-microsoft-365.md>), [active-directory](<https://devfeed.tech/tags/active-directory.md>), [auth](<https://devfeed.tech/tags/auth.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [cybercrime](<https://devfeed.tech/tags/cybercrime.md>), [identity-and-access-management](<https://devfeed.tech/tags/identity-and-access-management.md>), [microsoft](<https://devfeed.tech/tags/microsoft.md>), [microsoft-365](<https://devfeed.tech/tags/microsoft-365.md>), [microsoft-graph](<https://devfeed.tech/tags/microsoft-graph.md>), [oauth-2-0](<https://devfeed.tech/tags/oauth-2-0.md>), [phishing](<https://devfeed.tech/tags/phishing.md>), [security](<https://devfeed.tech/tags/security.md>), [social-engineering](<https://devfeed.tech/tags/social-engineering.md>), [tokens](<https://devfeed.tech/tags/tokens.md>)

## AI overview

Computerworld reports that the GhostCode phishing kit abuses Microsoft's OAuth 2.0 device authorization flow to trick Microsoft 365 users into authenticating an attacker-controlled device. Stolen tokens are used to register devices, obtain credentials, and establish persistence in the victim's Microsoft environment.

## Source excerpt

Microsoft 365 users are being tricked into handing over access to their accounts by a new phishing kit, GhostCode, that exploits a weakness in a legitimate device authorization flow. Researchers in eSentire's threat response unit identified the campaign in late August 2026. The kit abuses Microsoft's OAuth 2.0 device authorization grant flow, a legitimate mechanism designed to enable authentication from IoT devices, smart TVs, printers, or other devices that cannot easily support a conventional browser-based login. The technique, known as device-code phishing, has been seen in other attacks before. As part of the flow, the device displays a code for the user to enters in a browser on another device to complete authentication. GhostCode poses as one such device, gets Microsoft's OAuth to generate a device code and then convinces the victim to enter it on Microsoft's authentication page. The victim then signs in and completes multifactor authentication as normal -- but the authentication is for the attacker-controlled device, allowing them to obtain the resulting authentication tokens. These tokens are then used to register attacker-controlled devices, obtain additional credentials and establish persistence in the victim's Microsoft environment. In the campaign observed by eSentire, the attack involved a social-engineering setup where attackers pose as procurement officers through a web contact form before moving conversations to an NDA-themed HTML file. Opening the file took the victim to the device-code phishing page. Stolen tokens allow persistence GhostCode's post-authentication activity is focused on turning the stolen access into persistence inside the Microsoft environment. Once access was granted, eSentire recorded nine successful API calls over a 78-second period, involving Microsoft Intune Enrollment, the Device Registration Service, Azure Active Directory and Microsoft Graph. Three devices were registered during that time, at 28, 53 and 77 seconds after auth