No Fake Login Page, No Stolen Password: How the MadApe Kit Hijacks Microsoft 365 Accounts Through Device Codes, Stage by Stage
Group-IB has documented MadApe, a phishing kit that tricks people into approving an attacker’s sign-in on Microsoft’s real device login page, handing over tokens that can satisfy MFA. Here is each stage of the attack and the defensive layer that breaks it.
Here Is How Layered Defenses Stop a Real Microsoft Sign-In Page From Working Against You
Most phishing training teaches people to check the address bar. MadApe is built to pass that test. The kit, which Group-IB’s threat intelligence team documented and Help Net Security reported on, never shows a fake password page. Instead, it abuses Microsoft’s Device Code sign-in flow, a feature designed for devices without a keyboard, such as conference room systems and command-line tools. The victim signs in on Microsoft’s real site and, without realizing it, approves a session for the attacker.
Stage 1: A business document arrives
The attack starts with an email carrying a PDF that looks like a business document, usually about payments, invoices, contracts or account statements, and often disguised as a SharePoint sharing notice. Some emails carry the target organization’s own branding, signatures or forwarded content. Group-IB found lures in at least nine languages.
Layer: Email filtering that opens attachments and follows the links inside them in an isolated sandbox, plus training that treats unexpected “shared document” notices as suspicious until checked.
Stage 2: A gate that keeps scanners out
The PDF’s link leads to an intermediate page, either a SharePoint-style document access page that redirects after a click, or a human verification challenge chosen at random from a custom CAPTCHA, text entry, image selection or press-and-hold button. These steps are there to stop automated security scanners from reaching the phishing page. Templates also imitate OneDrive, Teams, Adobe Acrobat, DocuSign and Microsoft sign-in, including a German-language Teams voicemail lure.
Layer: DNS and web filtering that blocks newly registered domains. Group-IB found most of the campaign’s domains were registered between mid-June and late August 2026.
Stage 3: The victim is handed a real Microsoft code
The page shows a device code that the kit has just requested from Microsoft. Clicking it copies the code to the clipboard, and an “Open File” button sends the victim to microsoft.com/devicelogin to paste it and sign in. Because the sign-in happens on a genuine Microsoft domain, it looks far more trustworthy than a typical phishing page.
Layer: A Conditional Access policy that blocks the Device Code authentication flow for everyone who does not need it. Group-IB recommends blocking the flow wherever it is not needed, after first checking the impact in report-only mode.
Stage 4: Tokens flow to the attacker
While the victim signs in, the kit’s backend keeps polling Microsoft’s token endpoint. If the sign-in completes and access controls permit it, the attacker receives an access token and, where supported, a refresh token, opening a path to the mailbox and files. Group-IB warns that a successful sign-in of this kind may also satisfy MFA requirements.
Layer: Policies that require a compliant, managed device for access to company data, risk-based sign-in rules, sensible sign-in frequency limits and Continuous Access Evaluation, so a token issued outside your normal patterns is harder to use and quicker to cut off.
Stage 5: Quiet follow-on activity
With tokens in hand, an attacker can read mail, download files and use the account to phish others. Group-IB advises watching for device code sign-ins outside documented business use and connecting them to warning signs such as new device registrations, new inbox rules or forwarding, new app consent grants, bulk SharePoint or OneDrive downloads and outbound phishing.
Layer: Centralized sign-in and audit log monitoring with alerts on these patterns, reviewed by someone every day.
Stage 6: Containment
If a user did enter a code from an untrusted site, Group-IB recommends revoking sessions and refresh tokens, temporarily blocking sign-in if needed, and removing unauthorized device registrations, app grants, inbox rules and forwarding. It also cautions that revoking sessions may not invalidate every access token immediately.
Layer: A written incident playbook for token theft, rehearsed before it is needed, plus a quick, no-blame way for staff to report “I entered a code and now I am not sure.”
The campaign at a glance
Group-IB mapped 155 root domains, with the kit deployed on 97 of them. One registrar handled 86.4% of the registrations it analyzed, and 69% of domains shared their creation time, to the second, with at least one other domain. The operator panel appeared on at least five domains, the earliest on August 19, 2026. Nine legitimate websites hosting redirect pages were likely compromised. Group-IB has not attributed the campaign to a known group and has published YARA rules and indicators of compromise.
Products as examples, not requirements
In a Microsoft 365 tenant, Entra ID Conditional Access (the Authentication flows condition), Continuous Access Evaluation, Intune device compliance and Defender for Office 365 attachment and link detonation cover most of these layers. Other identity, email security and monitoring platforms offer equivalent controls. What matters is that device code sign-in is limited to the people and devices that genuinely need it, and that token use is monitored.
What this means for your company
Most small and mid-size businesses have never used device code sign-in on purpose, which makes this one of the easiest attacks to shut down. Check your sign-in logs for any legitimate device code use, such as meeting room equipment or admin scripts. Write those exceptions down, then block the flow for everyone else. Update staff training too. The message is no longer just “check the web address.” It is “never enter a code someone else gave you to open a document, even on a real Microsoft page.”
If you would like help reviewing your Conditional Access policies, blocking device code phishing or setting up sign-in monitoring for Microsoft 365, we can help. Reach out to Layer 7 Data Solutions to discuss how we’ve helped companies similar to yours.
