Microsoft has a warning for developers who live in the terminal: the phishing trick that used to steal email access can now take over your AI coding agent. In lab research published on November 17, Microsoft Security Research showed how device-code phishing aimed at GitHub Copilot CLI can turn a single approved sign-in into control of a running agent session, its memory and the private repositories behind it.

The technique abuses the OAuth device flow, the sign-in method built for devices that cannot show a full login page. An attacker starts a sign-in on their own client, then sends the victim the code together with the genuine GitHub verification link, dressed up as an IT check or a licence renewal. The victim types the code into the real GitHub page and approves it — and that approval is the whole attack. No password is stolen and nothing about the login page is fake.

One code, four ways in

Microsoft researchers Uri Oren and Dor Edry tested what a phished approval actually unlocks, and the answer depends on the account's settings. If remote control is enabled and the organisation's policy allows it, an authorised client can interact with that session directly. If Copilot Memory is on, the attacker can plant misleading entries in the agent's memory, shaping what it does next. Cloud session storage lets them read earlier synced sessions, and the requested scopes — repo, read:user, read:org, gist and codespace — open the door to private repositories.

The Copilot CLI client ID is public, not a secret, so there is nothing to steal in order to start the flow. The researchers stress that this is not a flaw in GitHub or Copilot CLI: the features work exactly as designed once a user has approved the request, which is why no patch applies. The danger is that the same familiar trick now reaches a very different target — a running agent with access to code, context and memory, rather than just an inbox.

Lab results, not live attacks

Microsoft is explicit about the limits. The outcomes come from a controlled proof-of-concept simulation, and the company says it has not observed these attacks in the wild. Every outcome still requires the victim to approve the request, and each one depends on settings such as remote control, Copilot Memory and cloud session storage.

But the underlying phishing method is already well established. Microsoft previously tracked device-code phishing in AI-enabled campaigns and Storm-2372 intrusions, and the EvilTokens service, which abused the same flow to reach mailboxes and cloud accounts, was disrupted with law enforcement partners in September 2026. The November research asks what changes when the target is an AI agent rather than a mailbox — and the answer is that the attacker gains far more than email.

What developers should do

Microsoft has built two Defender XDR detections for suspected Copilot CLI device-code phishing, covering delivery by email and by Microsoft Teams. The core advice is simple: approve a device code only if you started that sign-in yourself. A legitimate verification page is part of the story, not evidence that the request is safe — the GitHub page the victim sees is the real one.

Developers should also review which Copilot CLI features are enabled on their accounts: remote control, Copilot Memory and cloud session storage are all useful, but each one widens what a single approved code can reach. Any tool that signs in through the OAuth device flow is exposed in the same way — one careless approval can hand an attacker the keys to the codebase.