Back to skill

Security audit

Terraform Security Audit

Security checks for vulnerabilities and agentic risk

Overview

This skill is a purpose-aligned Terraform security auditing guide with expected scanner commands, but users should pin third-party dependencies and be careful with Terraform state data.

Install and run this only in an isolated development or CI environment, pin scanner packages and GitHub Actions to reviewed versions or commit SHAs, and treat Terraform plan/state outputs as sensitive because they may expose infrastructure details or secrets.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:31
Finding

Unpinned Checkov Package Installation Creates a Supply-Chain Risk

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Error
Location
SKILL.md:184
Finding

Checkov GitHub Action Uses a Mutable Master Branch Reference

Content
View full analysis
Remediation
View remediation
``` - Record the corresponding release version in a comment to preserve maintainability. - Use dependency automation to propose SHA updates through pull requests, and review changes before merging. - Configure restrictive workflow permissions, defaulting to read-only access: ```yaml permissions: contents: read ``` - Grant additional permissions only to jobs or steps that require them. - Avoid exposing unnecessary secrets to third-party actions. - Prefer ephemeral runners and apply network restrictions where feasible. - Enable branch protection and dependency-review controls for workflow changes. ]]>
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

The code substantially matches the core purpose of Terraform security auditing and does detect examples of the declared issue classes such as overly permissive IAM, public exposure, and missing encryption. However, the description specifically claims use of Checkov, tfsec, Terrascan, and OPA/Rego policies, while the implementation only invokes Checkov and tfsec plus a small custom plan scanner. There is no Terrascan execution and no OPA/Rego policy evaluation. This is a meaningful description-to-behavior mismatch because named scanning engines/policy mechanisms are undeclared in code rather than optional implementation details.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 70)May include surrounding context.

md
checkov -f tfplan.json --framework terraform_plan

# Skip specific checks
checkov -d ./terraform/ --skip-check CKV_AWS_145

# List all checks
checkov --list --framework terraform | grep CKV_AWS

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/api-reference.md (reported line 14)May include surrounding context.

md
checkov -f tfplan.json --framework terraform_plan

# Skip specific checks
checkov -d ./terraform/ --skip-check CKV_AWS_145

# List all checks
checkov --list --framework terraform | grep CKV_AWS

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill clearly includes shell commands and writes output files (for example redirecting scan results to JSON/SARIF files), but it does not declare any tool scope such as allowed-tools or permissions. That creates an execution-safety gap: an agent may be granted broader shell or file-write capability than reviewers expect, increasing the risk of unintended command execution or repository modification when the skill is invoked.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/agent.py (reported line 13)May include surrounding context.

python
def run_checkov(terraform_dir, output_format="json"):
    """Run Checkov static analysis on Terraform code."""
    cmd = ["checkov", "-d", terraform_dir, "--framework", "terraform", "--output", output_format, "--compact"]
    result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
    if output_format == "json":
        try:
            return json.loads(result.stdout)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/agent.py (reported line 25)May include surrounding context.

python
def run_checkov(terraform_dir, output_format="json"):
    """Run Checkov static analysis on Terraform code."""
    cmd = ["checkov", "-d", terraform_dir, "--framework", "terraform", "--output", output_format, "--compact"]
    result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
    if output_format == "json":
        try:
            return json.loads(result.stdout)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/agent.py (reported line 35)May include surrounding context.

python
def run_checkov(terraform_dir, output_format="json"):
    """Run Checkov static analysis on Terraform code."""
    cmd = ["checkov", "-d", terraform_dir, "--framework", "terraform", "--output", output_format, "--compact"]
    result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
    if output_format == "json":
        try:
            return json.loads(result.stdout)

Static analysis

No suspicious patterns detected.