跳到正文
FunCoding

playbook-cloud

Cloud IAM privesc paths and metadata endpoints per provider. Load when the target is cloud or you obtain cloud creds/metadata. Triggers - AWS/GCP/Azure, IAM, S3/blob, 169.254.169.254, access key.

Star
1,278
许可证
MIT
最近提交
2026年11月30日

skills/playbooks/cloud/SKILL.md

在 GitHub 上查看

Cloud — Privesc Paths & Metadata

Metadata endpoints (different per cloud!)

AWS IMDSv1 (no header): curl http://169.254.169.254/latest/meta-data/iam/security-credentials/ AWS IMDSv2 (requires token):

TOKEN=$(curl -X PUT -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" http://169.254.169.254/latest/api/token)
curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/

GCP (requires header): curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token Azure (requires header): curl -H "Metadata: true" "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/"

IMDSv1 vs v2 matters: v1 = any SSRF gives cloud creds. v2 requires PUT first (harder via SSRF).

AWS IAM privesc — dangerous permission combos

  • iam:CreatePolicyVersion → attach admin policy to self
  • iam:AttachUserPolicy → attach AdministratorAccess
  • lambda:CreateFunction + iam:PassRole → execute as privileged role
  • sts:AssumeRole → pivot to cross-account roles
  • ec2:RunInstances + iam:PassRole → launch instance with admin role Tools: pacu (automated), pmapper (permission graph)

GCP privesc

  • Default compute SA often has editor (overprivileged)
  • iam.serviceAccountKeys.create → generate key for any SA
  • cloudfunctions.functions.create + iam.serviceAccounts.actAs → RCE as SA
  • Check for allUsers/allAuthenticatedUsers bindings (public access)

Azure privesc

  • Managed Identity with broad role assignments
  • Contributor → deploy resources, potentially read Key Vault
  • App Registration with high API permissions + admin consent
  • Automation account runbooks → execute as automation identity

What to check everywhere

  • Public storage (S3/GCS/Blob) — --no-sign-request / anonymous
  • Secrets in repos / CI variables / build logs
  • User-data scripts (bootstrap credentials)
  • MFA not enforced on admin accounts
  • Audit logging disabled or misconfigured

Post-creds audit tools

  • AWS: pacu (exploitation framework, modular), pmapper (privesc graph)
  • Multi-cloud posture: scoutsuite (inventory + misconfig report per provider), prowler (AWS/GCP/Azure compliance checks, CIS benchmarks)
  • Run posture scan FIRST after getting creds — misconfig findings often beat privesc chains.

2024-2025 cloud-specific additions

AWS

  • IMDSv2 enforcement: Check aws ec2 describe-instances --query 'Reservations[].Instances[].MetadataOptions.HttpTokens' — required = v2 enforced, optional = v1 fallback possible.
  • IAM Condition keys bypass: aws:SourceVpce / aws:SourceVpc conditions can be bypassed if VPC endpoint allows. pacu module run iam__enum_permissions.
  • Lambda URL function URL auth bypass: FunctionUrlAuthType: NONE → public invoke. aws lambda list-function-url-configs.
  • STS AssumeRole chain: Cross-account role trust with sts:ExternalId missing → confusion. pacu module run iam__enum_roles.
  • EC2 Instance Metadata Service (IMDS) v1 disable check: aws ec2 describe-instances --filters Name=metadata-options.http-tokens,Values=optional.

GCP

  • Default Compute SA overprivilege: Default SA often Editor (primitive role) → roles/editor = storage.objects.*, compute.*, iam.serviceAccounts.actAs. Check gcloud projects get-iam-policy.
  • Workload Identity Federation misconfig: OIDC pool allows untrusted issuers → token impersonation. Check gcloud iam workload-identity-pools describe.
  • Cloud Functions / Cloud Run unauthenticated invoke: gcloud functions describe --region=... → httpsTrigger.ingressSettings / serviceConfig.ingress. Allow unauthenticated = public endpoint.
  • Secret Manager version access: secretmanager.versions.access on latest + IAM roles/secretmanager.secretAccessor → secrets.

Azure

  • Managed Identity with Contributor/Owner: az role assignment list --assignee <mi-principal-id> → broad assignments.
  • Key Vault purge protection / soft delete disabled: az keyvault show --name <kv> → enablePurgeProtection: false → secrets recoverable after delete.
  • App Service / Function App SCM (Kudu) exposure: scm.azurewebsites.net accessible → file read, env vars, console. az webapp config show --name <app> --resource-group <rg> --query scmType.
  • Azure Arc / Hybrid Identity: On-prem machines joined to Azure AD with excessive roles. az connectedmachine list.

Kubernetes (EKS/GKE/AKS)

  • Node IAM role overprivilege: EC2 NodeInstanceRole often has AmazonEKSWorkerNodePolicy + AmazonEC2ContainerRegistryReadOnly + AmazonEKS_CNI_Policy → can list all secrets in cluster. kubectl auth can-i get secrets --all-namespaces.
  • Admission webhook bypass: Mutating/Validating webhook timeout/failure open → kubectl apply --dry-run=server vs live.
  • Service Account token volume projection: kube-system SA tokens in pods → kubectl get sa -A -o jsonpath='{.items[*].secrets}'.
  • Cilium/Calico/NetworkPolicy misconfig: Default deny missing → lateral movement. kubectl get networkpolicy -A.

相似的 Skill

精选

internal-comms

写内部沟通文档,遵循公司格式,包括状态报告、领导更新和公司通讯。

ANanthropics/skills203k近 7 天新增 2,822 个 star

canary

GAgarrytan/gstack143k近 7 天新增 524 个 star

observability-and-instrumentation

ADaddyosmani/agent-skills122k近 7 天新增 1,421 个 star

精选

shipping-and-launch

上线前逐项检查,规划监控、分阶段发布和回滚方案。

ADaddyosmani/agent-skills122k近 7 天新增 1,421 个 star

paperclip-board

PApaperclipai/paperclip119k近 7 天新增 1,727 个 star

ruview-configure

RUruvnet/RuView106k近 7 天新增 596 个 star