One phished code can hand attackers your AI coding agent

Published

Device code phishing usually ends with an attacker reading someone's email. Microsoft researchers wanted to know what happens when the same trick lands on an AI coding agent instead. In a controlled lab simulation, Uri Oren, Dor Edry and Microsoft Security Research used GitHub Copilot CLI as the example, and one approved code was enough to reach the developer's agent sessions, its memory and private repositories.

Microsoft is explicit that these are proof-of-concept results built on features working as designed. It has not observed the four outcomes in the wild, and each one depends on the victim approving the attacker's request and on how the account is configured.

The sign-in page is real, which is the problem

The OAuth device flow lets command-line tools sign in without a browser: the tool asks for a short code, the user types it into the service's verification page, and the tool gets access. In device code phishing, the attacker starts that request and talks someone else into approving it. Microsoft has previously reported the technique in campaigns including Storm-2372 and EvilTokens, which it says it helped disrupt with industry and law enforcement partners in September 2026.

Here the victim signs in on the genuine github.com page, and the authorization appears under a legitimate application name. Copilot CLI's client identifier is public, and Microsoft stresses the technique is not specific to GitHub or Copilot: any public client that supports the device flow can be abused, with the attacker choosing the scopes. In the lab the request asked for repo, read:user, read:org, gist and codespace.

Four things one approval unlocked in the lab

That shift is the point of the research. As agents gain access to code, history and local tools, the damage from one phished authorization depends on what the agent can reach. It echoes the device-code kit we covered in a phishing kit that abuses Microsoft's own login page, moved onto developer tooling.

Only approve codes you asked for

Microsoft has also built two Defender XDR detections for suspected Copilot CLI device code phishing via email and via Teams, which tie suspicious messages and clicks to GitHub OAuth token creation, plus a disruption action for GitHub Enterprise Managed Users. The bigger takeaway is simpler: a legitimate verification page proves nothing about who asked for the code.

This briefing is provided by IntelFusions for informational and defensive purposes only. It is based on sources assessed to be reliable at the time of writing, and analytic judgments carry the confidence levels indicated. Indicators of compromise are defanged; re-arm them only in controlled environments. IntelFusions is not affiliated with the organizations named and makes no warranty as to completeness or accuracy.

Read the full analysis on IntelFusions