Skills

Cloud Iam Audit

云 IAM 权限审计与提权。当获取了云平台凭据(AWS AK/SK、Azure SPN、GCP SA、腾讯云...

Install

npx skills add wgpsec/AboutSecurity --skill cloud-iam-audit -g -a claude-code -y
Repository
wgpsec/AboutSecurity1.8k
Category
DevOps
Updated
11d ago
License
See repository
Context cost
Lightabout 1,124 tokens
Runs scripts
No, instructions only

What it does

云 IAM 权限审计与提权。当获取了云平台凭据(AWS AK/SK、Azure SPN、GCP SA、腾讯云 SecretId/SecretKey)需要评估权限范围和提权路径时使用。覆盖 AWS/Azure/GCP/腾讯云的 IAM/CAM 策略分析、常见提权路径(PassRole、AssumeRole、Lambda/SCF 提权)、跨账号攻击、CloudTrail/CloudAudit 规避。发现任何云凭据、AK/SK、SecretId/SecretKey 时都应使用此技能

云 IAM 权限审计与提权方法论

IAM/CAM 权限就是攻击面, , 一个过度授权的策略比一个 RCE 漏洞更危险。

⛔ 深入参考(必读)


Phase 1: 凭据识别与身份确认

凭据格式来源
AWS AK/SKAKIA... (20字符)配置文件、环境变量、元数据
AWS 临时凭据ASIA... + SessionTokenIMDS、STS AssumeRole
Azure SPNclient_id + client_secret + tenant_id配置文件
GCP SA KeyJSON 文件含 private_key服务账号密钥文件
腾讯云 SecretId/SecretKeyAKIDz... (36字符) / xxx= (Base64)配置文件、环境变量、元数据
腾讯云临时凭据SecretId/SecretKey + Token/ExpiredTime元数据、STS AssumeRole
# AWS: 我是谁
aws sts get-caller-identity

# Azure
az account show

# GCP
gcloud auth list

# 腾讯云: 我是谁(优先使用 tccli)
tccli sts GetCallerIdentity
# 或使用 SDK
python3 -c "
from tencentcloud.sts.v20180813 import sts_client, models
from tencentcloud.common import credential
cred = credential.Credential('SecretId', 'SecretKey')
client = sts_client.StsClient(cred, 'ap-guangzhou')
print(client.GetCallerIdentity(models.GetCallerIdentityRequest()).to_json_string())
"

腾讯云凭据配置

# 交互式配置 tccli(优先)
tccli configure
# 输入: SecretId, SecretKey, Region(如 ap-guangzhou), Output(json)

# 使用临时凭据时需额外设置 Token
tccli configure set token "TOKEN_VALUE"

# 也可通过环境变量设置
export TENCENTCLOUD_SECRET_ID="AKIDz..."
export TENCENTCLOUD_SECRET_KEY="xxxx="
export TENCENTCLOUD_SESSION_TOKEN="TOKEN"  # 临时凭据时

Phase 2: 权限枚举

AWS 权限枚举

aws iam list-attached-user-policies --user-name <user>
aws iam list-attached-role-policies --role-name <role>
# 暴力枚举
aws s3 ls 2>&1; aws ec2 describe-instances 2>&1; aws iam list-users 2>&1

腾讯云 CAM 权限枚举(tccli 优先)

# 1. 账户概览
tccli cam GetAccountSummary

# 2. 列出子用户
tccli cam ListUsers

# 3. 列出用户组
tccli cam ListGroups --Page 1 --Rp 50
Read the whole SKILL.md on GitHub

More in DevOps