Microsoft: device code phishing can hijack AI coding agents like GitHub Copilot CLI

Microsoft Security researchers demonstrated how device code phishing, a known account takeover technique, can be extended to compromise AI coding agents such as GitHub Copilot CLI, potentially allowing attackers to control active sessions and access private repositories.

Christopher Ort
By Christopher Ort · 5 min read
Share
A developer working at a computer terminal in a dimly lit office, unaware of a phishing attempt targeting their coding environment
Image: AI-generated, i10X
On this page
  1. Quick Take
  2. In plain English
  3. What happened
  4. Background on device code phishing
  5. Why this matters
  6. Detection and mitigation
  7. Technical details
  8. Sources

Microsoft Security researchers have published lab findings showing how device code phishing, a social engineering technique previously used to steal email and cloud access, can be adapted to target AI coding agents.

i10X Quick Take

Quick Take

  1. What: Device code phishing technique demonstrated against AI coding agents using GitHub Copilot CLI as an example in controlled lab simulation.
  2. Who is affected: Users of command-line AI tools that support OAuth device flow authentication, including GitHub Copilot CLI and similar agents.
  3. Attack method: Attacker initiates device code request, tricks user into approving it on legitimate site, then gains access to agent capabilities and repositories.
  4. Potential impact: Remote session control, memory manipulation, access to synchronized sessions, and private repository access depending on permissions and enabled features.
  5. What to do: Enter a device code only for a sign-in you started yourself, review and revoke unexpected GitHub OAuth authorizations, and restrict Copilot CLI session and memory settings to what your team needs.

In plain English

Device code phishing is a trick where an attacker starts a sign-in request and then convinces you to approve it by entering a short code on a real website. Microsoft researchers showed this technique can work against AI coding assistants like GitHub Copilot CLI.

What you should do: If you approve the attacker’s request (thinking it is legitimate), they could potentially control your coding agent remotely, read your code sessions, or access your private code repositories. This is lab research showing what is possible, not an attack Microsoft has seen happening in the real world yet. If you use AI coding tools, be suspicious of unexpected requests to approve device codes, even if the website looks legitimate.

What happened

Microsoft Security researchers Uri Oren and Dor Edry conducted controlled laboratory simulations to explore how device code phishing could be extended beyond traditional targets like email and cloud storage to AI coding agents. The research used GitHub Copilot CLI as an illustrative example, though the researchers emphasized the technique applies to any public client supporting OAuth device flow authentication.

In the simulation, researchers demonstrated a multi-step attack:

  1. The attacker initiates a device code sign-in request using a legitimate client identifier
  2. The attacker sends the resulting short code and GitHub verification link to a target user, potentially disguised as an IT request or license check
  3. The victim approves the request on GitHub’s legitimate verification page
  4. The attacker-controlled client automatically completes sign-in after approval
  5. The attacker gains access within the permissions granted to the application

The research identified four potential outcomes following a successful phishing attempt, each dependent on specific configurations and permissions:

Remote session control: If the user enabled remote control and organization policy permits it, an attacker could steer an active Copilot CLI session remotely and potentially execute commands on the user’s machine, subject to local permissions and approval settings.

Memory manipulation: Attackers could add misleading entries to the agent’s memory that might influence future interactions.

Session access: Copilot CLI sessions synchronized to the cloud could be read by the attacker.

Repository access: Private repositories available to the compromised account could be accessed.

The researchers emphasized these are proof-of-concept results showing how existing features, working as designed, could be abused after a phished authorization. Microsoft stated they have not observed these specific attack outcomes in the wild.

Background on device code phishing

The OAuth device flow was designed to help command-line tools and other clients sign in without displaying a full browser. A client requests a short code, the user enters it on the service’s verification page, and the requesting client receives access after approval.

In device code phishing attacks, the attacker initiates the request and uses social engineering to persuade someone else to approve it. Microsoft has previously reported device code phishing in several campaigns, including Storm-2372 (an AI-enabled campaign in 2026) and EvilTokens. Microsoft worked with industry partners and law enforcement to disrupt the EvilTokens campaign in September 2026.

The current research was motivated by these earlier campaigns and aimed to examine what happens when the same technique targets coding agents rather than traditional cloud services.

Why this matters

The research highlights a concerning evolution in social engineering attacks. While device code phishing previously targeted email, files, and cloud services, AI coding agents present new attack surfaces with potentially greater impact.

Depending on settings and permissions, a phished approval for an AI coding agent can let an attacker:

  • Run commands on a developer machine, if remote control is enabled for an active session and local approval settings allow it
  • Reach the private repositories the account can access, which can include application code and infrastructure definitions
  • Influence later work through misleading entries in the agent memory
  • Expose earlier work context stored in cloud-synced sessions, such as code snippets, file paths and architecture discussions

The attack is particularly insidious because victims interact with legitimate websites during the approval process. The GitHub verification page is genuinely hosted by GitHub, and the familiar domain cannot tell users whether they initiated the request. Authorization requests also appear under legitimate application names, making it difficult to distinguish attacker-controlled clients from expected sign-ins.

The researchers noted that the Copilot CLI client identifier used in the simulation is public and not a client secret, meaning any attacker can initiate requests using it.

Detection and mitigation

Microsoft says it built two Defender XDR detections for suspected GitHub Copilot CLI device code phishing, one for lures sent by email and one for lures sent through Microsoft Teams. They correlate suspicious messages and clicks with later GitHub OAuth token creation and regeneration events. For GitHub Enterprise Managed Users, Microsoft also developed a disruption action that suspends the affected managed identity through the identity provider.

The guidance for teams: approve device codes only for sign-ins you started, even on github.com; review authorized OAuth apps in GitHub settings and revoke unexpected ones; choose the least permissive setting for the GitHub policy that controls whether Copilot CLI sessions are stored in the cloud and can be remotely controlled; review saved Copilot Memory entries, since disabling memory does not delete existing entries; and limit repository access with organization roles. In the lab, the attacker request asked for the repo, read:user, read:org, gist and codespace scopes.

The research emphasizes that each outcome depends on the victim user approving a device code request initiated by the attacker, as well as specific account permissions and enabled features.

Technical details

The initial attack begins with an HTTP request to GitHub’s device authorization endpoint. The request includes the Copilot CLI client identifier and requested scopes. GitHub returns a short code that the attacker then sends to the target user.

Once approved, the requesting client completes sign-in automatically without additional manual steps. The attacker can then operate within the permissions granted to the application and access resources available to the compromised account.

The research was published on November 17, 2026, on the Microsoft Security Blog by Uri Oren, Dor Edry, and the Microsoft Security Research team.

This is the second Microsoft research warning about coding agents in recent weeks, after its note on post-training supply chain attacks on coding agents. Copilot also had a command injection flaw in its JetBrains plugin. New cases are tracked in our AI Security hub.

Sources

  • Microsoft Security Blog: The risks of device code authentication for AI coding agents (Uri Oren, Dor Edry, Microsoft Security Research, November 17, 2026)
Christopher Ort

Christopher Ort

Christopher Ort handles SEO, AI agent workflows and PR & partnerships at i10x.ai, the all-in-one AI workspace built by i10X Global Pte. Ltd. in Singapore. He is a graduate of Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU). He is the author of “The Style Penalty”, a study published on SSRN that analyses 1,576 evaluation decisions by four frontier AI models to show how AI-written CVs fare in automated hiring screens; the research has been covered by heise online and t3n.

Editor's picks

  1. Microsoft: device code phishing can hijack AI coding agents like GitHub Copilot CLI
  2. Trinity College Philosophy Department Bans AI Use in All Courses, for Any Purpose
  3. Hour of AI 2026: CodeAI, Formerly Code.org, Launches 250 Free AI Activities for Students
  4. Qatar Launches a National AI Tutor for Schools and an AI Academic Adviser With Scale AI
  5. Novo Rebuilds Small Business Banking Around AI as Its Customers’ AI Tool Spending Jumps 493%