Device code phishing has emerged as a recurring vector for account takeover, where attackers persuade targets to approve a sign-in on a legitimate site by entering a code (Microsoft). This authorization can grant access to email, files, and other cloud services depending on account permissions. Microsoft worked with industry partners and law enforcement to disrupt the EvilTokens campaign in September 2026. Following such campaigns, Microsoft investigated what could happen if attackers directed this trick toward an AI agent rather than a traditional mailbox.

To explore this scenario, Microsoft used GitHub Copilot CLI as an illustrative example in a controlled lab simulation. The OAuth device flow is supported by many command-line tools to allow sign-in without a full browser. In this flow, a client requests a short code, the user enters it on a verification page, and the client receives access upon approval. Attackers can initiate this request and trick someone else into approving it.

Microsoft emphasized that the phishing technique is not specific to GitHub or Copilot CLI, as any public client supporting the device flow can be abused similarly. During the controlled simulation, a victim test account approved a device-code request initiated by an attacker-controlled client. This setup allowed researchers to analyze four potential outcomes of the compromised authorization.

The first outcome allowed attackers to remotely steer an active Copilot CLI session, provided remote control was enabled and permitted by organization policy, and run commands on the user machine subject to local permissions. The second outcome involved adding misleading entries to the agent memory that could influence subsequent interactions. The third outcome enabled reading Copilot CLI sessions synchronized to the cloud.

The fourth outcome provided access to private repositories available to the affected account. Microsoft noted these are proof-of-concept results showing how existing features working as designed could be abused following a phished authorization. The company stated these specific attacks have not been observed in the wild. Each of these outcomes depends on account permissions and specific enabled features.

Microsoft has previously reported device code phishing in campaigns such as EvilTokens and Storm-2372, an AI-enabled campaign in 2026. These cases motivated the examination of coding agents capable of working with repositories and exposing active sessions to remote interaction. Microsoft Defender assists in detecting these attacks by linking phishing attempts with GitHub authentication activity. Organizations can use these detection capabilities to disrupt suspicious access and protect affected identities.