{
  "schema": "aidefend-secureflow-metadata-v1",
  "flow_id": "aidefend-research-sf0094-copilot-cli-device-code-session-steering",
  "title": "GitHub Copilot CLI: Phished Device Code Authorization Enables Session Steering and Memory Poisoning",
  "subtitle": "Microsoft demonstrated four distinct effects of a phished GitHub device authorization, each bounded by Copilot settings and account permissions.",
  "summary": "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.",
  "reviewed": true,
  "import_status": "curated-research",
  "ai_layers": [
    "autonomous-agents",
    "edge-client-ai"
  ],
  "risk_impact": [
    "credential-identity-theft",
    "system-compromise-rce",
    "data-exfiltration",
    "model-poisoning-integrity"
  ],
  "affected_components": [
    "GitHub OAuth 2.0 device authorization flow for GitHub Copilot CLI",
    "GitHub Copilot CLI local runtime and remote session control feature",
    "Copilot Memory (/memory) persistent cross-session context store",
    "Cloud-synced Copilot CLI session storage and GitHub private repositories"
  ],
  "source_research": {
    "provider": "Microsoft Security Research",
    "primary_url": "https://www.microsoft.com/en-us/security/blog/2026/11/17/the-risks-of-device-code-authentication-for-ai-coding-agents/",
    "published": "2026-11-17",
    "note": "The four outcomes come from a controlled lab. The device-flow initiator chose the requested scopes. Remote steering requires an active, online and remotely enabled session with permissive policy; cloud-sync access alone does not grant control."
  },
  "attack_steps": [
    {
      "id": "device-request",
      "title": "Initiate a device-code request using the Copilot CLI client",
      "zhTitle": "發起 GitHub Copilot CLI 裝置碼授權請求",
      "summary": "The researcher-controlled OAuth client starts a GitHub device sign-in and requests the access scopes used in the lab.",
      "zhSummary": "由研究人員控制的 OAuth 用戶端先發起 GitHub 裝置登入，並主動要求實驗測試用的權限範圍。",
      "tactic": null,
      "technique": null,
      "layout": {
        "x": 0,
        "y": 0
      }
    },
    {
      "id": "phish-lure",
      "title": "Have the developer approve the attacker-initiated request",
      "zhTitle": "誘使開發者在 GitHub 官方頁面核准登入",
      "summary": "The test developer enters the code on GitHub's legitimate verification page and approves a sign-in they did not initiate.",
      "zhSummary": "測試中的開發者在 GitHub 官方驗證頁面輸入代碼並按下核准，但這筆登入請求其實是別人發起的。",
      "tactic": "AML.TA0004",
      "technique": "AML.T0052",
      "layout": {
        "x": 530,
        "y": 0
      }
    },
    {
      "id": "poll-token",
      "title": "Obtain a delegated OAuth access token after approval",
      "zhTitle": "在使用者核准後取得 OAuth 存取 token",
      "summary": "The initiating client receives the delegated credential. Subsequent access depends on the scopes granted and the account's permissions.",
      "zhSummary": "發起請求的用戶端收到代表該使用者的存取 token；之後能存取什麼，取決於這次核准的權限範圍以及帳號原本的權限。",
      "tactic": "AML.TA0004",
      "technique": "AML.T0091.000",
      "layout": {
        "x": 1060,
        "y": 0
      }
    },
    {
      "id": "remote-steer",
      "title": "Steer an active Copilot CLI session",
      "zhTitle": "遠端操控連線中的本機 Copilot CLI",
      "summary": "In the lab, an online session with remote control enabled and allowed by policy ran a command under local permissions and session approvals.",
      "zhSummary": "在實驗中，因為本機工作階段正好維持連線、使用者開啟了遠端控制，且組織政策允許，遠端介面便能操控本機執行命令；不過執行能力仍受本機作業系統權限和工作階段的核准設定限制。",
      "tactic": "AML.TA0005",
      "technique": "AML.T0050",
      "layout": {
        "x": 1670,
        "y": -870
      }
    },
    {
      "id": "memory-poison",
      "title": "Add misleading saved facts or preferences",
      "zhTitle": "在 Copilot Memory 寫入誤導性指令",
      "summary": "Where Copilot Memory is enabled, the lab demonstrated adding misleading entries through the memory feature. The effect can persist when later sessions reuse the entries.",
      "zhSummary": "在 Copilot Memory 已開啟的情況下，研究人員透過記憶功能新增誤導性的設定與規則；後續工作階段只要再讀到這些內容，行為就可能受到影響。",
      "tactic": "AML.TA0006",
      "technique": "AML.T0080.000",
      "layout": {
        "x": 1670,
        "y": -290
      }
    },
    {
      "id": "session-read",
      "title": "Read conversations already synced to the cloud",
      "zhTitle": "讀取同步到雲端的 Copilot CLI 對話紀錄",
      "summary": "Cloud storage made historical CLI session context readable to the test account. Storage alone did not let the attacker steer a session.",
      "zhSummary": "研究人員讀取了測試帳號已同步到雲端的歷史對話。不過單純看得到雲端紀錄，並不會開啟遠端操控能力。",
      "tactic": "AML.TA0009",
      "technique": "AML.T0085.002",
      "layout": {
        "x": 1670,
        "y": 290
      }
    },
    {
      "id": "repo-access",
      "title": "Access repositories available to the test account",
      "zhTitle": "存取測試帳號有權使用的私有儲存庫",
      "summary": "In this test, the requested repo scope and the account's existing permissions allowed access to private repositories.",
      "zhSummary": "因為這次實驗請求的權限包含 repo scope，再搭配測試帳號原有的權限，用戶端就能讀取有權存取的私有儲存庫。",
      "tactic": "AML.TA0009",
      "technique": "AML.T0036",
      "layout": {
        "x": 1670,
        "y": 870
      }
    }
  ],
  "threat_refs": [
    {
      "id": "AML.T0052",
      "name": "Phishing"
    },
    {
      "id": "AML.T0091.000",
      "name": "Application Access Token"
    },
    {
      "id": "AML.T0050",
      "name": "Command and Scripting Interpreter"
    },
    {
      "id": "AML.T0080.000",
      "name": "Memory"
    },
    {
      "id": "AML.T0085.002",
      "name": "Conversation Context and Memory"
    },
    {
      "id": "AML.T0036",
      "name": "Data from Information Repositories"
    }
  ],
  "reader_narrative": {
    "pathCount": 4,
    "topologyNote": "The four post-token branches represent Microsoft’s controlled lab demonstrations of distinct feature surfaces reachable with the phished token, each governed by its own configuration prerequisites.",
    "groups": [
      {
        "id": "entry",
        "kind": "shared",
        "eyebrow": "Phished OAuth grant",
        "label": "Device code request to token polling",
        "summary": "The attacker initiates a legitimate GitHub Copilot CLI device flow, lures the developer into entering the short code on github.com, and polls for the resulting access token.",
        "stepIds": [
          "device-request",
          "phish-lure",
          "poll-token"
        ]
      },
      {
        "id": "steer",
        "kind": "path",
        "eyebrow": "Conditional branch 1",
        "label": "Remote session steering",
        "summary": "Requires an active online local CLI session, user-enabled remote control, and permissive organization policy.",
        "stepIds": [
          "remote-steer"
        ]
      },
      {
        "id": "memory",
        "kind": "path",
        "eyebrow": "Conditional branch 2",
        "label": "Copilot Memory poisoning",
        "summary": "Requires Copilot Memory enabled; entries persist across sessions until explicitly deleted.",
        "stepIds": [
          "memory-poison"
        ]
      },
      {
        "id": "sessions",
        "kind": "path",
        "eyebrow": "Conditional branch 3",
        "label": "Cloud session transcript exposure",
        "summary": "Requires \"Store local sessions in the Cloud\" enabled; does not by itself enable remote command execution.",
        "stepIds": [
          "session-read"
        ]
      },
      {
        "id": "repos",
        "kind": "path",
        "eyebrow": "Conditional branch 4",
        "label": "Private repository access",
        "summary": "Uses the broad repo scope requested by the Copilot CLI device flow.",
        "stepIds": [
          "repo-access"
        ]
      }
    ]
  }
}
