Security skill · Find and fix
IaC misconfiguration review.
Review infrastructure as code (Terraform, CloudFormation, Kubernetes manifests, Helm, Dockerfiles) for security misconfigurations such as public storage, open security groups, over-broad IAM, missing encryption, privileged containers, and exposed secrets, then fix and verify with policy checks. Use when auditing IaC or a pull request that changes cloud or cluster configuration.
Facts
- Category
- Find and fix
- License
- MIT
- Tags
- Misconfiguration
- Version
- 1.1.0
- Last updated
- 2026-12-02
- Folder
iac-misconfig-review/- MCP resource
skill://iac-misconfig-review/SKILL.md- Files
- SKILL.md
- LICENSE
- references/checks-by-platform.md
Original Saasment content. Saasment is in early access; this skill does not require joining it.
Install via MCP or as files
Connect your client to https://www.saasment.com/api/mcp (see client setup) and call get_skill:
{
"name": "get_skill",
"arguments": {
"slug": "iac-misconfig-review"
}
}Or download the .zip and unpack it into your agent's skills directory:
Terminal, from your project root (user-level: ~/.cursor/skills)
mkdir -p .cursor/skills
curl -fsSL https://www.saasment.com/ai-security/skills/iac-misconfig-review/download.zip -o /tmp/iac-misconfig-review.zip
unzip -o /tmp/iac-misconfig-review.zip -d .cursor/skills
# result: .cursor/skills/iac-misconfig-review/SKILL.mdReview SKILL.md before enabling a skill. Skills are instructions your agent will follow.
SKILL.md
--- name: iac-misconfig-review description: Review infrastructure as code (Terraform, CloudFormation, Kubernetes manifests, Helm, Dockerfiles) for security misconfigurations such as public storage, open security groups, over-broad IAM, missing encryption, privileged containers, and exposed secrets, then fix and verify with policy checks. Use when auditing IaC or a pull request that changes cloud or cluster configuration. license: MIT metadata: author: Saasment version: "1.1.0" category: both tags: "misconfiguration" --- # IaC misconfiguration review (find and fix) License: MIT. Copyright (c) 2026 Saasment. Source: https://www.saasment.com/ai-security/skills/iac-misconfig-review Infrastructure as code lets you catch risky configuration before it reaches a cloud account or cluster. Most findings come from a small set of patterns: data exposed to the internet, network paths opened wider than needed, permissions broader than needed, missing encryption and logging, and workloads running with more privilege than they need. This skill reviews IaC statically, fixes findings, and adds checks to CI. Scope: this is the general, resource-level pass that applies to any IaC language. Go deeper with the focused skills: `terraform-iac-security-review` for state, backends, providers, modules, and apply pipelines; `kubernetes-helm-manifest-review` for workload, RBAC, and network policy detail; `docker-image-security-review` for images and Dockerfiles; and `cloud-iam-storage-exposure-review` for live cloud accounts. ## When to use - You audit a repository of Terraform, OpenTofu, CloudFormation, Pulumi, Kubernetes YAML, Helm charts, or Dockerfiles. - A pull request changes security groups, IAM, storage, ingress, or container settings. - You want policy-as-code checks in CI. ## Safe by default - Only review IaC, and only run tools against accounts and clusters, that you own or are authorized to assess. - Review code statically first. Do not run `apply`, `deploy`, or `kubectl apply` against an account or cluster you do not own, and never against production without the normal change process. - Use `plan` or dry-run modes, and read the plan output for destructive changes before applying anything. - Run scanners locally or in CI. Do not upload IaC that contains secrets to third-party services without approval. - Do not hard-code credentials while fixing a finding. Use references to a secret manager or environment inputs. ## Procedure 1. **Inventory.** List the IaC languages, modules, environments (dev, staging, production), and the accounts or clusters they target. Include Dockerfiles, CI workflows, and Helm values. 2. **Run automated checks.** Use at least one policy scanner and validate syntax (see `references/checks-by-platform.md` for commands). Save results as machine-readable output. Treat the output as leads and confirm each in the code. 3. **Review high-risk areas manually**, in this order: - Storage and data: public buckets or blobs, public snapshots, databases reachable from the internet, missing encryption at rest and in transit, missing backups, missing versioning for critical data. - Network: security groups or firewall rules open to `0.0.0.0/0` or `::/0` on administrative ports (SSH 22, RDP 3389, databases) or on all ports, public IPs on internal services, missing network policies in Kubernetes. - Identity: wildcard actions or resources (`*`) in IAM policies, administrator roles attached to workloads, long-lived access keys, trust policies that allow any principal, missing MFA conditions for human roles. - Compute and containers: privileged containers, `hostNetwork`, `hostPath` mounts, running as root, missing resource limits, no read-only root filesystem, images pinned to `latest`, containers with the Docker socket mounted. - Secrets: plaintext credentials in variables, state files, user-data scripts, or `ENV` lines in Dockerfiles. Check where Terraform state is stored and who can read it. Use `secrets-in-repo-scan-and-rotation` when you find real ones. - Logging and detection: audit logging disabled, flow logs off, no alerting on administrative changes. - Metadata and SSRF exposure: instance metadata settings that allow token-less access (see `ssrf-find-and-fix`). 4. **Triage each finding.** Record resource, environment, exposure (internet-reachable or internal), data sensitivity, and whether it is intentional (for example, a deliberately public static website bucket). Record accepted risks with an owner and review date. 5. **Fix.** Make the smallest change that removes the risk: - Restrict ingress to specific CIDR ranges, VPN, or a bastion or SSM-style access path. - Replace wildcard permissions with specific actions and resource ARNs. Use conditions where useful. - Turn on encryption and block public access settings at the account or bucket level. - Set `runAsNonRoot`, drop capabilities, disallow privilege escalation, and use a read-only root filesystem for Kubernetes workloads. Pin images by digest or exact version. - Move secrets to a secret manager and reference them. 6. **Prevent regressions.** Add the scanner and `plan` review to CI, fail the build on high-severity findings, keep an ignore file with explanations and expiry dates, and add modules that set secure defaults so teams do not repeat the mistake. 7. **Review drift.** Compare IaC with the deployed environment using your cloud's configuration tools, because manual changes can reintroduce risk that the code no longer shows. ## Verification - Re-run the scanner and confirm the fixed findings are gone and no new high-severity findings were introduced. - Run `plan` or a dry run and confirm that the diff contains only the intended change, with no unintended replacement of stateful resources. - For network fixes, confirm from an allowed and a disallowed source that access behaves as designed (use test hosts you own). - For IAM fixes, confirm the workload still functions with the narrowed permissions in a non-production environment, and use access-analysis tooling from your cloud provider where available. - Confirm CI fails on a deliberately bad change in a scratch branch. ## Reporting Table: finding id, resource, environment, risk, fix or accepted risk (with owner and date), verification result. Note any drift from deployed state. ## References - CWE-16 (Configuration): https://cwe.mitre.org/data/definitions/16.html - CIS Benchmarks for cloud providers and Kubernetes: https://www.cisecurity.org/cis-benchmarks - Kubernetes Pod Security Standards: https://kubernetes.io/docs/concepts/security/pod-security-standards/ - Companion skills: `terraform-iac-security-review`, `kubernetes-helm-manifest-review`, `docker-image-security-review`, `cloud-iam-storage-exposure-review`, `secrets-in-repo-scan-and-rotation`, `ssrf-find-and-fix`, `agent-tool-permission-review`.
Helper files
LICENSE
MIT License Copyright (c) 2026 Saasment Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
references/checks-by-platform.md
# IaC checks by platform
License: MIT. Copyright (c) 2026 Saasment.
Tool flags change between versions. Check `--help` for your installed version. These commands read files locally.
## Scanner commands
```bash
# Checkov: scan a directory of IaC
checkov -d . --output json > /tmp/checkov.json
# Trivy: misconfiguration scan of IaC and Dockerfiles
trivy config .
# Terraform / OpenTofu: syntax and plan review (plan makes no changes)
terraform init -backend=false
terraform validate
terraform plan -out=/tmp/tfplan && terraform show -json /tmp/tfplan > /tmp/tfplan.json
# Kubernetes manifests: lint with kube-linter
kube-linter lint ./k8s
# Kubernetes: server-side dry run against a cluster you own
kubectl apply --dry-run=server -f ./k8s
# Dockerfile lint
hadolint Dockerfile
```
## Terraform / OpenTofu patterns
```hcl
# Risky: open SSH to the world
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
# Better: restrict to a known range or use a managed access path
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["203.0.113.0/24"] # documentation range; replace with your office or VPN range
}
# Risky: wildcard permissions
# actions = ["*"] resources = ["*"]
# Better: specific actions and resources
# actions = ["s3:GetObject"] resources = ["arn:aws:s3:::example-bucket/reports/*"]
# Storage: block public access and encrypt
resource "aws_s3_bucket_public_access_block" "example" {
bucket = aws_s3_bucket.example.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
```
Also check: Terraform state location and access, `user_data` secrets, database `publicly_accessible`, unencrypted volumes and snapshots, logging disabled, `metadata_options` allowing IMDSv1 (`http_tokens` should be `required`).
## CloudFormation patterns
- `AWS::S3::Bucket` without `PublicAccessBlockConfiguration` or `BucketEncryption`
- `AWS::EC2::SecurityGroup` ingress with `CidrIp: 0.0.0.0/0`
- `AWS::IAM::Policy` with `Action: "*"` or `Resource: "*"`
- `AWS::RDS::DBInstance` with `PubliclyAccessible: true`, no `StorageEncrypted`
## Kubernetes patterns
```yaml
# Risky
securityContext:
privileged: true
hostNetwork: true
volumes:
- name: docker
hostPath:
path: /var/run/docker.sock
# Safer baseline for a typical workload
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
resources:
requests: { cpu: "100m", memory: "128Mi" }
limits: { cpu: "500m", memory: "256Mi" }
```
Also check: `NetworkPolicy` default deny, service accounts with `automountServiceAccountToken` where not needed, `ClusterRoleBinding` to `cluster-admin`, secrets in `ConfigMap` or plain env values, images using `latest`, Ingress without TLS, exposed dashboards.
## Dockerfile patterns
- `USER root` or no `USER` instruction for the final stage
- `ADD` from remote URLs instead of `COPY` plus checksum verification
- Secrets in `ENV`, `ARG`, or copied files (`.env`, keys); use build secrets
- Base image pinned to `latest`; pin by version or digest and rebuild regularly
- Unneeded packages and tools in the runtime image (use a multi-stage build)
## CI workflow patterns
- Third-party actions or reusable workflows not pinned to a commit SHA
- `pull_request_target` with checkout of untrusted code
- Overly broad `permissions` for the workflow token (set the minimum, per job)
- Long-lived cloud credentials in repository secrets where OIDC is available
## Triage record
```text
Finding: id / rule name
Resource: path and resource address
Environment: dev / staging / production
Exposure: internet / internal
Data: none / internal / sensitive
Intentional: yes (reason) / no
Action: fix | accept (owner, expiry)
Verified: scan + plan + date
```
Related
Companion skills
Questions
How do I install the IaC misconfiguration review skill?
Download https://www.saasment.com/ai-security/skills/iac-misconfig-review/download.zip and unzip it into your agent's skills directory (for example .cursor/skills, .claude/skills, .agents/skills, or .github/skills) so that iac-misconfig-review/SKILL.md exists. Or connect to https://www.saasment.com/api/mcp and call the get_skill tool with the slug iac-misconfig-review.
What license is the IaC misconfiguration review skill under?
It is original Saasment content under the MIT license, stated in the SKILL.md frontmatter and in the LICENSE file in the skill folder.
Is it safe to run this skill?
A skill is a set of instructions your agent follows, so read SKILL.md first. It tells the agent to test only systems you own or are authorized to test, to use test environments and synthetic data, and to avoid destructive probes. Downloading it does not run any code on your machine.