Have a project in mind? Let's talk.

Device code phishing has a new target. Microsoft Security Research published an analysis on November 17 examining what happens when the technique, already a recurring route to account takeover, is aimed at an AI coding agent instead of a mailbox. Using GitHub Copilot CLI as an illustrative example in a controlled lab, the team showed that a single phished device code approval could open four distinct paths: steering an active agent session remotely, planting misleading entries in the agent's memory, reading cloud-synced session history, and reaching the victim's private repositories. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
These are proof-of-concept results from a lab simulation, not attacks observed in the wild. Each outcome also required the victim to approve a device code request the attacker initiated, plus specific account permissions and enabled features. The qualifier matters, and so does the direction: as coding agents accumulate access to repositories, session history, and local tools, the value of one phished approval keeps rising. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
The OAuth device flow exists for clients that cannot show a browser. GitHub's documentation describes it as the authorization path for headless applications such as CLI tools and the Git Credential Manager: the app requests device and user verification codes, the user enters the user code at github.com/login/device, and the app polls an access token endpoint until the user authorizes or the codes expire. The user code is valid for 15 minutes, and GitHub rate-limits code submissions to 50 per hour per application. Source: Authorizing OAuth apps, GitHub Docs
The design trades a login screen for a shared secret typed into a trusted page. That trade is exactly what makes it phishable: whoever asks the user to enter the code controls which client gets authorized, and the page doing the asking is the real one. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
Microsoft notes the phishing technique is not specific to GitHub or Copilot CLI. Any public client that supports the device flow can be abused the same way, and the attacker chooses the requested scopes when starting the flow. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
The simulated attack chain has five steps, and only one of them involves the victim doing anything. The attacker starts a device code sign-in request with the client of their choice, sends the short code and the genuine verification link under a pretext such as an IT request or a license check, and waits. The victim opens the real GitHub page, signs in if needed, and approves. The attacker's client then completes the sign-in automatically and operates within the granted scopes. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
The uncomfortable detail is that nothing on screen looks wrong. The user is on the genuine site, not a lookalike, and the authorization appears under a legitimate application name. A familiar domain cannot tell the user whether the request was theirs. Device code phishing against accounts has appeared in campaigns Microsoft tracks as Storm-2372 and EvilTokens, the latter disrupted with industry partners and law enforcement in September 2026, so the lure mechanics are already proven at scale against other targets. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
In the lab, a test account approved a device code request from an attacker-controlled client. From that single approval, the researchers analyzed four outcomes, each bounded by the account's permissions and enabled features. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
First, steering a live session. Copilot CLI supports remote control of an active interactive session when the user has enabled it and organization policy allows it. The attacker-controlled client used the phished authorization to interact with such a session and have the agent run a command on the test machine, subject to the session's approval prompts and local OS permissions. Microsoft is explicit that this is misuse of an authorized capability working as designed, not unauthenticated remote code execution, and it does not apply when remote control is disabled, the session is not running, or the machine is offline. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
Second, memory poisoning. Copilot Memory can retain repository facts and user preferences, and in the simulation the researchers added misleading entries through the agent's /memory command. If later interactions use those entries, the effect outlasts the initial sign-in. One operational note from the mitigation guidance: disabling memory does not automatically delete entries already stored, so saved content needs review during incident response. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
Third, session history. Where cloud session storage is enabled, the researchers could read the test account's synced CLI sessions, including sessions from before the simulation, with the code snippets, file paths, and architecture discussions they contain. For Copilot Business and Enterprise, availability depends on the organization's session-storage policy, and syncing a session does not itself enable remote control. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
Fourth, repositories. The authorization included the repo scope along with read:user, read:org, gist, and codespace, giving access to private repositories available to the test account. The exposure reflects the scopes the requesting client chose and the account's own access, not a property of the CLI itself. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
On the detection side, Microsoft developed two Defender XDR detections for suspected Copilot CLI device code phishing, one for email delivery and one for Microsoft Teams. They correlate suspicious messages and clicks with subsequent GitHub OAuth token creation and regeneration events, connecting events that each look unremarkable alone. With the GitHub Enterprise Cloud connector enabled in Microsoft Defender for Cloud Apps, organizations get the GitHub activity visibility these correlations need. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
The team also built a disruption action for GitHub Enterprise Managed Users that suspends the affected managed identity through the organization's identity provider, interrupting the attacker's access. They validated it in their research environment, and note that detection and disruption availability depend on configuration, telemetry, identity integration, and deployment prerequisites. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
Microsoft's guidance starts with a rule worth repeating verbatim in every engineering onboarding: enter a device code only for a sign-in you initiated yourself. An unexpected request to verify GitHub or activate Copilot should be treated as a phishing attempt even when the page is hosted on github.com, and GitHub's own verification page warns users never to use a code sent by someone else. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
On the administrative side: configure Safe Links policies for email and Teams, review Copilot CLI session settings and choose the least permissive session-storage policy that supports your workflows, review authorized OAuth applications and revoke unexpected ones, limit repository access through organization roles, and review Copilot Memory contents during incident response rather than assuming a toggle clears them. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
GitHub's token documentation adds a quieter hardening option: OAuth apps can be configured to issue expiring access tokens, with the access token expiring after eight hours and the refresh token after six months without use, shrinking the window a phished token stays useful. Source: Authorizing OAuth apps, GitHub Docs
Our assessment is that this research lands on a gap most teams have not closed. Phishing awareness training still centers on email and passwords, while the device flow moves the decision to a verification page that looks safe precisely because it is real. The practical shift is to treat agent CLI sign-ins the way finance teams treat wire transfer confirmations: an out-of-band check that the request was self-initiated, every time, no exceptions for IT-flavored pretexts. This connects to controls we have covered before: the AI agent security checklist covers the review cadence for agent permissions, and MCP OAuth security examines the same scope-choice problem on the protocol side.
Device code phishing abuses the OAuth device flow, the sign-in method built for CLI tools and other browserless clients. An attacker starts a device code request and persuades the victim to enter the code on the genuine verification page. The attacker-controlled client then receives an authorized token without ever seeing the victim's password. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
No. Microsoft used Copilot CLI as an illustrative example and states the technique applies to any public client that supports the device flow. The attacker chooses the client and the requested scopes when starting the flow. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
No. The four outcomes, session steering, memory poisoning, synced-session reading, and repository access, are proof-of-concept results from a controlled lab simulation. Microsoft says it has not observed them in campaigns or in the wild, though device code phishing itself is an active technique in tracked campaigns. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
Microsoft developed Defender XDR detections for suspected Copilot CLI device code phishing via email and via Teams, correlating suspicious messages and clicks with GitHub OAuth token creation events. The GitHub Enterprise Cloud connector in Defender for Cloud Apps supplies the GitHub activity visibility, and a disruption action for Enterprise Managed Users can suspend an affected managed identity. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
User behavior: enter a device code only for a sign-in you initiated yourself, and treat any unsolicited code request as phishing even on the genuine github.com page. Administratively, reviewing and revoking unexpected OAuth authorizations and tightening session-storage policies follow close behind. Source: The risks of device code authentication for AI coding agents, Microsoft Security Blog
Ready to take the first step towards unlocking opportunities, realizing goals, and embracing innovation? We're here and eager to connect.