安全研究員 Alvin Ferdiansyah 發現 Google Gemini Live API 的參考實作在產出短期令牌時遺漏了 live connect constraints 欄位,使得攻擊者能挾持瀏覽器端的 AI 語音會話,自行指定模型、系統提示與工具。 修補方式:在令牌產出時填入 live connect constraints.bidi generate content setup,明確指定模型、系統提示,並將工具陣列設為空或僅允許的項目。

Create a landscape editorial hero image for this Studio Global article: Search & fact-check with cited sources for What is the Gemini Live API flaw discovered by Alvin Ferdiansyah, how does it allow attackers to. Article summary: ## The Vulnerability. Topic tags: general, documentation, general web, user generated. Style: premium digital editorial illustration, source-backed research mood, clean composition, high detail, modern web publication hero. Use reference image context only for broad subject, composition, and topical grounding; do not copy the exact image. Avoid: logos, brand marks, copyrighted characters, real person likenesses, fake screenshots, UI text, readable text, watermarks, charts with fake numbers, clickbait thumbnails, icons, and tiny thumbnail layouts. Make it useful as an illustrative visual, not as factual evidence.
2026 年 6 月底,安全研究員 Alvin Ferdiansyah 發表了一份詳細分析,指出 Google Gemini Live API 的短期令牌(ephemeral token)系統存在一個嚴重的組態缺失。這項漏洞若經證實,能讓取得短期 WebSocket 令牌的攻擊者挾持瀏覽器端的 AI 語音會話,完全控制模型、系統提示,以及會話可執行的工具。
此漏洞的核心在於產出令牌時遺漏了一個關鍵的安全欄位。以下是你需要知道的資訊、尚未確認的部分,以及開發者現在就能採取的防護措施。
Gemini Live API 支援透過「短期令牌」進行瀏覽器到伺服器的 WebSocket 連線。這些令牌生命期短、可快速到期,並能限制特定用途 。令牌由後端伺服器產生後交給客戶端,客戶端再使用它直接連接到 Gemini API,過程中不會暴露底層的 API 金鑰。
Google 的文件指出,短期令牌專為安全性考量的客戶端到伺服器實作而設計,因為即使令牌從瀏覽器中被竊取,其短暫的有效時間也能限制損害 。受限連線的端點是
BidiGenerateContentConstrained,它接受短期令牌作為 access_token 查詢參數 。
live_connect_constraints 欄位根據 Ferdiansyah 的文章,令牌產出的參考實作完全遺漏了 live_connect_constraints 欄位 。這個欄位本應包含一個
bidi_generate_content_setup 物件,用來將令牌綁定到特定的模型、系統指令和一組工具。
當 live_connect_constraints 為空或不存在時,任何約束都不會生效。取得令牌的攻擊者便可以發送一個客戶端控制的設定訊框(setup frame),任意指定想要的模型、系統提示和工具。由於伺服器沒有令牌綁定的數值可供驗證,便會接受攻擊者的設定。
重要提醒: 提供的資料來源並未包含 Google 官方關於
live_connect_constraints的文件、CVE 編號或 Google 的安全公告來確認這項行為。此聲明來自 Ferdiansyah 的 Medium 文章,應視為未經官方證實但具合理性的資訊。
如果這項漏洞為真,對任何在瀏覽器環境中使用 Gemini Live API 的應用程式都將造成嚴重後果:
在 Google AI 論壇上,已有開發者回報短期令牌會忽略系統指令,以及在受限端點上無法如預期運作等問題,顯示整個生態系統仍在發展中 。
Ferdiansyah 提出的修補方法非常直接:在產出令牌時,填入 live_connect_constraints.bidi_generate_content_setup
model — 要使用的確切 Gemini 模型(例如 models/gemini-2.5-flash-native-audio-latest)。system_instruction — 預期的系統提示,以包含 text 的 parts 結構呈現。tools — 設為空陣列 [] 或僅包含明確允許的工具,以阻止客戶端注入。以下是取自 Ferdiansyah 文章的示範性 Python 程式碼 :
token = gemini_client.auth_tokens.create({
"uses": 1,
"expire_time": now + timedelta(seconds=60),
"new_session_expire_time": now + timedelta(seconds=60),
"live_connect_constraints": {
"bidi_generate_content_setup": {
"model": "models/gemini-2.5-flash-native-audio-latest",
"system_instruction": {
"parts": [{"text": "你是一位客戶支援助理..."}]
},
"tools": []
}
}
})注意: 由於
live_connect_constraints在所提供的 Google API 官方文件中並無記載,此範例是根據 Ferdiansyah 的描述,在正式環境使用前應先以實際 API 進行測試。
以下關鍵點在提供的資料來源中仍未獲得證實:
live_connect_constraints 的存在或其結構。BidiGenerateContentConstrained 端點收到不受限令牌時的具體行為,在提供的官方參考資料中並無說明 在 Google 發布官方公告之前,最安全的做法是將此漏洞視為合理威脅,並主動套用修補:
live_connect_constraints 或其等效欄位。newSessionExpireTime 設為約 60 秒,以限縮令牌被盜用的攻擊窗口 Gemini Live API 是構建即時語音和視訊體驗的強大工具。令牌產出過程中一個遺漏的欄位不應破壞這項能力——但開發者必須確保其實作是完整的。
本文已根據 27 份提供的資料來源進行事實查核,包括 Google 官方文件、社群論壇討論以及研究員的原篇文章。研究員提出的關鍵主張在截稿前未能透過官方來源獨立證實。
Studio Global AI
Use this topic as a starting point for a fresh source-backed answer, then compare citations before you share it.
安全研究員 Alvin Ferdiansyah 發現 Google Gemini Live API 的參考實作在產出短期令牌時遺漏了 live connect constraints 欄位,使得攻擊者能挾持瀏覽器端的 AI 語音會話,自行指定模型、系統提示與工具。
安全研究員 Alvin Ferdiansyah 發現 Google Gemini Live API 的參考實作在產出短期令牌時遺漏了 live connect constraints 欄位,使得攻擊者能挾持瀏覽器端的 AI 語音會話,自行指定模型、系統提示與工具。 修補方式:在令牌產出時填入 live connect constraints.bidi generate content setup,明確指定模型、系統提示,並將工具陣列設為空或僅允許的項目。
目前尚無 Google 官方文件或 CVE 確認此漏洞,開發者應視為合理威脅並主動套用修補。