GCP - Vertex AI 枚举

Tip

学习并练习 AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking: HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks

Vertex AI

Vertex AI 是 Google Cloud 的统一机器学习平台,用于在大规模上构建、部署和管理 AI 模型。它将各种 AI 和 ML 服务整合到单一平台中,方便数据科学家和 ML 工程师:

  • 使用 AutoML 或自定义训练来训练自定义模型
  • 将模型部署到可扩展的 endpoints 以进行预测
  • 管理从实验到生产的 ML 生命周期
  • 访问来自 Model Garden 的预训练模型
  • 监控和优化模型性能

Agent Engine / Reasoning Engine

有关 Agent Engine / Reasoning Engine 的特定枚举和事后利用路径(涉及 metadata credential theft、P4SA abuse 和 producer/tenant project pivoting),请参见:

GCP - Vertex AI Post Exploitation

关键组件

Models

Vertex AI 的模型(models)表示经过训练的机器学习模型,可部署到 endpoints 用于提供预测。模型可以:

  • 从自定义容器或模型工件上传
  • 通过 AutoML 训练创建
  • 从 Model Garden 导入(预训练模型)
  • 以多个版本进行版本控制

每个模型都有元数据,包括其框架、容器镜像 URI、工件位置和服务配置。

Endpoints

Endpoints 是托管已部署模型并提供在线预测的资源。关键特性:

  • 可以托管多个已部署模型(支持流量拆分)
  • 提供用于实时预测的 HTTPS 端点
  • 支持基于流量的自动扩缩
  • 可配置为私有或公共访问
  • 通过流量拆分支持 A/B 测试

Custom Jobs

Custom jobs 允许使用自有容器或 Python 包运行自定义训练代码。其特性包括:

  • 支持具有多个 worker pool 的分布式训练
  • 可配置的 machine types 和 加速器(GPUs/TPUs)
  • 可附加 service account 以访问其他 GCP 资源
  • 与 Vertex AI Tensorboard 集成以进行可视化
  • 提供 VPC 连接选项

Hyperparameter Tuning Jobs

这些作业通过运行多个具有不同参数组合的训练试验来自动搜索最优超参数。

Model Garden

Model Garden 提供对以下内容的访问:

  • Google 的预训练模型
  • 开源模型(包括 Hugging Face)
  • 第三方模型
  • 一键部署能力

Tensorboards

Tensorboards 为 ML 实验提供可视化和监控,跟踪指标、模型拓扑和训练进度。

Service Accounts & Permissions

默认情况下,Vertex AI 服务使用 Compute Engine 默认 service account(PROJECT_NUMBER-compute@developer.gserviceaccount.com),该账户在项目中具有 Editor 权限。但是,你可以在下列情况下指定自定义 service account:

  • 创建 custom jobs
  • 上传 models
  • 将模型部署到 endpoints

此 service account 用于:

  • 访问 Cloud Storage 中的训练数据
  • 将日志写入 Cloud Logging
  • 从 Secret Manager 访问 secrets
  • 与其他 GCP 服务交互

Data Storage

  • 模型工件(model artifacts)存储在 Cloud Storage buckets 中
  • 训练数据通常位于 Cloud Storage 或 BigQuery
  • 容器镜像存储在 Artifact Registry 或 Container Registry
  • 日志发送到 Cloud Logging
  • 指标发送到 Cloud Monitoring

Encryption

默认情况下,Vertex AI 使用 Google 管理的加密密钥。你也可以配置:

  • 来自 Cloud KMS 的 Customer-managed encryption keys (CMEK)
  • 加密适用于模型工件、训练数据和 endpoints

Networking

Vertex AI 资源可配置为:

  • 公共互联网访问(默认)
  • 用于私有访问的 VPC peering
  • 用于安全连接的 Private Service Connect
  • 支持 Shared VPC

Enumeration

# List models
gcloud ai models list --region=<region>
gcloud ai models describe <model-id> --region=<region>
gcloud ai models list-version <model-id> --region=<region>

# List endpoints
gcloud ai endpoints list --region=<region>
gcloud ai endpoints describe <endpoint-id> --region=<region>
gcloud ai endpoints list --list-model-garden-endpoints-only --region=<region>

# List custom jobs
gcloud ai custom-jobs list --region=<region>
gcloud ai custom-jobs describe <job-id> --region=<region>

# Stream logs from a running job
gcloud ai custom-jobs stream-logs <job-id> --region=<region>

# List hyperparameter tuning jobs
gcloud ai hp-tuning-jobs list --region=<region>
gcloud ai hp-tuning-jobs describe <job-id> --region=<region>

# List model monitoring jobs
gcloud ai model-monitoring-jobs list --region=<region>
gcloud ai model-monitoring-jobs describe <job-id> --region=<region>

# List Tensorboards
gcloud ai tensorboards list --region=<region>
gcloud ai tensorboards describe <tensorboard-id> --region=<region>

# List indexes (for vector search)
gcloud ai indexes list --region=<region>
gcloud ai indexes describe <index-id> --region=<region>

# List index endpoints
gcloud ai index-endpoints list --region=<region>
gcloud ai index-endpoints describe <index-endpoint-id> --region=<region>

# Get operations (long-running operations status)
gcloud ai operations describe <operation-id> --region=<region>

# Test endpoint predictions (if you have access)
gcloud ai endpoints predict <endpoint-id> \
--region=<region> \
--json-request=request.json

# Make direct predictions (newer API)
gcloud ai endpoints direct-predict <endpoint-id> \
--region=<region> \
--json-request=request.json

模型信息收集

# Get detailed model information including versions
gcloud ai models describe <model-id> --region=<region>

# Check specific model version
gcloud ai models describe <model-id>@<version> --region=<region>

# List all versions of a model
gcloud ai models list-version <model-id> --region=<region>

# Get model artifact location (usually a GCS bucket)
gcloud ai models describe <model-id> --region=<region> --format="value(artifactUri)"

# Get container image URI
gcloud ai models describe <model-id> --region=<region> --format="value(containerSpec.imageUri)"

端点详情

# Get endpoint details including deployed models
gcloud ai endpoints describe <endpoint-id> --region=<region>

# Get endpoint URL
gcloud ai endpoints describe <endpoint-id> --region=<region> --format="value(deployedModels[0].displayName)"

# Get service account used by endpoint
gcloud ai endpoints describe <endpoint-id> --region=<region> --format="value(deployedModels[0].serviceAccount)"

# Check traffic split between models
gcloud ai endpoints describe <endpoint-id> --region=<region> --format="value(trafficSplit)"

自定义 Job 信息

# Get job details including command, args, and service account
gcloud ai custom-jobs describe <job-id> --region=<region>

# Get service account used by job
gcloud ai custom-jobs describe <job-id> --region=<region> --format="value(jobSpec.workerPoolSpecs[0].serviceAccount)"

# Get container image used
gcloud ai custom-jobs describe <job-id> --region=<region> --format="value(jobSpec.workerPoolSpecs[0].containerSpec.imageUri)"

# Check environment variables (may contain secrets)
gcloud ai custom-jobs describe <job-id> --region=<region> --format="value(jobSpec.workerPoolSpecs[0].containerSpec.env)"

# Get network configuration
gcloud ai custom-jobs describe <job-id> --region=<region> --format="value(jobSpec.network)"

访问控制

# Note: IAM policies for individual Vertex AI resources are managed at the project level
# Check project-level permissions
gcloud projects get-iam-policy <project-id>

# Check service account permissions
gcloud iam service-accounts get-iam-policy <service-account-email>

# Check if endpoints allow unauthenticated access
# This is controlled by IAM bindings on the endpoint
gcloud projects get-iam-policy <project-id> \
--flatten="bindings[].members" \
--filter="bindings.role:aiplatform.user"

存储和工件

# Models and training jobs often store artifacts in GCS
# List buckets that might contain model artifacts
gsutil ls

# Common artifact locations:
# gs://<project>-aiplatform-<region>/
# gs://<project>-vertex-ai/
# gs://<custom-bucket>/vertex-ai/

# Download model artifacts if accessible
gsutil -m cp -r gs://<bucket>/path/to/artifacts ./artifacts/

# Check for notebooks in AI Platform Notebooks
gcloud notebooks instances list --location=<location>
gcloud notebooks instances describe <instance-name> --location=<location>

模型花园

# List Model Garden endpoints
gcloud ai endpoints list --list-model-garden-endpoints-only --region=<region>

# Model Garden models are often deployed with default configurations
# Check for publicly accessible endpoints

Privilege Escalation

在下面的页面中,您可以查看如何 abuse Vertex AI permissions to escalate privileges

GCP - Vertex AI Privesc

Post Exploitation

GCP - Vertex AI Post Exploitation

参考资料

Tip

学习并练习 AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking: HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks