A hooded hacker targets a device authorization code as a user signs in beside a networked AI interface.
Approve a device code only if you started that sign-in yourself. Microsoft's Nov. 17, 2026 lab research on GitHub Copilot CLI shows why. A phished approval can hand an attacker much more than a mailbox. It can reach an AI coding agent, its memory, its synced session history and the repositories behind the account.

Microsoft says these are proof-of-concept results. They are not attacks seen in the wild. They also aren't a flaw in GitHub or Copilot CLI. The researchers describe existing features working as designed once a user has approved an attacker's request.

A hooded hacker targets a device authorization code as a user signs in beside a networked AI interface. Why device code phishing keeps working​

The OAuth device flow was built for devices that can't show a full sign-in page. A client asks for a short code. The user types that code into the service's verification page on another device or browser. The client then receives access.

In device code phishing, the attacker starts the request. A lure, such as a fake IT request or a "Copilot license check," persuades the victim to enter the code and approve it. The victim never gives up a password. The sign-in page is genuine, so the real domain tells them nothing about who started the request.

Microsoft's earlier EvilTokens research makes the same point. That research was reported separately from this lab work, but it describes the same weakness. RFC 8628 describes this kind of social engineering, where a target is told to authorize a malicious application with a device code. The new work asks what happens when the target is an AI agent rather than an inbox.

Two points from the research matter for scope:

  • Any public client that supports the device flow can be abused this way. Copilot CLI was only the illustrative example.
  • The attacker's client chooses the requested scopes. In the lab, the request included repo, read:user, read:org, gist and codespace.
  • The Copilot CLI client ID is public. It is not a secret.

What the lab showed​

The researchers had a test account approve a device-code request started by a client they controlled. They then examined four outcomes. Each depended on account permissions and enabled features.

1. Steering a live session​

If a user has enabled remote control for a Copilot CLI session, and organization policy allows it, an authorized client can interact with that session. In the lab, the agent ran a command on the test machine. The session's approval prompts and local operating-system permissions still applied.

Microsoft is explicit that this is not unauthenticated remote code execution. It does not apply if remote control is off, the session isn't running, or the machine is offline.

GitHub's documentation backs up the boundaries. Remote control is off by default. For seats provided by an organization, the "Store local sessions in the Cloud" policy must be set to "View and control," and it is unconfigured by default. The CLI and its shell commands keep running on the local machine. Remote control doesn't grant access beyond what the agent can do in that session. Remote access is also limited to interactive sessions.

One line in GitHub's security notes is worth reading closely. It says remote control is available only to the person signed in with the same account that started the session. A phished device-code authorization effectively makes the attacker that signed-in account, at least for the scopes granted.

2. Poisoning agent memory​

Copilot Memory can hold repository facts and user preferences. In the simulation, the researchers added misleading entries with the agent's /memory command. If later interactions use those entries, the effect can outlast the original sign-in.

This depends on which memory features and policies are enabled. Microsoft also warns that turning memory off does not delete entries already stored. Responders have to review and clean out saved content separately.

3. Reading synced sessions​

Where cloud session storage is enabled, the researchers could read the test account's synced Copilot CLI sessions, including earlier ones. Those can contain code snippets, file paths and architecture discussions.

Syncing and remote control are separate settings. GitHub's policy has a "View from cloud" level for syncing only and a "View and control" level that adds remote control. So an administrator who allows syncing hasn't necessarily allowed remote control. The reverse trap is real too: a session history that seems harmless can still leak a lot of context.

4. Private repository access​

The authorization gave access to the private repositories available to the test account. That follows from the requested scopes and the account's permissions. It is not a Copilot CLI feature. The exposure can include application code and infrastructure definitions.

How Defender fits in​

Microsoft built two Defender XDR detections for suspected Copilot CLI device code phishing. One covers delivery by email and one covers delivery by Microsoft Teams. They link suspicious messages and clicks to later GitHub OAuth token creation and regeneration events. The aim is to flag authorizations that would otherwise look legitimate.

This depends on visibility into GitHub activity. That requires the GitHub Enterprise Cloud connector in Defender for Cloud Apps. Microsoft's connector documentation lists prerequisites. The connecting account must be an organization owner. For posture (SSPM) features it must own the enterprise account. The connector uses OAuth scopes including admin:org, read:user, user:email and repo:status. SSPM also needs read:enterprise. After connecting, the connector receives events from the prior seven days.

Microsoft also describes a disruption action for GitHub Enterprise Managed Users (EMU). It suspends the affected managed identity through the organization's identity provider. Microsoft validated this in its research environment. It says detection and disruption depend on configuration, telemetry, identity integration and prerequisites. Don't assume a plain personal GitHub account is covered.

What to do now​

For users:

  • Enter a device code only for a sign-in you started. Treat an unsolicited request to "verify GitHub" or "activate Copilot" as phishing, even on github.com.

For administrators:

  1. Review the "Store local sessions in the Cloud" policy. Pick the least permissive setting your workflows support.
  2. Review authorized OAuth apps in GitHub account settings and revoke any that are unexpected or no longer needed.
  3. Limit repository access through organization roles so one compromised account can't reach more code than its job needs.
  4. Configure Safe Links in Defender for Office 365 and verify Safe Links protection for Teams. They help with malicious links and investigation, but they won't stop a user approving a legitimate GitHub URL.
  5. Connect GitHub Enterprise Cloud to Defender for Cloud Apps. Then check that the activity you need actually shows up.

If you suspect an incident:

  • Revoke unexpected OAuth authorizations and confirm access is actually blocked.
  • Review affected sessions and repositories.
  • Inspect and clean saved Copilot memory.

Microsoft's EvilTokens research adds a broader point for Microsoft 365 shops. It recommends blocking device code flow wherever possible. Where Teams devices need it, scope the exception tightly in Conditional Access. That advice is about Entra sign-ins, not GitHub. The idea carries over, though: if you don't need the flow, don't leave it open.

Analysis​

Three caveats are worth keeping in view.

First, this is lab research from a vendor that sells the detections. Microsoft is open about the limits. It notes no in-the-wild observation, and every outcome requires a victim to approve the request. That is a real barrier, but EvilTokens-scale campaigns show social engineering can clear it.

Second, remote control and cloud sync are off by default for organization seats. Many environments may be less exposed than the headline suggests. Anyone who enabled "View and control" for convenience should recheck that choice.

Third, the repository outcome has nothing to do with AI. A phished token with repo scope exposes private code whether or not Copilot is involved. The AI-specific risks are remote steering, memory poisoning and session history. The first two give an attacker a way to influence what the agent does next.

The broader lesson is about access. Coding agents sit between a developer's identity, their code and their shell. A phished approval now reaches whatever those agents can reach.

 

References

  1. The risks of device code authentication for AI coding agents Microsoft Security Blog 2026-11-17T15:00:00+00:00
  2. Remote control of GitHub Copilot CLI sessions - GitHub Enterprise Cloud Docs docs.github.com
  3. GitHub - CultCornholio/solenya: Microsoft365 Device Code Phishing Framework · GitHub github.com