Skip to content
Back to skills

Cloud Iam Audit

ASecurity

Cloud IAM audit: over-permissive roles, principal escalation

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
securitypythonrustgobashsqlawsgcpazure

Works with

  • cli

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 3 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add blackfoxxx/kestrel --skill cloud-iam-audit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cloud Iam Audit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cloud Iam Audit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/blackfoxxx-cloud-iam-audit/badge)](https://www.skillsdirectory.com/skills/blackfoxxx-cloud-iam-audit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cloud-iam-audit
description: "Cloud IAM audit: over-permissive roles, principal escalation"
metadata:
  tags: "cloud,iam,cam,audit,privilege,escalation,aws,azure,gcp,tencent,cloud-escalation,permissions,credentials,PassRole,SecretId"
  category: "cloud"
---

# Cloud IAM Permission Audit and Privilege Escalation Methodology

IAM/CAM permissions are attack surface — an overly permissive policy is more dangerous than an RCE vulnerability.

## Deep Reference (Required Reading)

- AWS 5 escalation paths with full commands, high-value data search, CloudTrail stealth → [references/aws-escalation.md](references/aws-escalation.md)
- Tencent Cloud CAM escalation paths, tccli/SDK commands, CloudAudit stealth → [references/tencent-cam-escalation.md](references/tencent-cam-escalation.md)

---

## Phase 1: Credential Identification and Identity Confirmation

| Credential | Format | Source |
|------------|--------|--------|
| AWS AK/SK | `AKIA...` (20 chars) | Config files, env vars, metadata |
| AWS Temporary | `ASIA...` + SessionToken | IMDS, STS AssumeRole |
| Azure SPN | client_id + client_secret + tenant_id | Config files |
| GCP SA Key | JSON file with `private_key` | Service account key file |
| Tencent Cloud SecretId/SecretKey | `AKIDz...` (36 chars) / `xxx=` (Base64) | Config files, env vars, metadata |
| Tencent Cloud Temporary | SecretId/SecretKey + Token/ExpiredTime | Metadata, STS AssumeRole |

```bash
# AWS: who am I
aws sts get-caller-identity

# Azure
az account show

# GCP
gcloud auth list

# Tencent Cloud: who am I (prefer tccli)
tccli sts GetCallerIdentity
# Or use 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())
"
```

### Tencent Cloud Credential Configuration

```bash
# Interactive tccli configuration (preferred)
tccli configure
# Input: SecretId, SecretKey, Region (e.g. ap-guangzhou), Output (json)

# For temporary credentials, also set Token
tccli configure set token "TOKEN_VALUE"

# Or via environment variables
export TENCENTCLOUD_SECRET_ID="AKIDz..."
export TENCENTCLOUD_SECRET_KEY="xxxx="
export TENCENTCLOUD_SESSION_TOKEN="TOKEN"  # for temporary credentials
```

---

## Phase 2: Permission Enumeration

### AWS Permission Enumeration
```bash
aws iam list-attached-user-policies --user-name <user>
aws iam list-attached-role-policies --role-name <role>
# Brute-force enumeration
aws s3 ls 2>&1; aws ec2 describe-instances 2>&1; aws iam list-users 2>&1
```

### Tencent Cloud CAM Permission Enumeration (tccli preferred)

```bash
# 1. Account overview
tccli cam GetAccountSummary

# 2. List sub-users
tccli cam ListUsers

# 3. List user groups
tccli cam ListGroups --Page 1 --Rp 50

# 4. List roles (critical — roles can be exploited via AssumeRole)
tccli cam DescribeRoleList --Page 1 --Rp 50

# 5. List policies (custom policies are key to escalation)
tccli cam ListPolicies --Scope Local --Page 1 --Rp 100   # custom policies only
tccli cam ListPolicies --Scope All --Page 1 --Rp 100      # all policies

# 6. View specific policy content
tccli cam GetPolicy --PolicyId <PolicyId> --PolicyVersion 1

# 7. View policies attached to a user
tccli cam ListAttachedUserPolicies --TargetUin <UIN>

# 8. View policies attached to a role
tccli cam ListAttachedRolePolicies --RoleId <RoleId>

# 9. View policies attached to a user group
tccli cam ListAttachedGroupPolicies --GroupId <GroupId>

# 10. List user AccessKeys
tccli cam ListAccessKeys

# 11. View role details (including Trust Policy — critical for cross-account attacks)
tccli cam GetRole --RoleId <RoleId>

# 12. View groups a user belongs to
tccli cam ListGroupsForUser --Uin <UIN>
```

### Tencent Cloud Brute-Force Enumeration (per-service probing)

```bash
# COS storage (tccli cos does not support GetService, use SDK or coscli)
coscli ls 2>&1
# Or Python SDK:
# pip install cos-python-sdk-v5
# from qcloud_cos import CosConfig, CosS3Client
# client = CosS3Client(CosConfig(Region='ap-guangzhou', SecretId='Sid', SecretKey='Skey'))
# print(client.list_buckets())

# CVM instances
tccli cvm DescribeInstances 2>&1

# SCF cloud functions (similar to Lambda escalation path)
tccli scf ListFunctions --Namespace default --Limit 50 2>&1

# CBS cloud disks
tccli cbs DescribeDisks 2>&1

# SSL certificates (may contain private keys)
tccli ssl DescribeCertificates --Limit 50 2>&1

# TDSQL/MySQL
tccli cdb DescribeDBInstances 2>&1

# Key Management (KMS)
tccli kms ListKeys --Limit 50 2>&1
```

### Permission Level Quick Reference
| Available Operations | Escalation Potential |
|---------------------|---------------------|
| GetCallerIdentity only | Low |
| cos:GetObject / s3:GetObject | Medium (may find more credentials) |
| cam:List*, cam:Get* / iam:List*, iam:Get* | Medium (can analyze escalation paths) |
| cam:CreateUser/AttachUserPolicy | **High** (direct escalation) |
| cam:CreateRole/AttachRolePolicy | **High** (create high-priv role) |
| cam:PassRole + scf:CreateFunction | **High** (indirect escalation — SCF with high-priv role) |
| sts:AssumeRole | **High** (jump to higher-priv role) |

---

## Phase 3: Escalation Decision Tree

```
Current permissions?
├─ Can operate IAM/CAM (CreatePolicy/AttachPolicy) → direct escalation
├─ Has PassRole + Lambda/SCF → indirect escalation (create service with high-priv role)
├─ Has AssumeRole → role chain hop
├─ Read-only data access → find more credentials (COS/S3/Secrets/Lambda/SCF code/User-Data)
└─ Detailed commands
    ├─ AWS → [references/aws-escalation.md](references/aws-escalation.md)
    └─ Tencent Cloud → [references/tencent-cam-escalation.md](references/tencent-cam-escalation.md)
```

## Notes
- Cloud credential escalation core: you can only escalate if you can operate **IAM/CAM itself**
- Temporary credentials have expiry — prioritize creating long-term AK/SK or a backdoor Access Key
- Cross-account Trust Policy is a critical audit point
- Tencent Cloud role Trust Policy format: `qcs::cam::uin/ROOT_UIN:uin/ANY_UIN`
- Tencent Cloud policy syntax is similar to AWS but uses `qcs` resource descriptors
- Operations produce CloudTrail/CloudAudit logs — be mindful of your footprint

## Escalation Path Overview
- **Direct escalation**: create policy granting yourself `*:*` permissions
- **Indirect escalation**: PassRole + SCF/Lambda function with high-priv role attached
- **Role chain**: current identity → AssumeRole → higher-priv role
- **Permission enumeration tools**: enumerate-iam, Pacu (AWS); custom scripts (Tencent Cloud)

Files in this skill

  • SKILL.md6.6 KB
  • references/aws-escalation.md2.4 KB
  • references/tencent-cam-escalation.md8.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.