GitHub Device Codes Put AI Agents at Risk

Microsoft Security · Medium sophistication
Last updated November 18, 2026

The article describes how attackers can trick users into approving a legitimate GitHub device-code sign-in request that the attacker initiated. In a controlled simulation, that approval gave an attacker access to private repositories, synced Copilot CLI sessions, saved agent memory, and, when enabled, remote control of an active coding session. The article also cites real device-code phishing campaigns, including EvilTokens and Storm-2372.

How the attack worked

This attack abuses GitHub's device-code sign-in flow, a legitimate mechanism meant for devices without a browser. An attacker starts the sign-in process themselves, generates a device code, and then sends that code along with the genuine GitHub verification link to a target. The pretext is often framed as an IT request or a Copilot license check, something a developer would not question twice. If the recipient opens the real GitHub page, signs in, and approves the code, the attacker, not the recipient, ends up with the authorized session.

Why it succeeded

The core reason this works is that every visible signal looks correct. The user signs in on the actual GitHub site, not a lookalike page, and the verification screen is not spoofed in any way. A familiar, trusted domain therefore cannot tell the user whether the sign-in request was theirs to begin with. In a controlled simulation, an approved authorization was shown to enable access to private repositories available to the victim account, and where enabled, attackers could read cloud-synced Copilot CLI sessions, add misleading entries to Copilot Memory, and, if an active session was online with remote control enabled, steer that session within local permission and approval limits.

What to watch for

  • A sign-in or verification request you did not personally start.
  • A device code supplied to you by someone else rather than one you generated yourself.
  • Messages framed as an IT request or a Copilot license check that ask you to verify GitHub access.
  • Any unexpected request to activate Copilot or confirm GitHub access, even when the link points to github.com.

Microsoft notes it has developed detections for suspected Copilot CLI device-code phishing delivered through email and Microsoft Teams, and that real campaigns using this technique, including EvilTokens and Storm-2372, have been observed.

How to build resistance

  • Only enter a device code for a sign-in that you personally initiated. Never approve a code someone else sent you.
  • Remember that GitHub's own verification page warns against using a code supplied by another person.
  • Treat any unsolicited request to verify GitHub or activate Copilot as a phishing attempt and report it rather than completing it.
  • If a suspicious approval already occurred, review and revoke unexpected OAuth authorizations in GitHub account settings, confirm that access is blocked, and investigate potentially affected repositories, sessions, and saved memory.

Because each individual step, a message, a click, and an authorization, can look unremarkable on its own, organizations that rely on GitHub Copilot CLI and other AI coding agents should pair technical detections with developer awareness of this device-code approval pattern.

Key findings

  • Attackers can initiate a legitimate GitHub OAuth device-code request and persuade a victim to approve it.
  • The GitHub verification page can be genuine, so a github.com address does not prove that the sign-in request is safe.
  • In the controlled lab, an approved authorization enabled access to private repositories available to the victim account.
  • Where enabled, attackers could read cloud-synced Copilot CLI sessions and add misleading Copilot Memory entries.
  • If remote control was enabled and an active session was online, the attacker could steer that session within local permission and approval limits.
  • Microsoft developed detections for suspected Copilot CLI device-code phishing delivered through email and Microsoft Teams.

Who’s being targeted

  • Commonly targeted roles: Software developers, Engineering leaders, GitHub organization administrators, GitHub Copilot administrators, IT support teams, Security operations teams.
  • Affected industries: Software development, Technology, Organizations using GitHub Enterprise Cloud, Organizations using AI coding agents.
  • Attack channels: email.
  • Impersonated: Internal IT support or GitHub Copilot licensing team.

Red flags to watch for

  • The recipient did not initiate a GitHub or Copilot sign-in.
  • The sender supplied the device code instead of the user generating it during their own sign-in.
  • A legitimate github.com verification page cannot confirm who initiated the authorization request.
Try Mirage

Mirage safely runs attacks like this one against your own team, so you find out what happens before a real adversary does.

Get a demo

Frequently asked questions

What is GitHub device code phishing?

It is an attack where someone initiates a real GitHub OAuth device-code sign-in and tricks a victim into approving it, which hands the attacker the resulting access since the GitHub verification page itself can be genuine.

Can a legitimate github.com page still be part of a phishing attack?

Yes, the verification page can be entirely real, so the domain alone does not prove the sign-in request is safe. A familiar domain cannot tell a user whether they initiated the request.

What can an attacker access after an approved device code?

In a controlled simulation, approval enabled access to private repositories, cloud-synced Copilot CLI sessions, saved Copilot Memory entries, and in some cases remote steering of an active coding session within local permission limits.

What should someone do if they suspect they approved a malicious device code?

Review and revoke unexpected OAuth authorizations in GitHub account settings, confirm access is blocked, and investigate potentially affected repositories, sessions, and saved memory.

Read the video transcript

A real GitHub page can still be a phishing trap. An email posing as IT says, 'Activate Copilot: enter this code at the GitHub verification link.' You open the genuine page, sign in, and approve a request someone else started. That's the twist: github.com proves the page is real, not who started the sign-in. Approval could expose private repos and synced Copilot CLI sessions, even saved agent memory. If someone sends you a GitHub device code, don't approve it. Report that request to security.

Categories

Similar attacks

Attackers Phish via Teams & Slack, Not Email

Attackers Phish via Teams & Slack, Not Email

Research and incident examples show attackers increasingly using trusted collaboration tools (like Microsoft Teams and Slack) to impersonate IT/support or known community members, then push victims to phishing sites, approve MFA prompts, or run malicious files. Because messages come through…

August 20, 2026
“No-Action” Emails Trigger OWA Mailbox Takeover

“No-Action” Emails Trigger OWA Mailbox Takeover

Russian-linked threat actors sent generic-looking informational emails that required no clicking, but simply opening them in vulnerable Outlook Web Access (OWA) could trigger a hidden exploit. The campaign targeted government and multiple industries, then installed a stealthy browser-based implant…

July 30, 2026
APT Groups Lure Targets Into Fake Zoom/Teams Meets

APT Groups Lure Targets Into Fake Zoom/Teams Meets

This threat trend report describes multiple real-world APT campaigns where attackers rely on social engineering and trusted services (Zoom/Teams, Telegram, webmail, GitHub) to steal credentials and access cloud accounts. Notable examples include fake meeting lures to deliver malware, and abuse of…

August 20, 2026
Fake Install Guides and Helpdesk Calls Drive Attacks

Fake Install Guides and Helpdesk Calls Drive Attacks

This bulletin describes multiple real-world social engineering campaigns where attackers trick people into trusting a familiar screen, like a search result “install guide,” a recruiter outreach, or a helpdesk phone call. The lures push victims to paste commands, install fake software, or reset MFA,…

July 30, 2026
North Korea Scales AI-Powered Job Scams

North Korea Scales AI-Powered Job Scams

Microsoft reports that North Korean threat actors are using AI to make job scams, fake recruiter outreach, fraudulent worker identities, and targeted phishing campaigns faster and more convincing. One group posed as recruiters for a spoofed AI blockchain company and scheduled software-engineer…

October 29, 2026
GhostAction Phishes Developers With Fake GitHub Alert

GhostAction Phishes Developers With Fake GitHub Alert

GhostAction attackers sent a fake GitHub security alert to an open-source maintainer, claiming a login from Moscow and directing the victim to secure their account. The fake site stole the victim’s password and two-factor code, then silently approved a powerful GitHub OAuth connection that let the…

October 19, 2026