Device Code Phishing Can Hijack AI Coding Agents
Written by AI from the linked story. Not reviewed by an editor. How this works
Researchers demonstrated that the device code authentication flow — designed for input-limited devices — can be weaponized against AI coding agents like GitHub Copilot CLI by tricking users into approving a malicious sign-in request. Once a user approves the phished device code, attackers gain the ability to steer remote sessions, execute arbitrary commands on the victim's machine, manipulate agent memory, and access private repositories. The attack succeeds because device code flows shift authentication approval entirely to the human user, bypassing technical controls and exploiting the trust users place in familiar-looking prompts. This matters because AI coding agents operate with significant privileges — file access, code execution, repository permissions — meaning a single social engineering success can yield deep and persistent access.
Tactical Insight
Immediate actions
- Train developers and AI tool users to scrutinize every device code authorization prompt and never approve requests they did not personally initiate.
- Restrict which OAuth applications and device code flows are permitted within your organization via identity provider (IdP) conditional access policies.
Long-term improvements
- Adopt phishing-resistant authentication methods (e.g., FIDO2/passkeys) for AI agent integrations wherever the platform supports them.
- Apply the principle of least privilege to AI agent OAuth scopes, limiting access to only the specific repositories and actions each agent genuinely requires.
- Establish a formal review process for evaluating the authentication mechanisms of any AI tooling before organizational adoption.
Detection measures
- Enable and monitor audit logs for OAuth token issuances and device code grants across your identity provider and GitHub organization.
- Alert on anomalous agent behaviors such as unexpected repository access, command execution patterns, or session activity from unfamiliar IP addresses.