AIDEFEND in Action AIA-0144 Validated Research

GitHub Copilot CLI: Phished Device Code Authorization Enables Session Steering and Memory Poisoning

GitHub Copilot CLI is a coding assistant that runs in a terminal. Microsoft showed in a lab that a developer could be tricked into approving an attacker's device sign-in on the real GitHub site. GitHub then issues an OAuth access token to the initiating client. Depending on the permissions and enabled features, the token could steer an active local session, plant misleading Copilot Memory, read cloud-synced conversations, or access private repositories. Each outcome has its own prerequisites.

Social EngineeringLocal Agent TakeoverIdentity & AccessAI Coding AgentGitHub Security
6 applicable AIDEFEND defenses
Source: The risks of device code authentication for AI coding agents 
Authors: Uri Oren, Dor Edry, Microsoft Security Research
Original article: Nov 17, 2026

Threat Analysis

  • How the real sign-in page becomes part of the lure. Device authorization lets a terminal client start a sign-in while a browser finishes it. The client ID is public. The person approves a short code on GitHub, but GitHub returns the token to the client that started the request. Microsoft used a test account and a researcher-controlled client that requested repo, read:user, read:org, gist and codespace. These scopes were chosen by that client. The legitimate site and application name do not show who initiated the authorization.
  • Why one authorization has four possible effects. In the simulation, remote steering required an online interactive session, user opt-in and permissive policy. Commands still ran under local OS permissions and session approval settings, and GitHub documents that the remote interface can answer prompts. Copilot Memory, if enabled, let researchers leave misleading facts for later sessions. Cloud session storage separately exposed past conversations, and the selected repo scope allowed private repository access only where the account already had permission.
  • What can outlast the sign-in. A saved fact or preference can influence later coding sessions even after the attacker loses access. Turning off the memory feature does not remove existing entries. The Defender research correlated a message link click with GitHub audit evidence of OAuth token creation or regeneration. It also demonstrated an IdP disruption action for supported Enterprise Managed Users (EMU) deployments.

Applicable AIDEFEND Defenses (6)

AID-E-001.004
Delegated Grant & Connected-App Authorization Revocation
Very High
Identify and revoke the unexpected GitHub OAuth authorization in the affected account's settings or through the supported app administration path, then verify the grant and GitHub-associated tokens no longer permit access within the incident scope. Checked-out code and separately authenticated local sessions require their own response.
AID-E-005
Compromised Durable Application Session & Agent State Teardown
Very High
Review stored Copilot Memory and delete the specific misleading facts or preferences found in the incident. Confirm they are absent in the managed store and are no longer loaded in a fresh scope. Disabling memory alone leaves existing records available for later reuse if it is re-enabled.
AID-H-021.001
Client-Side Configuration Enforcement
High
Validate the enterprise-managed Copilot CLI profile against policy before deployment. For devices that should never host remote sessions, require the supported remoteControl disabled setting, deploy it via the managed settings channel and check effective behavior on the device. GitHub organization controls for cloud session storage and Copilot Memory are separate settings.
AID-D-011.004
Non-Human Identity & Delegated Token Abuse Detection
High
Ingest GitHub Enterprise Cloud audit events (including OAuth application token creation and regeneration via the Microsoft Defender for Cloud Apps connector) and correlate them with email or Microsoft Teams link clicks, anomalous IP/ASN changes between the browser approval and token polling, and subsequent repository or session activity.
AID-E-001.002
Issued Token, Authentication Session & Lease Revocation
High
Inventory the GitHub-issued tokens and authenticated channels involved in the incident. Revoke them at the issuer or service that accepts them, then verify that the revoked token can no longer retrieve synced Copilot sessions. On the managed identity path Microsoft tested, suspending the Enterprise Managed User at the identity provider helps interrupt access. Separately stop or contain a live CLI session that remains reachable.
AID-H-004.001
User & Privileged Access Management
High
GitHub organization owners can grant repository access only through the teams and roles required by the developer’s job. Check effective grants, including organization-wide access and direct membership. With narrower access, a stolen authorization from that account can reach fewer private repositories. Verify with a test member that an assigned private repository is accessible and an unassigned one is denied.

What Defenders Should Do Now

  • Ask developers to approve only device requests they initiated and report unexpected ones. Correlate message link clicks with GitHub OAuth events if the tenant has the supported GitHub Enterprise Cloud audit connector.
  • Disable remote control on managed devices that do not need it. Use the least permissive cloud session-storage policy compatible with the work and separately evaluate Copilot Memory. Verify which session controls and approval prompts can be reached remotely.
  • Revoke the suspicious GitHub authorization and verify token invalidation. Contain the live session, examine repository and cloud-session activity, and remove confirmed poisoned memory entries using GitHub's management controls.

Conclusion

AIDEFEND  maps the distinct defenses to the device configuration, delegated GitHub grant and stored agent memory. Apply each at the corresponding boundary: disabling remote control stops steering on managed hosts, revoking the grant cuts off access authorized by it, and deleting poisoned memory protects later sessions.

Last updated: