viper-iac-terraform-audit
Skill22 starsChanged 16 days agoMITView on GitHub
Infrastructure-as-Code (Terraform, CloudFormation & Pulumi) Security Auditor (modeled on Checkov & tfsec). Reviews IAM least privilege, storage encryption, public buckets, and security groups.
In this repository72 other files it gives its agents.
- llms.txtllms.txt
- viper-agent-skill-supplychainSkill
- viper-ai-llm-guardrailsSkill
- viper-api-gateway-apigee-kongSkill
- viper-auth-oauth-jwtSkill
- viper-aws-iam-cloud-auditSkill
- viper-bola-idorSkill
- viper-browser-extension-mv3Skill
- viper-browseros-agentSkill
- viper-cicd-hardeningSkill
- viperclawSkill
- viper-container-k8s-auditSkill
- viper-crypto-tls-auditSkill
- viper-csrf-samesite-auditSkill
- viper-dependency-sbomSkill
- viper-deserialization-parserSkill
- viper-diff-pr-reviewSkill
- viper-dns-email-domainSkill
- viper-electron-tauri-desktopSkill
- viper-fastapi-django-flaskSkill
- viper-file-upload-storageSkill
- viper-gcp-azure-cloud-auditSkill
- viper-github-repo-governanceSkill
- viper-go-service-auditSkill
- viper-graphql-wsSkill
- viper-grpc-protobuf-auditSkill
- viper-headers-csp-corsSkill
- viper-incident-forensics-triageSkill
- viper-injection-oracleSkill
- viper-java-spring-auditSkill
- viper-js-harvesterSkill
- viper-kafka-rabbitmq-queueSkill
- viper-linux-systemd-hostSkill
- viper-logging-pii-complianceSkill
- viper-mcp-server-auditSkill
- viper-mobile-api-configSkill
- viper-multitenant-isolationSkill
- viper-nextjs-react-rscSkill
- viper-nginx-envoy-gatewaySkill
- viper-nodejs-express-nestjsSkill
- viper-oauth-oidc-complianceSkill
- viper-openapi-rest-schemaSkill
- viper-orchestratorSkill
- viper-payment-stripe-pciSkill
- viper-php-laravel-wordpressSkill
- viper-postgres-redis-mongoSkill
- viper-privacy-gdpr-hipaaSkill
- viper-proof-judgeSkill
- viper-proxy-fingerprintSkill
- viper-proxy-parser-alignmentSkill
- viper-race-logicSkill
- viper-rag-vector-auditSkill
- viper-rate-limit-dos-resilienceSkill
- viper-remediation-patch-verifierSkill
- viper-ruby-rails-auditSkill
- viper-rust-memory-unsafeSkill
- viper-saml-sso-enterpriseSkill
- viper-sbom-slsa-provenanceSkill
- viper-secrets-auditSkill
- viper-semgrep-rule-authorSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Run the following discovery commands across the target repository before manual code review:
- Distinctive: line 62
Verify whether an upstream API Gateway, global middleware, or ORM hook already enforces the control before flagging a controller.
- Distinctive: line 100
Write a Positive Unit Test confirming authorized, schema-valid requests succeed.
- Distinctive: line 101
Write a Negative Security Regression Test confirming unauthorized, cross-tenant, or malformed inputs are deterministically rejected.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill 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
Infrastructure-as-Code (Terraform, CloudFormation & Pulumi) Auditor (viper-iac-terraform-audit)
1. Executive Scope, Standards & CWE/OWASP Mapping
- Frameworks & Standards: Checkov / Trivy IaC / tfsec Rulesets, CIS Cloud Foundations Benchmarks, CWE-284, CWE-311
- Primary CWE Mapping: CWE-284 (Overly Permissive Security Groups / Public Buckets), CWE-311 (Missing Encryption of Sensitive Cloud Storage), CWE-798 (Plaintext Secrets in Terraform State)
- ViperClaw MCP Tools:
viper_taint_scan,viper_verify_and_report - ViperClaw CLI Command:
viperclaw taint ./terraform --db .viperclaw/graph.db
2. Threat Model & Root-Cause Architecture
flowchart LR
HCL["Terraform / CloudFormation Code"] --> Policy["Static Policy Check (IAM/Net/Crypto)"] --> State["Encrypted Remote State (KMS)"] --> Cloud["Hardened Cloud Infrastructure"]Root-Cause Analysis
IaC templates often copy quickstart defaults—setting 0.0.0.0/0 on security groups, omitting storage_encrypted = true on RDS/EBS, leaving S3 buckets without public access blocks, or storing plaintext secrets in unencrypted .tfstate files.
3. Deterministic Discovery & Grep/AST Audit Commands
Run the following discovery commands across the target repository before manual code review:
# 1. Automated ViperClaw analysis
viperclaw taint ./terraform --db .viperclaw/graph.db
# 2. Rapid static pattern discovery (ripgrep)
rg -n "cidr_blocks\s*=\s*\[.*0\.0\.0\.0/0" *.tf
rg -n "publicly_accessible\s*=\s*true|acl\s*=\s*.public-read." *.tf
rg -n "encrypted\s*=\s*false|storage_encrypted\s*=\s*false" *.tf4. Senior Security Engineer 8-Point Audit Checklist
| Control ID | Audit Verification Target | Pass Criteria | Fail / Vulnerability Indicator |
IAC-01 | Zero Wide-Open Admin/DB Ingress (0.0.0.0/0) | Security groups never allow 0.0.0.0/0 or ::/0 on SSH (22), RDP (3389), PostgreSQL (5432), MySQL (3306), Redis (6379), or K8s (6443). | Database or bastion security group open to 0.0.0.0/0. |
IAC-02 | Private Subnet Placement for Data Stores | aws_db_instance, ElastiCache, and OpenSearch set publicly_accessible = false inside private subnets. | publicly_accessible = true set on production RDS instance. |
IAC-03 | Encryption at Rest (KMS CMK) | encrypted = true / storage_encrypted = true enabled across EBS volumes, RDS, S3, DynamoDB, SQS, and SNS. | Unencrypted EBS snapshots or RDS storage. |
IAC-04 | Storage Bucket Public Access Lockdown | aws_s3_bucket_public_access_block sets all 4 block flags to true; acl = "public-read" forbidden. | Public S3/GCS bucket exposing backups, logs, or user uploads. |
IAC-05 | IAM Policy Wildcard Elimination | No IAM policy documents contain "Action": "*" and "Resource": "*". | Terraform provisioning administrative *:* roles for application workloads. |
IAC-06 | Terraform State Security & sensitive = true | Remote state backend (s3/gcs) enforces KMS encryption and locking; secret outputs mark sensitive = true. | Local terraform.tfstate committed to Git or stored in an unencrypted bucket. |
IAC-07 | VPC Flow Logs & CloudTrail Audit Logging | Multi-region CloudTrail with log file validation (enable_log_file_validation = true) and VPC Flow Logs enabled. | Cloud environment deployed without audit trail or network flow logging. |
IAC-08 | Deletion Protection & Backup Retention | Production databases and KMS keys enable deletion_protection = true and backup_retention_period >= 7. | Single terraform destroy or accidental drift can permanently wipe production databases. |
5. False-Positive Elimination & CVSS v3.1 Triage Rubric
False-Positive Gate
- Verify whether an upstream API Gateway, global middleware, or ORM hook already enforces the control before flagging a controller.
- Confirm the code path is reachable from an external entrypoint (not dead code, CLI-only admin script, or unit-test fixture).
| Severity Tier | Baseline CVSS v3.1 Vector | Qualifying Security Impact |
| CRITICAL (9.8) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | terraform.tfstate committed to repo or RDS/Redis exposed to 0.0.0.0/0 with publicly_accessible = true. |
| HIGH (7.5) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N | Publicly readable S3/GCS bucket or wildcard *:* IAM workload role. |
| MEDIUM (5.3) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N | Missing KMS encryption at rest on EBS/RDS or disabled CloudTrail log validation. |
6. Production Remediation Patterns (Vulnerable vs. Hardened Code)
# ❌ VULNERABLE: Publicly accessible unencrypted RDS instance
resource "aws_db_instance" "prod" {
engine = "postgres"
instance_class = "db.t4g.medium"
publicly_accessible = true
storage_encrypted = false
}
# ✅ HARDENED: Private subnet only, KMS encrypted, IAM DB auth & deletion protection enabled
resource "aws_db_instance" "prod" {
engine = "postgres"
instance_class = "db.t4g.medium"
publicly_accessible = false
storage_encrypted = true
kms_key_id = aws_kms_key.db.arn
iam_database_authentication_enabled = true
deletion_protection = true
backup_retention_period = 14
}7. Regression Testing & Continuous Verification
- Write a Positive Unit Test confirming authorized, schema-valid requests succeed.
- Write a Negative Security Regression Test confirming unauthorized, cross-tenant, or malformed inputs are deterministically rejected.
- Re-run
viperclaw taintandviperclaw verifyto confirm zero remaining unmitigated flows in.viperclaw/graph.db.
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.

