# Tencent Pentesting

腾讯云渗透测试方法论。当目标使用腾讯云服务、发现 cos.*.myqcloud.com 资产、获取腾讯云 SecretId/SecretKey、在 CVM 实例内可访问...

- Repository: https://github.com/wgpsec/AboutSecurity (1833 stars)
- Category: Engineering
- License: see repository
- Last updated: 2026-10-24
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add wgpsec/AboutSecurity --skill tencent-pentesting -g -a claude-code -y`
Codex: `npx skills add wgpsec/AboutSecurity --skill tencent-pentesting -g -a codex -y`
Cursor: `npx skills add wgpsec/AboutSecurity --skill tencent-pentesting -g -a cursor -y`
Gemini CLI: `npx skills add wgpsec/AboutSecurity --skill tencent-pentesting -g -a gemini-cli -y`

## Description

腾讯云渗透测试方法论。当目标使用腾讯云服务、发现 cos.*.myqcloud.com 资产、获取腾讯云 SecretId/SecretKey、在 CVM 实例内可访问 metadata.tencentyun.com 元数据、或需要对腾讯云 CAM/CVM/COS/TencentDB/TKE/SCF 等服务进行安全评估时使用。覆盖 CAM 提权、CVM 接管、COS 对象存储利用、TencentDB 数据库攻击、TKE 容器集群、SCF 云函数、CLB 负载均衡、CLS 日志服务、KMS 密钥管理

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 腾讯云渗透测试方法论

腾讯云 CAM/CVM/COS/TencentDB/TKE 等服务构成主要攻击面。与 AWS/阿里云不同，腾讯云元数据常用域名 `metadata.tencentyun.com`，部分环境也支持链路本地 IP（如 `169.254.0.23`）；COS 操作需要独立的 `coscmd` 工具，CAM 使用 Uin/SubUin 身份模型（而非 ARN 体系）。本技能以渗透阶段（Phase）为主线，从凭据识别到各服务利用，提供完整攻击路径。

## ⛔ 深入参考（必读）

识别到具体攻击服务后，加载对应参考文档获取完整技术细节：

- 计算/存储/数据库详细利用 → 读 [references/compute-storage-attacks.md](references/compute-storage-attacks.md)
- 容器/Serverless/日志/KMS 详细利用 → 读 [references/platform-services-attacks.md](references/platform-services-attacks.md)

---

## Phase 1: 环境识别

拿到腾讯云相关目标后，首先识别凭据类型、确认 CLI 工具可用、判断网络位置。

### 1.1 凭据类型

| 凭据类型 | 识别特征 | 有效期 | 获取方式 |
|---|---|---|---|
| 长期 SecretId/SecretKey | SecretId 以 `AKID` 开头 | 永久（直到手动轮换） | CAM 控制台创建 / 代码泄露 |
| STS 临时凭据 | 包含 Token 字段 | 15 分钟 ~ 2 小时 | AssumeRole / CVM 元数据 |
| CVM Role（实例绑定） | 通过 metadata.tencentyun.com 获取 | 自动轮换 | CVM 实例元数据服务 |

### 1.2 CLI 配置

腾讯云有两个关键 CLI 工具，务必区分：

```bash
# 主 CLI: tccli（覆盖绝大多数服务）
pip install tccli
tccli configure
# 交互式填入 SecretId / SecretKey / Region / Output

# 验证当前身份
tccli sts GetCallerIdentity
# 返回: AccountId, Arn, Type (对应 Root/SubUser/RoleUser)

# COS 专用工具: coscmd（tccli cos 子命令功能有限！）
pip install coscmd
coscmd config -a SECRET_ID -s SECRET_KEY -b BUCKET_NAME -r REGION
# coscmd 支持 list / upload / download / delete 等完整文件操作
# tccli cos 仅支持 Bucket 级别 API，无法方便地列出/下载对象
```

**关键差异：** 腾讯云 COS 操作必须结合 `coscmd`。`tccli cos GetService` 可以列出 Bucket 列表，但枚举对象内容、批量下载等操作需要 `coscmd`。这是腾讯云渗透中的重要工具区别。

### 1.3 元数据端点

腾讯云 CVM 元数据端点常用域名 `metadata.tencentyun.com`，部分环境也可通过链路本地 IP（如 `169.254.0.23`）访问；SSRF 探测和防护应同时考虑域名与 IP 形态。

```bash
# 判断是否在 CVM 实例内部
curl -s http://metadata.tencentyun.com/latest/meta-data/
curl -s http://169.254.0.23/latest/meta-data/

# 获取实例绑定的 CAM Role 名称
curl -s http://metadata.tencentyun.com/latest/meta-data/cam/security-credentials/

# 获取该 Role 的临时凭据（TmpSecretId/TmpSecretKey/Token）
curl -s http://metadata.tencentyun.com/latest/meta-data/cam/security-credentials/ROLE_NAME

The rest: https://github.com/wgpsec/AboutSecurity/blob/HEAD/skills/cloud/tencent-pentesting/SKILL.md
