Imagine this: You fought hard internally for the budget and resources and now you've finally got everyone on MFA.
Your executive team is now sleeping soundly at night thinking phishing is yesterday’s news, finally we're safe! Well... sorry, but us nefarious evil wrong doer's aren’t even bothering with fake login pages anymore, we just don't need to.
We can just use Microsoft to help us, using their own device login process, tricking people into giving away access tokens on a silver platter—and yes, it works even if you’re the most “security-aware” in the room.
As multi-factor authentication (MFA) adoption has increased and legacy phishing techniques lose effectiveness, we attackers needed to evolve. Leading us to some more sophisticated abuse of OAuth2 “device code” flows to harvest access tokens and compromise cloud accounts. This method is particularly insidious because it leverages legitimate Microsoft authentication screens, often bypassing user suspicion and many technical controls.
Let’s break it down in some high-level terms: Ever connected a smart TV or printer that asks you to go to https://microsoft.com/devicelogin and enter a code? That’s the device code flow. It’s meant for gadgets too dumb for full logins. But... like any good work around, Mr Robot realised, “Hey, what if people are too trusting, too?”
How it’s supposed to work:
How attackers use it:
Why should you care? Because the whole thing happens on Microsoft’s real login screen, and MFA is just another checkmark on the way to being owned.
Why we as red teamers love it (and why you should worry):
Step-by-step in a bit more detail:
Meet GraphSpy—this is just one of many open source projects out there but a particular favourite of mine.
What makes GraphSpy awesome (for us, terrifying for defenders):
A day in the life of a GraphSpy attack:
Pro tip for defenders: If you see “GraphSpy” in the logs, you’ve already lost. Just kidding (sort of).
Intune is the cloud bouncer for most corporate devices. Get tokens for Intune, and you can:
A typical lure:
“IT noticed unusual activity on your device. To keep access to corporate systems, please go to https://microsoft.com/devicelogin and enter code: AB12CD34. Approve any prompts for ‘Microsoft Intune Device Management.’ Thanks!”
Looks legit. Feels urgent. The real Microsoft site. If you’re busy or distracted, you’re in trouble.
For everyone:
For the blue team and defenders:
Device code flow phishing is like a magic trick—everything looks legit, until you realise your wallet’s missing. Attackers don’t need to fake a thing; they just need you to trust the process. Tools like GraphSpy make it push-button simple for red teams and, unfortunately, real attackers.
The best defence: Relentless skepticism, good log monitoring, and a strong “never trust, always verify” culture. Because sometimes, even the “real” login is the riskiest click of all.
#HackAndTell #Phishing #HoldMyBeer #RedTeam #CloudSecurity #GraphSpy #Microsoft365