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.

Kyberkit editorial team · · event date · reading time 4 minutes · For admins and analysts

News: Device code phishing can hijack AI coding agents

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.

Five steps of device code phishing against an AI coding agent1. Attacker starts a device code sign-in with a public client; 2. Sends the victim the code and the genuine GitHub link under an IT or licence pretext; 3. Victim enters the code on github.com and approves it; 4. Attacker's client receives a token with the requested scopes; 5. Attacker works with the victim's repositories and Copilot CLI sessions1Attacker starts a device code sign-inwith a public client2Sends the victim the code and thegenuine GitHub link under an IT orlicence pretext3Victim enters the code on github.comand approves it4Attacker's client receives a tokenwith the requested scopes5Attacker works with the victim'srepositories and Copilot CLI sessions
Device code phishing step by step (based on Microsoft's lab simulation)

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:

  1. 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.
  2. Memory poisoning – misleading entries added through the /memory command can influence later answers if Copilot Memory is in use.
  3. Reading synced sessions – where cloud session storage is on, the attacker can read synced Copilot CLI sessions, including older ones.
  4. 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

  1. 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.
  2. Review OAuth apps: on GitHub open Settings → Applications → Authorized OAuth Apps and revoke anything you do not recognise.
  3. 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.
  4. Incident response: turning Copilot Memory off does not delete existing entries – review and remove them.
  5. 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

  1. Microsoft Security Blog - The risks of device code authentication for AI coding agents (17 Nov 2026)
  2. GitHub Docs - Authorizing OAuth apps (device flow)
  3. GitHub Docs - Reviewing your authorized OAuth apps

Spotted a mistake? Let us know and we will correct it openly.