本卡屬 FR-188(母卡 CM-3728),修 FR-187 資安掃描發現的 #245(中,FR-187 J1、J2 兩棒各 3:0)、#249(中,3:0;直推開了才打得到)。嚴重度:中×2。發現原文、檔名行號、面板票數在 docs/features/FR-187-2611-post-fr172-security-scan/reports/(工作坊工作區 compliance-manager-be/.worktrees/CM-3711/ 裡,主線還沒合;總表 docs/features/security-scan-consolidated/README.md §3.1 同樣在那裡)。Stage 未排,由排批的人決定(見下方「排批注意」)。

問題是什麼(白話)

主系統有自己的憑證中心,Agent 註冊時由它簽一張證書給 Agent,之後主系統靠這張證書認 Agent。問題是認得太鬆、簽得太鬆:

#245 接管別家公司的 Agent:主系統認證書只看「是本 CA 直接簽的、上面寫的 CN=那一列登記的機器指紋」,但 CN(機器指紋)是 Agent 註冊時自己報的,撞號檢查只看同租戶。攻擊者在 B 公司用受害機的指紋註冊(新列 pending,但證書照發)→ 帶受害機 agent_uid+這張證書到 A 公司重註冊,proves_prior_key 通過、保住核准、改寫 base_url 並發新通行證 → 長輪詢擠掉真機,收走工單與工具帳密、偽造結果。前提:手上有兩家公司各一組有效註冊碼,並知道受害機 uid 與指紋(管理頁看得到)。落地版開了子公司就打得到。

#249 冒充 Agent 的網址:憑證中心照註冊者自己填的網址簽伺服器證書,連 pending 也簽,用途同時給 serverAuth 與 clientAuth;主系統直推 Agent 時只認「本 CA 簽的、主機名對」。攻擊者用任一註冊碼、填受害 Agent 網址註冊拿到合法證書,當中間人冒充那台 Agent。直推目前預設關(AGENT_DIRECT_PUSH_ENABLED),開了才打得到。

在哪裡

/Users/chouraymond/Projects/Jedicogy/module/jedi-python-package/jedi-remote-agent/jedi_remote_agent/common/agent_auth/possession.py:66-74  _issued_to:只看 CA+CN(被 :95 重註冊與 :183 每次請求的持有證明共用)
/Users/chouraymond/Projects/Jedicogy/module/jedi-python-package/jedi-remote-agent/jedi_remote_agent/app/service/agent_enrollment_service.py:180-208  _resolve_agent:帶 uid+證明持有舊私鑰就算同一台
/Users/chouraymond/Projects/Jedicogy/module/jedi-python-package/jedi-remote-agent/jedi_remote_agent/app/service/agent_enrollment_service.py:216-276  _guard_fingerprint_collision:撞號只看同租戶(:257)
/Users/chouraymond/Projects/Jedicogy/module/jedi-python-package/jedi-remote-agent/jedi_remote_agent/app/service/agent_enrollment_service.py:358  重註冊保住核准、改寫 base_url
/Users/chouraymond/Projects/Jedicogy/module/jedi-python-package/jedi-remote-agent/jedi_remote_agent/app/service/agent_enrollment_service.py:410-425  CSR CN=自報 device_uuid
/Users/chouraymond/Projects/Jedicogy/module/jedi-python-package/jedi-remote-agent/jedi_remote_agent/app/service/agent_credential_issue.py:30  issue_credentials:不分 pending 都 sign_csr
/Users/chouraymond/Projects/Jedicogy/module/jedi-python-package/jedi-remote-agent/jedi_remote_agent/common/agent_auth/ca.py:31-40  san_from_base_url:自填網址主機名當 SAN、不設限
/Users/chouraymond/Projects/Jedicogy/module/jedi-python-package/jedi-remote-agent/jedi_remote_agent/app/service/agent_data_plane_client.py:141-170  直推:CA 驗 TLS+對方自報的 X-Agent-Fingerprint

行號以 2026-11-09 主線為準,對不上就以內容為準。

怎麼修

要寫測試

手測