News Security news
Microsoft: device code phishing can hand attackers control of AI coding agents like GitHub Copilot CLI
Microsoft Security Research published a lab study on 17 November 2026 showing that if a developer approves a GitHub device code started by an attacker, the attacker can reach private repositories, read synced Copilot CLI sessions, plant false memories and, where remote control is allowed, steer a live agent session. This is phishing that abuses features working as designed, not a software flaw.
Key points
- Microsoft showed in a lab that one approved GitHub device code is enough for an attacker to reach private repositories and synced Copilot CLI sessions with the victim's permissions.
- If remote control of sessions is enabled, the attacker can also steer a running agent session; Copilot Memory can be poisoned with misleading entries.
- It is not a GitHub vulnerability: the victim enters the code on the genuine github.com, and the page does not show who started the request.
- Defence: never enter codes you did not request, review authorised OAuth apps and use the least permissive "Store local sessions in the Cloud" setting.
On 17 November 2026 researchers Uri Oren and Dor Edry from Microsoft Security Research published a study on what happens when device code phishing meets an AI coding agent. They used GitHub Copilot CLI as the example, but the technique works against any client that signs in with the OAuth device flow.
In our SOC experience, device code phishing is hard to spot precisely because nothing about it looks fake: the victim types a code on the real github.com. The new part is the payoff. An agent that can run commands on a developer's machine is a far more valuable target than a mailbox.
How the attack works
The device flow lets command-line tools sign in without a full browser. The tool shows an eight-character code and the user enters it at github.com/login/device. By default the code is valid for 15 minutes, according to GitHub's documentation.
Microsoft points out two weak spots: the legitimate page does not tell the user who started the request, and the application name alone cannot distinguish an attacker's client from the one the user expects. In the lab the request asked for the repo, read:user, read:org, gist and codespace scopes. The scopes are chosen by the client, so actual access depends on them and on what the account can do.
What the attacker can do
Once approved, the researchers tested four outcomes. Each depends on which features are enabled:
- Steering a live session – if remote control is enabled for the session and the organisation's policy allows it, the attacker can direct the agent and have it run commands on the victim's machine, still subject to approval prompts and local OS permissions.
- Memory poisoning – misleading entries added through the
/memorycommand can influence later answers if Copilot Memory is in use. - Reading synced sessions – where cloud session storage is on, the attacker can read synced Copilot CLI sessions, including older ones.
- Repository access – private repositories the account can see, within the requested scopes.
Microsoft says it has not seen these four outcomes in the wild. Device code phishing itself is a known technique, though: the post cites the Storm-2372 campaign (2025), an AI-assisted campaign in April 2026 and EvilTokens, which Microsoft says it helped disrupt with partners and law enforcement in September 2026. The researchers map the simulation to MITRE ATT&CK T1566.002 (spearphishing link) and T1528 (steal application access token).
How to tell if you were targeted
The post contains no indicators of compromise. Microsoft Defender XDR has two new detections, Suspected GitHub Copilot CLI device code phishing via email and …via Microsoft Teams, which correlate a suspicious message and click with the creation of a GitHub OAuth token. They need the GitHub Enterprise Cloud connector in Defender for Cloud Apps. For Enterprise Managed Users, the affected account can be suspended through the identity provider.
Without Defender, check by hand: unknown apps under authorised OAuth apps, unexpected Copilot CLI sessions and Copilot Memory entries nobody remembers adding.
What to do
- Users: enter a device code only for a sign-in you started yourself, in your own terminal, a moment ago. Treat any "verify" or "Copilot activation" request from someone else as phishing, even if the link points to github.com.
- Review OAuth apps: on GitHub open Settings → Applications → Authorized OAuth Apps and revoke anything you do not recognise.
- Admins: for organisation-provided seats, review the Store local sessions in the Cloud policy (it governs session storage and remote control) and pick the least permissive option that fits your workflow. Limit repository access with organisation roles.
- Incident response: turning Copilot Memory off does not delete existing entries – review and remove them.
- Microsoft 365: enable Safe Links in Defender for Office 365 for email and check its coverage in Teams. Microsoft stresses that it does not replace user vigilance.
If the lure arrives in a Teams chat from "IT support", our guide on fake IT help desk calls in Teams covers what to do next.
FAQ
Is this a vulnerability in GitHub Copilot CLI?
No. Microsoft describes a phishing technique that abuses the OAuth device flow as designed. The victim has to approve the request on the genuine GitHub page. Any tool that uses the device flow could be used the same way.
How do I recognise a device code phishing attempt?
Someone sends you a short code such as WDJB-MJHT and asks you to enter it at github.com/login/device, often posing as IT support or a licence check. If you did not start the sign-in yourself in your own terminal a moment ago, do not enter the code.
I entered a code someone sent me. What now?
Go to GitHub Settings, Applications, Authorized OAuth Apps and revoke the app, then tell your security team. Check recent activity on your repositories, your Copilot CLI sessions and any saved Copilot Memory entries.
Sources
Spotted a mistake? Let us know and we will correct it openly.