kazemcodes/skill-tree/cloud-security

Claude Code and agent skill by kazemcodes/skill-tree

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when assessing cloud infrastructure for security misconfigurations, IAM privilege escalation paths, S3 public exposure, open security group rules, or IaC security gaps. Covers AWS, Azure, and GCP posture assessment with MITRE ATT&CK mapping.

Install

npx vskill@latest install kazemcodes/skill-tree/cloud-security

SKILL.md

The same SKILL.md was published earlier as leoyeai/agent-master-skills/cloud-security.

Cloud Security

Cloud security posture assessment skill for detecting IAM privilege escalation, public storage exposure, network configuration risks, and infrastructure-as-code misconfigurations. This is NOT incident response for active cloud compromise (see incident-response) or application vulnerability scanning (see security-pen-testing) — this is about systematic cloud configuration analysis to prevent exploitation.


Table of Contents


Overview

What This Skill Does

This skill provides the methodology and tooling for cloud security posture management (CSPM) — systematically checking cloud configurations for misconfigurations that create exploitable attack surface. It covers IAM privilege escalation paths, storage public exposure, network over-permissioning, and infrastructure code security.

Distinction from Other Security Skills
SkillFocusApproach
cloud-security (this)Cloud configuration riskPreventive — assess before exploitation
incident-responseActive cloud incidentsReactive — triage confirmed cloud compromise
threat-detectionBehavioral anomaliesProactive — hunt for attacker activity in cloud logs
security-pen-testingApplication vulnerabilitiesOffensive — actively exploit found weaknesses
Prerequisites

Read access to IAM policy documents, S3 bucket configurations, and security group rules in JSON format. For continuous monitoring, integrate with cloud provider APIs (AWS Config, Azure Policy, GCP Security Command Center).


Cloud Posture Check Tool

The cloud_posture_check.py tool runs three types of checks: iam (privilege escalation), s3 (public access), and sg (network exposure). It auto-detects the check type from the config file structure or accepts explicit --check flags.

bash
# Analyze an IAM policy for privilege escalation paths
python3 scripts/cloud_posture_check.py policy.json --check iam --json
# Assess S3 bucket configuration for public access
python3 scripts/cloud_posture_check.py bucket_config.json --check s3 --json
# Check security group rules for open admin ports
python3 scripts/cloud_posture_check.py sg.json --check sg --json
# Run all checks with internet-facing severity bump
python3 scripts/cloud_posture_check.py config.json --check all \
--provider aws --severity-modifier internet-facing --json
# Regulated data context (bumps severity by one level for all findings)
python3 scripts/cloud_posture_check.py config.json --check all \
--severity-modifier regulated-data --json
# Pipe IAM policy from AWS CLI
aws iam get-policy-version --policy-arn arn:aws:iam::123456789012:policy/MyPolicy \
--version-id v1 | jq '.PolicyVersion.Document' | \
python3 scripts/cloud_posture_check.py - --check iam --json
Exit Codes
CodeMeaningRequired Action
0No high/critical findingsNo action required
1High-severity findingsRemediate within 24 hours
2Critical findingsRemediate immediately — escalate to incident-response if active

IAM Policy Analysis

IAM analysis detects privilege escalation paths, overprivileged grants, public principal exposure, and data exfiltration risk.

Privilege Escalation Patterns
PatternSeverityKey Action CombinationMITRE
Lambda PassRole escalationCriticaliam:PassRole + lambda:CreateFunctionT1078.004
EC2 instance profile abuseCriticaliam:PassRole + ec2:RunInstancesT1078.004
CloudFormation PassRoleCriticaliam:PassRole + cloudformation:CreateStackT1078.004
Self-attach policy escalationCriticaliam:AttachUserPolicy + sts:GetCallerIdentityT1484.001
Inline policy self-escalationCriticaliam:PutUserPolicy + sts:GetCallerIdentityT1484.001
Policy version backdoorCriticaliam:CreatePolicyVersion + iam:ListPoliciesT1484.001
Credential harvestingHighiam:CreateAccessKey + iam:ListUsersT1098.001
Group membership escalationHighiam:AddUserToGroup + iam:ListGroupsT1098
Password reset attackHighiam:UpdateLoginProfile + iam:ListUsersT1098
Service-level wildcardHighiam: or s3: or ec2:*T1078.004
IAM Finding Severity Guide
Finding TypeConditionSeverity
Full admin wildcardAction= Resource=Critical
Public principalPrincipal: '*'Critical
Dangerous action comboTwo-action escalation pathCritical
Individual priv-esc actionsOn wildcard resourceHigh
Data exfiltration actionss3:GetObject, secretsmanager:GetSecretValue on *High
Service wildcardservice:* actionHigh
Data actions on named resourceAppropriate scopeLow/Clean
Least Privilege Recommendations

For every critical or high finding, the tool outputs a least_privilege_suggestion field with specific remediation guidance:

  • Replace Action: * with a named list of required actions
  • Replace Resource: * with specific ARN patterns
  • Use AWS Access Analyzer to identify actually-used permissions
  • Separate dangerous action combinations into different roles with distinct trust policies

S3 Exposure Assessment

S3 assessment checks four dimensions: public access block configuration, bucket ACL, bucket policy principal exposure, and default encryption.

S3 Configuration Check Matrix
CheckFinding ConditionSeverity
Public access blockAny of four flags missing/falseHigh
Bucket ACLpublic-read-writeCritical
Bucket ACLpublic-read or authenticated-readHigh
Bucket policy Principal"Principal": "*" with AllowCritical
Default encryptionNo ServerSideEncryptionConfigurationHigh
Default encryptionNon-standard SSEAlgorithmMedium
No PublicAccessBlockConfigurationStatus unknownMedium
Recommended S3 Baseline Configuration
json
{
"PublicAccessBlockConfiguration": {
"BlockPublicAcls": true,
"BlockPublicPolicy": true,
"IgnorePublicAcls": true,
"RestrictPublicBuckets": true
},
"ServerSideEncryptionConfiguration": {
"Rules": [{
"ApplyServerSideEncryptionByDefault": {
"SSEAlgorithm": "aws:kms",
"KMSMasterKeyID": "arn:aws:kms:region:account:key/key-id"
},
"BucketKeyEnabled": true
}]
},
"ACL": "private"
}

All four public access block settings must be enabled at both the bucket level and the AWS account level. Account-level settings can be overridden by bucket-level settings if not both enforced.


Security Group Analysis

Security group analysis flags inbound rules that expose admin ports, database ports, or all traffic to internet CIDRs (0.0.0.0/0, ::/0).

Critical Port Exposure Rules
PortServiceFinding SeverityRemediation
22SSHCriticalRestrict to VPN CIDR or use AWS Systems Manager Session Manager
3389RDPCriticalRestrict to VPN CIDR or use AWS Fleet Manager
0–65535 (all)All trafficCriticalRemove rule; add specific required ports only
High-Risk Database Port Rules
PortServiceFinding SeverityRemediation
1433MSSQLHighAllow from application tier SG only — move to private subnet
3306MySQLHighAllow from application tier SG only — move to private subnet
5432PostgreSQLHighAllow from application tier SG only — move to private subnet
27017MongoDBHighAllow from application tier SG only — move to private subnet
6379RedisHighAllow from application tier SG only — move to private subnet
9200ElasticsearchHighAllow from application tier SG only — move to private subnet
Severity Modifiers

Use --severity-modifier internet-facing when the assessed resource is directly internet-accessible (load balancer, API gateway, public EC2). Use --severity-modifier regulated-data when the resource handles PCI, HIPAA, or GDPR-regulated data. Both modifiers bump each finding's severity by one level.


IaC Security Review

Infrastructure-as-code review catches configuration issues at definition time, before deployment.

IaC Check Matrix
ToolCheck TypesWhen to Run
TerraformResource-level checks (aws_s3_bucket_acl, aws_security_group, aws_iam_policy_document)Pre-plan, pre-apply, PR gate
CloudFormationTemplate property validation (PublicAccessBlockConfiguration, SecurityGroupIngress)Template lint, deploy gate
Kubernetes manifestsContainer privileges, network policies, secret exposurePR gate, admission controller
Helm chartsSame as KubernetesPR gate
Terraform IAM Policy Example — Finding vs. Clean
hcl
# BAD: Will generate critical findings
resource "aws_iam_policy" "bad_policy" {
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = "*"
Resource = "*"
}]
})
}
# GOOD: Least privilege
resource "aws_iam_policy" "good_policy" {
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = ["s3:GetObject", "s3:PutObject"]
Resource = "arn:aws:s3:::my-specific-bucket/*"
}]
})
}

Full CSPM check reference: references/cspm-checks.md


Cloud Provider Coverage Matrix

Check TypeAWSAzureGCP
IAM privilege escalationFull (IAM policies, trust policies, ESCALATION_COMBOS)Partial (RBAC assignments, service principal risks)Partial (IAM bindings, workload identity)
Storage public accessFull (S3 bucket policies, ACLs, public access block)Partial (Blob SAS tokens, container access levels)Partial (GCS bucket IAM, uniform bucket-level access)
Network exposureFull (Security Groups, NACLs, port-level analysis)Partial (NSG rules, inbound port analysis)Partial (Firewall rules, VPC firewall)
IaC scanningFull (Terraform, CloudFormation)Partial (ARM templates, Bicep)Partial (Deployment Manager)

Workflows

Workflow 1: Quick Posture Check (20 Minutes)

For a newly provisioned resource or pre-deployment review:

bash
# 1. Export IAM policy document
aws iam get-policy-version --policy-arn ARN --version-id v1 | \
jq '.PolicyVersion.Document' > policy.json
python3 scripts/cloud_posture_check.py policy.json --check iam --json
# 2. Check S3 bucket configuration
aws s3api get-bucket-acl --bucket my-bucket > acl.json
aws s3api get-public-access-block --bucket my-bucket >> bucket.json
python3 scripts/cloud_posture_check.py bucket.json --check s3 --json
# 3. Review security groups for open admin ports
aws ec2 describe-security-groups --group-ids sg-123456 | \
jq '.SecurityGroups[0]' > sg.json
python3 scripts/cloud_posture_check.py sg.json --check sg --json

Decision: Exit code 2 = block deployment and remediate. Exit code 1 = schedule remediation within 24 hours.

Workflow 2: Full Cloud Security Assessment (Multi-Day)

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
7-day trend score
3

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kazemcodes/skill-tree/cloud-security/badge)](https://verified-skill.com/skills/kazemcodes/skill-tree/cloud-security)

Something wrong with this skill or its page? Tell us.