Device-code phishing can hijack GitHub Copilot CLI sessions
Microsoft researchers say one approved sign-in code let them steer a coding agent, poison its memory and reach private repositories in a lab test.
By The Agentic Times ·

Microsoft published research on 17 November 2026 showing that a single phished device-code approval against GitHub Copilot CLI could hand an attacker control over a developer's active coding session. The work was carried out as a controlled lab simulation using a victim test account, and Microsoft says the four outcomes it describes have not been observed in real-world attacks.
The technique is device code phishing, an established route to account takeover. Instead of stealing a password, the attacker starts an OAuth device flow sign-in, receives a short code from the service, and persuades the target to enter that code on the service's own verification page. Microsoft notes that the page is genuinely hosted by GitHub, so the familiar domain gives the user no clue about who initiated the request. The authorisation also appears under a legitimate application name, which Microsoft says cannot by itself distinguish an attacker-controlled client from an expected sign-in.
According to Microsoft, its interest in coding agents grew out of earlier campaigns. The company says it has reported device code phishing against accounts in several campaigns, including Storm-2372 and an AI-enabled campaign in 2026 called EvilTokens, which Microsoft says it worked to disrupt with industry and law enforcement partners in September 2026. That prompted the question of what an attacker could do if the same trick targeted an AI agent rather than a mailbox.
Microsoft used GitHub Copilot CLI as an illustrative example because, depending on its configuration, it can work with code, run commands on a user's machine, keep context across sessions, and allow an active session to be steered remotely. The researchers stress the phishing method is not specific to GitHub or Copilot: any public client supporting the device flow could be abused the same way, and the attacker chooses which permission scopes to request when starting the flow.
After the test account approved the request, Microsoft says it analysed four possible outcomes. The first was steering an active Copilot CLI session remotely, if the user had enabled remote control and organisation policy allowed it, and, subject to local permissions and approval settings, having the agent run commands on the user's machine. The second was adding misleading entries to the agent's memory that could influence later interactions. The third was reading Copilot CLI sessions that had been synchronised to the cloud. The fourth was access to private repositories available to the affected account.
Microsoft describes all four as proof-of-concept results showing how existing features, working as designed, could be abused after a phished authorisation. The company says each outcome depends on the account's permissions, enabled features, memory settings and whether an active session can be controlled remotely, and that none of them have been seen in the campaigns it has tracked or in the wild.
The attack chain Microsoft sets out has five steps: the attacker initiates a device-code sign-in request; sends the short code and GitHub verification link to the user, for example under the pretext of an IT request or a Copilot licence check; the user approves it; the attacker-controlled client then completes sign-in automatically with no further manual step; and the attacker operates within the granted permissions.
Microsoft says Microsoft Defender can help detect these attacks by connecting phishing attempts with GitHub authentication activity, and that organisations can disrupt suspicious access to protect affected identities. The company notes the Copilot CLI client identifier used in the demonstration is public and is not a client secret.
Sources
- microsoft.comhttps://microsoft.com/en-us/security/blog/2026/11/17/the-risks-of-device-code-authentication-for-ai-coding-agents
