agentleFS
fatihkanfatihkan/badi/.claude/skills-vault/pentest-cloud/SKILL.md

pentest-cloud

Skill8 starsChanged 3 months agoMITView on GitHub

Cloud security pentest — AWS/Azure/GCP IAM analysis, lateral path, container escape pattern, serverless abuse advisory. Triggers on cloud pentest, AWS, Azure, GCP, IAM, S3 misconfig, EC2 metadata, Azure AD, GCP IAM, Pacu, ScoutSuite, Prowler, CloudGoat.

The file

Files
SKILL.md

pentest-cloud

AWS / Azure / GCP pentest methodology. IAM lateral path, public asset enum, container escape pattern.

Triggers

  • "AWS pentest"
  • "Azure AD test"
  • "GCP IAM enum"
  • "S3 public bucket"
  • "EC2 metadata abuse"
  • "IMDSv2 bypass"
  • "Pacu / ScoutSuite / Prowler usage"

Cloud-Provider Specific

AWS

Attack SurfaceTest
S3 public read/writeaws s3 ls s3://<bucket> --no-sign-request
EC2 IMDSv1curl http://169.254.169.254/latest/meta-data/iam/security-credentials/
Lambda env leakLambda invoke + env var dump
IAM privilege esciam:CreateAccessKey, iam:AttachUserPolicy, sts:AssumeRole
CloudTrail bypasssts:GetSessionToken (logged as user, not source)
Misconfigured IAM* action on * resource
Cross-account rolesexternal Principal "arn:aws:iam::OTHER:root"
Resource policyS3 bucket policy with "Principal": "*"
SSM RunCommandEC2 to OS via SSM session manager

Azure

Attack SurfaceTest
Anonymous storage containerhttps://<acc>.blob.core.windows.net/<container>?restype=container&comp=list
Azure AD enumerationUserList API anonymous
Service Principal abuseExcessive RBAC role assignment
Managed IdentityVM -> token endpoint -> assume role
Azure DevOps PATRepo scan for PAT in code
Key VaultRBAC misconfig, public access

GCP

Attack SurfaceTest
GCS public bucketgsutil ls gs://<bucket> (no auth)
Compute metadatacurl http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token -H "Metadata-Flavor: Google"
IAM lateraliam.serviceAccounts.actAs, iam.roles.update
GKE containerRBAC misconfig + IMDS reach

Recommended Commands

# QUIET — AWS misconfig audit (read-only IAM)
prowler aws --profile <profile> --severity high,critical

# QUIET — ScoutSuite multi-cloud audit
scout aws --profile <profile> --report-dir ./scout-report

# MODERATE — Pacu enumeration (Pacu CLI)
# Pacu is tied to its db; --modules for specific recon

# MODERATE — Azure recon
roadtools roadrecon auth --device-code
roadtools roadrecon gather

# MODERATE — GCP enum (enumerates the whole project, careful)
gcloud projects list
gcloud iam service-accounts list --project=<project>

IAM Privilege Escalation Patterns

AWS PrivEsc (common 25):

1. iam:CreateAccessKey on another user
2. iam:CreateLoginProfile on another user
3. iam:UpdateLoginProfile on another user
4. iam:AttachUserPolicy + ManagedPolicy AdministratorAccess
5. iam:AttachGroupPolicy
6. iam:AttachRolePolicy
7. iam:PutUserPolicy (inline policy)
8. iam:PutGroupPolicy
9. iam:PutRolePolicy
10. iam:AddUserToGroup
11. iam:UpdateAssumeRolePolicy
12. iam:PassRole + service action (lambda, ec2)
13. sts:AssumeRole (broad principal)
14. lambda:UpdateFunctionCode + lambda:InvokeFunction
15. lambda:CreateFunction + iam:PassRole
... (automated with Pacu modules)

Container Escape (K8s)

# QUIET — pod RBAC check (kubectl in pod)
kubectl auth can-i --list

# Pod escape signal:
# - hostPID: true
# - hostNetwork: true
# - privileged: true
# - hostPath mount /
# - Capabilities: SYS_ADMIN, SYS_PTRACE

# Service account token
cat /var/run/secrets/kubernetes.io/serviceaccount/token

# IMDSv1 reach from pod
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/

Output Template

## Cloud Pentest — <account>

### IAM Path
- User: dev-readonly
- Excessive: iam:UpdateAssumeRolePolicy on role "prod-admin"
- Path: dev-readonly -> update trust policy -> sts:AssumeRole prod-admin -> *
- Time-to-DA: 2 minutes

### Public Asset
- S3 bucket "company-backups" — anonymous list + read (1.2TB exposure)
- 3 prod EC2 instances IMDSv1 only -> SSRF chain risk

### Defensive Recommendations
- IAM policy review: iam:* actions only for the break-glass account
- S3 bucket policy: Principal "*" forbidden (block public access at account level)
- EC2 metadata: IMDSv2 required (hop limit 1)

Out-of-Scope

  • Deleting / writing production data
  • Creating resources (careful not to incur cost — engagement cost limit)
  • 3rd party services (Stripe, SendGrid) — out-of-scope by default

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.