Microsoft: device-code phishing can hijack Copilot CLI
2026-11-23 · iThome
According to iThome, Microsoft published research on Nov. 17 showing that attackers need not steal passwords: they can abuse the legitimate device-code login flow to trick developers into approving a sign-in and obtain OAuth access tokens.
The attacker first uses GitHub Copilot CLI on their own device to request a device code, then sends a phishing message posing as an IT support notice or a Copilot authorization check, directing the victim to GitHub's real verification page to enter the attacker's code. Because the code belongs to a login the attacker started, approval lets the attacker's client finish signing in and obtain a token, giving access within the granted scope to resources the victim can use, including private repositories.
The impact goes beyond data theft. If Copilot CLI session logs are synced to the cloud, an attacker might read earlier development history, including code snippets, file paths and architecture discussions. The agent's memory feature could be used to inject misleading content, and if remote control is enabled, organizational policy allows it and the session is still running, the attacker might even steer the agent to run commands on the user's machine, though local permissions and approvals still apply.
Microsoft researchers built two Defender XDR detections for suspected device-code phishing via email and Teams, correlating suspicious messages, link clicks and subsequent GitHub OAuth token creation. Microsoft advises users to approve only device-code requests they started, review OAuth app grants regularly and revoke suspicious ones, and limit agent remote control, cloud session storage and memory as needed.