iac-security-scan-skills
CLAUDE.md48 starsChanged 6 months agoMITView on GitHub
AI-powered infrastructure-as-code security assessment. Detects privilege escalation paths, internet exposure, secrets leaks, logging blind spots, serverless attack surfaces, and chained attack paths across AWS Terraform and CloudFormation codebases. The assessment runs in three steps: The iac-analysis skill maps the full repository: technology stack, environments, resource inventory, architecture patterns, internet exposure points, trust boundaries, and cross-account relationships. It writes its findings to iac-scan/analysis.md, including a File Routing table that maps each IaC file to the downstream skills that need it. All…
- Reads credentials
In this repository31 other files it gives its agents.
- AGENTS.mdAGENTS.md
- iac-analysisSkill
- iac-attack-chainSkill
- iac-fast-scanSkill
- iac-iamSkill
- iac-logging-monitoringSkill
- iac-networkSkill
- iac-reportSkill
- iac-secretsSkill
- iac-serverlessSkill
- iac-storageSkill
- iac-analysisSkill
- iac-attack-chainSkill
- iac-fast-scanSkill
- iac-iamSkill
- iac-logging-monitoringSkill
- iac-networkSkill
- iac-reportSkill
- iac-secretsSkill
- iac-serverlessSkill
- iac-storageSkill
- iac-analysisSkill
- iac-attack-chainSkill
- iac-fast-scanSkill
- iac-iamSkill
- iac-logging-monitoringSkill
- iac-networkSkill
- iac-reportSkill
- iac-secretsSkill
- iac-serverlessSkill
- iac-storageSkill
The file
We split this CLAUDE.md into the rules it gives an agent
11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 43
Read this file to understand the workflow
- Very specific: line 44
Create the iac-scan/ output directory
- Very specific: line 62
If iac-scan/ already has results from a previous scan, skip Steps 1 and 2:
- Distinctive: line 136
When running an individual skill:
- Very specific: line 137
If iac-scan/analysis.md already exists, reuse it (skip Step 1).
- Distinctive: line 140
No report is generated unless explicitly requested.
- Very specific: line 145
Skill relevance: After Step 1 completes, read the Recommended Skills table in iac-scan/analysis.md.
- Very specific: line 154
Confidence scoring: Every finding includes a confidence score (0.0–1.0).
- Very specific: line 168
Run only the specified domain skills (plus Step 1 analysis).
- Distinctive: line 172
When running a scoped scan:
- Distinctive: line 174
Only the listed domain skills run in Step 2.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
IaC Security Scanner
AI-powered infrastructure-as-code security assessment. Detects privilege escalation paths, internet exposure, secrets leaks, logging blind spots, serverless attack surfaces, and chained attack paths across AWS Terraform and CloudFormation codebases.
How It Works
The assessment runs in three steps:
Step 1 — Codebase Analysis
The iac-analysis skill maps the full repository: technology stack, environments, resource inventory, architecture patterns, internet exposure points, trust boundaries, and cross-account relationships. It writes its findings to iac-scan/analysis.md, including a File Routing table that maps each IaC file to the downstream skills that need it.
Step 2 — Security Analysis (parallel)
All 6 security analysis skills run in parallel as subagents. Each skill receives only the IaC files routed to it by the File Routing table in iac-scan/analysis.md, plus the analysis context. Each skill follows a multi-pass approach: first discovery/enumeration, then contextual reasoning, then attack path construction.
| Skill | Focus | Output |
iac-iam | IAM policies, privilege escalation, trust chains, PassRole abuse, cross-account trust | iac-scan/iam-results.md |
iac-network | VPC topology, security groups, public exposure, segmentation, egress analysis | iac-scan/network-results.md |
iac-storage | S3 buckets, RDS/DynamoDB, encryption, backup/DR, data classification, ransomware readiness | iac-scan/storage-results.md |
iac-secrets | Hardcoded credentials, state file risks, CI/CD secret exposure, env var secrets | iac-scan/secrets-results.md |
iac-logging-monitoring | CloudTrail gaps, GuardDuty coverage, detection blind spots, forensic readiness | iac-scan/logging-monitoring-results.md |
iac-serverless | Lambda exposure, API Gateway auth, event injection, denial-of-wallet, Function URLs | iac-scan/serverless-results.md |
Step 2.5 — Attack Chain Correlation
After all Step 2 skills complete, the iac-attack-chain skill reads all Step 2 results and constructs composite, cross-domain attack paths that no individual skill can see. It identifies internet-to-admin compromise paths, ransomware propagation chains, data exfiltration routes, and performs minimum-cut analysis to find the smallest set of fixes that breaks the most attack paths. Output: iac-scan/attack-chain-results.md.
Step 3 — Report Generation
The iac-report skill reads all results from Step 1, Step 2, and Step 2.5, then deduplicates, prioritizes, and outputs findings in three formats: terminal table (printed to stdout), CSV (iac-scan/findings.csv), and HTML (iac-scan/report.html).
Running the Assessment
Tell the agent:
Run IaC security scanThe agent will:
- Read this file to understand the workflow
- Create the
iac-scan/output directory - Execute Step 1, then Step 2 (parallel), then Step 3
- Print findings table to terminal and produce
iac-scan/report.html+iac-scan/findings.csv
Scanning a specific directory
Run IaC security scan on the terraform/ directoryRunning a single skill
Run the iac-iam skill on this repoRe-generating the report from existing results
If iac-scan/ already has results from a previous scan, skip Steps 1 and 2:
Generate security report from existing scan resultsFast scan (lite mode)
Run fast IaC scanFast mode uses a single combined skill definition (.claude/skills/iac-fast-scan/SKILL.md) instead of 9 separate skills. Read ONLY that one file and follow its instructions. Key differences:
- Single skill file (~200 lines vs ~7000 lines across 9 skills)
- Single pass — all domains analyzed together, no separate steps
- High and Critical only — skip Medium/Low/Info
- No attack chain correlation — report obvious compound risks inline
- No architecture diagram — architecture described in prose
- Output:
iac-scan/fast-results.md+iac-scan/fast-report.html - ~80-100K tokens vs ~250K+ for full scan
The fast scan is ideal for quick checks, PR reviews, or when token budget is limited. Run a full scan later for complete coverage.
Output Structure
iac-scan/
├── analysis.md # Step 1: repository intelligence
├── iam-results.md # Step 2: IAM findings
├── network-results.md # Step 2: network findings
├── storage-results.md # Step 2: storage findings
├── secrets-results.md # Step 2: secrets findings
├── logging-monitoring-results.md # Step 2: logging findings
├── serverless-results.md # Step 2: serverless findings
├── attack-chain-results.md # Step 2.5: cross-domain attack chains
├── findings.csv # Step 3: CSV export
├── report.html # Step 3: HTML report
└── architecture-diagram.html # Step 3: architecture visualization (if enough data)Skill Definitions
Each skill's full instructions live in .claude/skills/:
.claude/skills/
├── iac-analysis/SKILL.md
├── iac-iam/SKILL.md
├── iac-network/SKILL.md
├── iac-storage/SKILL.md
├── iac-secrets/SKILL.md
├── iac-logging-monitoring/SKILL.md
├── iac-serverless/SKILL.md
├── iac-attack-chain/SKILL.md
├── iac-report/SKILL.md
└── iac-fast-scan/SKILL.md # fast mode onlyIndividual Skill Commands
You can run individual skills instead of the full pipeline. Each command runs Step 1 (analysis) first if iac-scan/analysis.md does not exist, then runs only the specified skill.
| Command | What it runs |
Run IAM analyzer | iac-analysis → iac-iam → writes iac-scan/iam-results.md |
Run network analyzer | iac-analysis → iac-network → writes iac-scan/network-results.md |
Run storage analyzer | iac-analysis → iac-storage → writes iac-scan/storage-results.md |
Run secrets analyzer | iac-analysis → iac-secrets → writes iac-scan/secrets-results.md |
Run logging analyzer | iac-analysis → iac-logging-monitoring → writes iac-scan/logging-monitoring-results.md |
Run serverless analyzer | iac-analysis → iac-serverless → writes iac-scan/serverless-results.md |
Run attack chain analysis | Requires existing Step 2 results → iac-attack-chain → writes iac-scan/attack-chain-results.md |
Generate security report | Requires existing Step 2/2.5 results → iac-report → terminal table + iac-scan/report.html + iac-scan/findings.csv |
When running an individual skill:
- If
iac-scan/analysis.mdalready exists, reuse it (skip Step 1). - Apply file routing from
iac-scan/analysis.md— send only the relevant files to the skill. - The skill writes its results to
iac-scan/as usual. - No report is generated unless explicitly requested.
Orchestration Rules
- Step 1 must complete before Step 2. Domain skills depend on the analysis output.
- Skill relevance. After Step 1 completes, read the Recommended Skills table in
iac-scan/analysis.md. Skip any Step 2 skill marked asno— do NOT run skills that have no relevant resources in the repository. - File routing. For each relevant Step 2 skill, read the File Routing table in
iac-scan/analysis.md. Send each skill only the IaC files listed for it — do NOT send every file to every skill.iac-secretsfile scope: Full scan → all repo files (except binaries/vendor). Fast scan or scoped scan → only Secrets File List fromanalysis.md(IaC, CI/CD,.env*,*.tfstateflags — no.md,docs/,node_modules/).
- Compact analysis. Step 2 skills read
iac-scan/analysis.mdfor context (≤ 120 lines). Do not re-read full architecture JSON unless running attack-chain correlation. - Step 2 skills are independent. Try running them in parallel as subagents for speed. Fallback: if subagents fail (e.g., directory is not a git repository), run all Step 2 skills sequentially in the main process instead. The results are identical — only execution speed differs.
- Step 2.5 must wait for all Step 2 skills.
iac-attack-chainreads all Step 2 results to correlate cross-domain attack paths. - Step 3 must wait for Step 2.5. The report reads every
*-results.mdfile including attack chain results. - If a Step 2 skill fails, continue with the others. The report will note missing inputs.
- Each skill writes markdown, not raw JSON. Findings should be human-readable with structured sections for severity, confidence (0.0–1.0), evidence, and attack paths.
- Confidence scoring: Every finding includes a
confidencescore (0.0–1.0). Confirmed findings (direct IaC evidence) score ≥ 0.9. Inferred findings (heuristic, cross-module, unresolved references) score lower. The report uses confidence as a priority modifier — low-confidence speculative findings don't dominate the report. - Output compression: Skill outputs are consumed by downstream skills (attack-chain, report), so keep them compact. Rules:
- Each finding: max 8 lines (title, severity, confidence, evidence file:line, risk summary, related IDs). No verbose prose.
- Evidence: cite
file:line+ one-line snippet. Do not paste full resource blocks. - Attack paths: max 5 lines per path (narrative, steps as
A → B → C, break points). - Positive controls: bullet list, one line each.
- Target: each
*-results.mdshould be ≤ 150 lines. If a skill produces 20+ findings, group minor ones into a summary table instead of individual sections.
Scoped scan
Scan only IAM and networkRun only the specified domain skills (plus Step 1 analysis). Syntax: Scan only {skill1} and {skill2} or Scan only {skill1}, {skill2}, {skill3}.
Valid domain names: IAM, network, storage, secrets, logging, serverless.
When running a scoped scan:
- Step 1 runs as usual (analysis is always needed for file routing).
- Only the listed domain skills run in Step 2. All others are skipped regardless of the Recommended Skills table.
- Step 2.5 (attack chain) runs only if 2+ domain skills were selected — single-domain scans skip it.
- Step 3 (report) runs as usual, but only covers the domains that were scanned. The report notes which domains were excluded.
- File routing still applies — each selected skill receives only its relevant files.
iac-secretsuses Secrets File List fromanalysis.md(not all files).
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
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.

