CybersecurityAnalysis
Microsoft shows device-code phishing could hand attackers a victim's Copilot CLI session and private repos
Microsoft researchers say a lab simulation showed that tricking a user into approving a GitHub device code could let an attacker steer a Copilot CLI session, poison its memory and read private repositories. They stress it is proof of concept, not an observed attack.
Microsoft security researchers said on November 17 that, in a controlled lab simulation, tricking a user into approving a GitHub sign-in the attacker started could let the attacker steer an AI coding agent's session, plant entries in its memory and read private repositories. In Microsoft's write-up, the authors stress that these are proof-of-concept results using GitHub Copilot CLI and a victim test account, not attacks observed in the wild.
How does device-code phishing work?
The OAuth device flow exists for tools without a browser, such as command-line programs. GitHub's documentation says the app requests a user verification code and a URL, shows the user an eight-character code to enter at github.com/login/device, and polls until the user authorizes, then receives an access token. By default the code must be entered within 15 minutes.
Microsoft's description of the abuse is that the attacker starts that request with a public client, then sends the short code and the genuine GitHub verification link to the victim with a pretext such as an IT request or a Copilot licence check. The victim signs in on the real GitHub site and approves, and the attacker's client completes the sign-in on its own. The attacker never needs the victim's password and chooses the scopes requested. Microsoft says any public client that supports the device flow could be abused this way, not only Copilot CLI.
What could an attacker do in the lab?
Microsoft lists four outcomes it demonstrated, each with limits it states itself:
| Outcome | Condition Microsoft states |
|---|---|
| Remote session steering | Remote control enabled and allowed by organisation policy; commands remain subject to approval prompts and local OS permissions. It is not unauthenticated remote code execution. |
| Memory poisoning | Agent memory features enabled; entries added through the /memory command could influence later interactions. |
| Cloud session access | Cloud session storage enabled; the attacker could read the test account's synced sessions, which may hold code, file paths and architecture discussions. |
| Repository access | Scopes requested included repo, read:user, read:org, gist and codespace, reaching private repositories available to the account. |
Microsoft says it has not seen these four outcomes in earlier device-code campaigns it names: Storm-2372, an April 2026 AI-enabled campaign and EvilTokens.
What does Microsoft say defenders can do?
Microsoft describes two Defender XDR detections for suspected Copilot CLI device-code phishing, one for email delivery and one for Microsoft Teams, which correlate suspicious messages and clicks with GitHub OAuth token events. They require the GitHub Enterprise Cloud connector in Defender for Cloud Apps. A disruption action for GitHub Enterprise Managed Users suspends the affected identity through the identity provider; Microsoft says it validated this in its research environment only, and that availability depends on configuration and telemetry.
Its guidance includes entering a device code only for a sign-in the user started, treating unsolicited "verify" or "activate Copilot" requests as phishing even on github.com, configuring Safe Links, reviewing the "store local sessions in the cloud" policy, revoking unexpected authorised OAuth apps and reviewing Copilot memory entries. Microsoft notes that disabling memory does not delete existing entries.
Why does this matter for AI agents?
The weakness Microsoft describes is not a flaw in a model. It is that an agent signed in as a user inherits everything that sign-in can reach: private source code, session history and, if enabled, memory that shapes later behaviour. That makes the token, not the prompt, the thing to protect, a different failure from prompt injection, where hostile text redirects the agent. Teams that let developers use coding agents with company code can see the scale of what these tools hold in our look at whether Claude Code is safe for sensitive code.
The same week, Google's threat group reported attackers modifying a coding agent's settings file to deliver a backdoor, covered in our story on Google's AI threat report.
What is unresolved?
Microsoft's findings are lab results, and its report says its MITRE ATT&CK mappings describe the simulation, not an attributed campaign. The write-up does not say whether GitHub has changed the device flow or its defaults in response, and GitHub's documentation page the newsroom opened contains no phishing warning for the flow. How often the technique is used against coding agents outside the lab is not established.
Sources
- 1The risks of device code authentication for AI coding agents
Microsoft Security Blogpublished read microsoft.com
- 2Authorizing OAuth apps: device flow
GitHub Docsread docs.github.com
How this story was checked
Automated source check, . Each claim below was compared with the source it cites before publication. Read our standards for what that check does and does not cover.
- Microsoft says its results come from a controlled lab simulation with GitHub Copilot CLI and a test account, and are not attacks observed in the wild. Source 1
- Microsoft describes four lab outcomes: remote session steering, memory poisoning, cloud session access and private repository access. Source 1
- Microsoft says any public client supporting the device flow could be abused this way, not only Copilot CLI. Source 1
- GitHub's documentation says a device user code must be entered within 15 minutes by default and is entered at github.com/login/device. Source 2
Tags: AI agents · AI Coding · Prompt Injection · Source Code Security · Phishing
From the publisher
Sonomos publishes this newsroom and makes Locke, a desktop app that detects sensitive data on your device and masks it before a prompt reaches an AI service.
How Locke worksGeneral information about privacy, security and AI, not legal advice. Laws and guidance change; check the dates above and the sources cited before relying on anything here.