Device Code Phishing Meets AI Coding Agents: One Approval Hands an Attacker Your Copilot CLI

Key takeaways
- →Microsoft Security Research showed in a lab simulation that device code phishing, the technique behind EvilTokens, can target AI coding agents instead of mailboxes.
- →Using GitHub Copilot CLI as the example, a victim who approved an attacker-initiated device code gave the attacker a token for a tool that can work with code, run commands, keep context and be steered remotely. The attacker chooses the scopes.
- →AgentGuard treats the agent session as an identity with a Principal and a purpose. A session started by someone else, steered from somewhere else, doing something the developer never asked for, is blocked.
- 1
Attacker starts a device-code sign-in and picks the scopes
- 2
Victim is lured to enter the code on the real GitHub page
- 3
Attacker receives a valid token for the agent's client
- 4
Attacker steers the coding agent's session remotely
AgentGuard binds agent sessions to their Principal and blocks remote steering and out-of-task actions
- 5
Agent touches code, runs commands, reaches repos
- Affected
- Any public client supporting the OAuth device flow; demonstrated on GitHub Copilot CLI (lab simulation)
- When
- Published by Microsoft Security Research November 17, 2026
- Impact
- Account and agent takeover: code, commands, persistent context and remote steering
What Microsoft showed
Device code phishing asks a victim to approve a sign-in on a legitimate site by typing a short code. No password is stolen and the page is real, which is why campaigns like EvilTokens scaled so well before Microsoft and partners disrupted it in September 2026.
On November 17, 2026, Uri Oren and Dor Edry of Microsoft Security Research asked what happens when the same trick targets an AI agent instead of a mailbox. They used GitHub Copilot CLI as an illustrative example. Depending on configuration, it can work with code, run commands on the user's machine, retain context across sessions and let an active session be steered remotely.
In a controlled lab, a test victim approved a GitHub device-code request started by the attacker. Microsoft is explicit that this isn't specific to GitHub or Copilot: any public client that supports the device flow can be abused the same way, and the attacker picks the requested scopes when starting the flow.
Why it's worse with an agent
A phished mailbox token reads mail. A phished agent token inherits a worker. Microsoft describes one approval spreading impact four ways, because the agent bridges identity, code and the local machine.
- The sign-in page is genuine, so URL training doesn't help
- MFA is satisfied by the victim's own approval
- The agent can act on code and commands, not only data
- Remote steering and saved context let access persist
How AgentGuard would have stopped it
AgentGuard treats each agent session as an identity with a Principal, the human or system that commands it, and a declared purpose. That gives it three places to break this chain.
Principal binding: the session was initiated from attacker infrastructure, not from the developer's own terminal. AgentGuard flags agent sessions whose initiator and commander don't match the Principal they claim, instead of trusting the token alone.
Steering control: commands arriving into an agent session from a remote controller the Principal never registered are blocked at step four.
Task context: an agent asked to fix a test doesn't need to clone every private repo, read secrets or open outbound tunnels. AgentGuard denies those out-of-task actions even with a valid token, and records them for your SOC.
What to do Monday
Microsoft's own guidance starts with the device flow itself.
- Block or restrict the OAuth device code flow where it isn't needed
- Inventory which AI coding agents are authorized in your orgs and with which scopes
- Disable or tightly control remote session steering for coding agents
- Alert on agent tokens used from unexpected locations or clients
The lesson
Each of these incidents turned an AI agent, or the tooling around it, into the attacker's best employee: legitimate credentials, legitimate permissions, machine speed. Patching the one flaw doesn't change that. AgentGuard governs what every agent and its Principal is allowed to do, wherever it runs, with zero integration and deployment measured in days.
Frequently asked questions
What is device code phishing against AI agents?
An attacker starts an OAuth device-code sign-in for an AI agent's client and tricks the victim into entering the code on the real sign-in page. The attacker then holds a valid token and can operate the agent with the victim's access.
Is this a vulnerability in GitHub Copilot CLI?
Microsoft used Copilot CLI only as an illustrative example in a lab simulation. Any public client that supports the OAuth device flow can be abused the same way, and the attacker chooses the scopes.
How does AgentGuard stop a phished agent session?
AgentGuard binds every agent session to its legitimate Principal and declared task, blocks remote steering from unregistered controllers and denies out-of-task actions even when the token is valid.
See AgentGuard on your own environment
Zero integration. Live in days. We'll show you what your current stack is missing.