GCP AI 服務安全概觀
GCP AI 服務(包括 Vertex AI、Model Garden 與 AI Platform)之紅隊方法論:服務枚舉、服務帳號攻擊,以及攻擊面繪製。
GCP AI 服務安全概觀
Google Cloud Platform 之 AI 產品組合以 Vertex AI 為核心之統一 ML 平台,Model Garden 提供對第一方與第三方基礎模型之存取。GCP 之 AI 安全模型建立於 IAM 服務帳號、VPC Service Controls 與 Cloud Audit Logging 之上。對紅隊而言,GCP AI 引入獨特挑戰:其服務帳號模型造就複雜之冒充鏈、VPC Service Controls 可於組織層級限制 API 存取,且 Google 之基礎設施提供需被刻意弱化才能利用之強預設。
服務景觀
Vertex AI
Vertex AI 是 GCP 之統一 ML 平台,將先前分離之服務(AI Platform Training、AI Platform Prediction、AutoML)合併為單一面。它涵蓋完整 ML 生命週期:
| 元件 | 功能 | 攻擊面 |
|---|---|---|
| Workbench | 受管理之 Jupyter notebook | 程式碼執行、憑證存取、橫向移動 |
| Training | 客製與 AutoML 訓練作業 | 訓練資料存取、運算濫用 |
| Prediction endpoints | 線上與批次預測 | 模型擷取、端點濫用 |
| Pipelines | ML 工作流程協作編排 | 管線投毒、步驟操弄 |
| Feature Store | 特徵管理與服務 | 特徵投毒、資料操弄 |
| Model Registry | 模型版本管理 | 模型替換、供應鏈 |
| Vector Search | 用於 embedding 之最近鄰搜尋 | 為 RAG 系統之索引投毒 |
| Generative AI | 基礎模型 API 存取 | 提示注入、guardrail 繞過 |
詳細 Vertex AI 利用請見 Vertex AI 攻擊面。
Model Garden
Model Garden 是 GCP 探索、測試與部署 Google(Gemini、PaLM、Gemma)、開源(Llama、Mistral)與第三方供應商之基礎模型的中樞。
| 面向 | 描述 | 紅隊相關性 |
|---|---|---|
| 第一方模型 | Google 之 Gemini、PaLM、Codey | 以 API 為本之攻擊、guardrail 繞過 |
| 開源模型 | 自部署之 Llama、Mistral 等 | 完整模型入侵、無供應商安全網 |
| 一鍵部署 | 快速部署至 Vertex 端點 | 潛在不安全之預設組態 |
| Model card | 模型文件與侷限 | 為針對性攻擊蒐集情資 |
詳細 Model Garden 風險請見 Model Garden 風險。
遺留 AI Platform
部分組織仍使用遺留 AI Platform 服務。雖然已被 Vertex AI 取代,但這些服務仍可運作,並可能具較弱之安全組態:
- AI Platform Training:遺留訓練作業服務
- AI Platform Prediction:遺留模型服務
- AI Platform Notebooks:遺留受管理 notebook(現為 Vertex AI Workbench)
服務帳號架構
預設服務帳號
GCP AI 服務使用服務帳號進行驗證。理解哪些服務帳號在場關鍵:
| 服務帳號 | 使用者 | 預設權限 |
|---|---|---|
| Compute Engine 預設 SA | Vertex AI 訓練、notebook(若無自訂 SA) | roles/editor(極廣) |
| Vertex AI Service Agent | 內部 Vertex AI 操作 | Google 管理、範圍有限 |
| 客製服務帳號 | 組織為特定工作負載所定義 | 依組態而異 |
| 使用者管理 SA | 開發與測試 | 常過度特權 |
# 列出專案中之服務帳號
gcloud iam service-accounts list
# 檢查 SA 權限
gcloud projects get-iam-policy <project-id> \
--flatten="bindings[].members" \
--filter="bindings.members:serviceAccount:*vertex*" \
--format="table(bindings.role)"
# 檢查 SA 金鑰檔(憑證曝露)
gcloud iam service-accounts keys list \
--iam-account=<sa-email> \
--managed-by=user服務帳號冒充
GCP 允許服務帳號冒充——一個身分承擔另一服務帳號之權限。這造就鏈:
# 檢查誰可冒充 AI 相關服務帳號
gcloud iam service-accounts get-iam-policy <ai-sa-email>
# 尋找 roles/iam.serviceAccountTokenCreator 或
# roles/iam.serviceAccountUser 綁定詳細 IAM 利用請見 AI 之 GCP IAM。
枚舉與偵察
發掘 Vertex AI 資源
# 列出 Vertex AI 端點(已部署模型)
gcloud ai endpoints list --region=us-central1
# 列出 Vertex AI 模型
gcloud ai models list --region=us-central1
# 列出訓練作業
gcloud ai custom-jobs list --region=us-central1
# 列出 notebook(Workbench 實例)
gcloud workbench instances list --location=us-central1
# 列出管線
gcloud ai pipelines list --region=us-central1
# 列出 feature store
gcloud ai featurestores list --region=us-central1
# 列出 Vertex AI 資料集
gcloud ai datasets list --region=us-central1
# 檢查 Generative AI 模型存取
gcloud ai models list --region=us-central1 \
--filter="displayName~gemini OR displayName~palm"專案層評估
# 檢查已啟用之 API(哪些 AI 服務活躍)
gcloud services list --enabled --filter="name:aiplatform OR name:ml"
# 檢查影響 AI 服務之組織政策
gcloud resource-manager org-policies list --project=<project-id>
# 檢查 VPC Service Controls(可能限制 AI API 存取)
gcloud access-context-manager perimeters list --policy=<policy-id>ML 之 Artifact Registry
ML 模型產物與容器映像儲存於 GCP Artifact Registry 或遺留 Container Registry:
# 列出儲存庫(可能含 ML 模型產物與訓練容器)
gcloud artifacts repositories list
# 列出 Docker 映像(訓練與服務容器)
gcloud artifacts docker images list <repository>常見錯誤組態
預設服務帳號使用
單一最常見之 GCP AI 錯誤組態。組織為下列使用 Compute Engine 預設 SA:
- Vertex AI 訓練作業(授予訓練容器
Editor) - Workbench notebook(授予 notebook VM
Editor) - 預測端點(授予服務容器
Editor)
公開端點
Vertex AI 線上預測端點可於各種存取層級組態:
# 檢查端點存取組態
gcloud ai endpoints describe <endpoint-id> --region=us-central1 \
--format="json(dedicatedEndpointEnabled,trafficSplit)"缺少 VPC Service Controls
VPC Service Controls 於 GCP 服務周圍建立安全邊界。若無它們:
- 資料可自 Vertex AI 外洩至外部專案
- 模型產物可被複製至攻擊者掌控之 GCS bucket
- 訓練資料可自任何已授權身分存取——無網路限制
稽核日誌不足
GCP Cloud Audit Logs 擷取 AI 服務 API 呼叫,但資料存取日誌必須明確啟用:
# 檢查稽核日誌組態
gcloud projects get-iam-policy <project-id> --format=json | \
python3 -c "import sys,json; d=json.load(sys.stdin); print(json.dumps(d.get('auditConfigs', []), indent=2))"相關主題
- Vertex AI 攻擊面 -- 詳細 Vertex AI 利用
- Model Garden 風險 -- 第三方模型部署風險
- AI 之 GCP IAM -- IAM 模式與利用
- 雲端 AI 安全概觀 -- 跨供應商比較
某 Vertex AI 訓練作業於未指定客製服務帳號下組態。它以何服務帳號執行,為何此為安全關切?
於 GCP AI 偵察期間,為何除 Vertex AI 外亦應檢查遺留 AI Platform 資源?
參考資料
- Vertex AI Security -- 官方安全文件
- GCP Service Accounts -- 服務帳號最佳實務
- VPC Service Controls -- 網路安全邊界