Threat Intelligence

Device code phishing meets AI coding agents: Microsoft's lab test shows what a single approval can expose

Microsoft Security · 18 Nov 2026
Key Takeaway Train developers to approve a device code only when they started the sign-in themselves, and review which agent features such as remote control, memory and session sync are enabled in your organisation.

Device code phishing is a recurring route to account takeover. Rather than stealing a password, the attacker starts a sign-in request and persuades a victim to approve it by entering a short code on a legitimate site. Microsoft has reported the technique in campaigns including Storm-2372 and EvilTokens. Its researchers then asked what happens when the same trick targets an AI coding agent instead of a mailbox.

Using GitHub Copilot CLI as an example, the team ran a controlled lab simulation. A test account approved a device code request started by an attacker-controlled client. Because the user signs in on the real GitHub site, a familiar domain cannot show whether the request was theirs, and the approval appears under a legitimate application name. The attacker also chooses the requested scopes. Microsoft stresses that any public client supporting the device flow could be abused this way, and that these are proof-of-concept results, not attacks seen in the wild.

The researchers analysed four outcomes, each depending on account permissions and enabled features. First, if remote control was enabled for an active session and policy allowed it, the attacker could steer the session and have the agent run a command on the machine, subject to approval prompts and local permissions. Second, misleading entries could be added to Copilot Memory, so effects might outlast the sign-in. Third, where cloud session storage was enabled, synced sessions could be read, including earlier ones containing code snippets, file paths and architecture discussions. Fourth, the requested scopes (repo, read:user, read:org, gist and codespace) gave access to private repositories.

Microsoft notes this is not unauthenticated remote code execution. It is the misuse of features working as designed after a phished authorization. The post goes on to describe how Microsoft Defender links phishing attempts with GitHub authentication activity.

Why it matters

Any business whose developers use CLI-based AI agents is exposed, because a single approval on a real GitHub page bypasses the usual cue of spotting a fake domain. The assumption that a sign-in is safe because it happens on a trusted site breaks down, and agent features like remote control, memory and session sync widen what a stolen authorization can reach. It forces a decision about which of those features to allow and how tightly to limit repository access for each account.

What to do

  • Review whether Copilot CLI remote control is enabled in organisation policy and disable it where it is not needed.
  • Check your Copilot session-storage and memory policies to limit what a hijacked authorization could read or alter.
  • Audit GitHub authorizations for unexpected device flow sign-ins and the scopes granted, such as repo, codespace and read:org.
  • Tell staff to approve a device code only when they started the sign-in themselves.
device code phishing GitHub Copilot CLI AI agents OAuth account takeover
Running AI agents? Eight controls for securing them, mapped to the ISM ->

Summarised by CISO AI from Microsoft Security, written with Claude Sonnet 5.5. We link back to every original so you can read it yourself.