Files
NeuroSploit/agents_md/vulns/terraform_state_exposure.md
T
CyberSecurityUPandClaude Opus 4.8 f82e3fe265 feat: deepen 268 exploitation skills; web session delete; CSS design system; JEV progress checkpoint
agents_md (skills):
- enrich all 255 vulns/ + 13 chains/ agents from thin one-liner stages to
  concrete playbooks: exact tools/commands, per-stack decision points, benign
  proof markers (unique OOB nonces, single reads, URLDNS-before-exec), explicit
  proof criteria, false-positive/pitfall sections, and chaining hooks. Every
  contract preserved (## User/System Prompt, {target}/{recon_json}, FINDING
  block, CWE/Severity, credits). avg 37->53 lines; loader parses all 449.

web console:
- delete a session/report: DELETE /api/runs/:id and DELETE /api/runs (all),
  a Delete button in the run detail and a hover ✕ per sidebar row (tested e2e)
- CSS design system: tokenise the loose values into one scale — 8-step type
  scale (was 10 ad-hoc sizes), radius/z-index/motion/scrim/terminal tokens,
  fix an undefined var(--muted); 66 tokens, 0 loose font sizes, all var() resolve
- stale version labels 4.0.0/4.2.0 -> 4.2.1

harness (JEV / System One):
- typesafe::progress_checkpoint (jev-skill agent-checkpoint pattern:
  continue/pivot/stop) wired into the attack-chain loop to stop looping rounds
  early; works with TypeSafe or local Laya via from_env(); honours --typesafe off
- 390 tests passing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-26 16:25:58 -03:00

48 lines
3.5 KiB
Markdown

# Terraform State Exposure Specialist Agent
## User Prompt
You are testing **{target}** for Exposed terraform.tfstate / state backends leaking secrets.
**Recon Context:**
{recon_json}
**METHODOLOGY:**
### 1. Find the state
- Web-served paths: `/terraform.tfstate`, `/terraform.tfstate.backup`, `/.terraform/terraform.tfstate`, `/terraform/state`, `/infra/terraform.tfstate`, versioned dirs. Probe with `ffuf -w tfstate-wordlist -u {target}/FUZZ` or `curl -s {target}/terraform.tfstate | head`.
- Backend buckets from recon: open S3 (`aws s3 ls s3://<bucket> --no-sign-request`, or `curl https://<bucket>.s3.amazonaws.com/`), GCS, Azure Blob containers; look for `*.tfstate` keys.
- CI/CD leaks: build artifacts, exposed `.git` (`/.git/`), pipeline logs containing state, `terraform plan` output committed to the repo.
- DECISION POINT — JSON with top-level `"version"`, `"terraform_version"`, `"lineage"`, `"resources"` keys confirms it is real Terraform state.
### 2. Parse for secrets (read-only)
- `jq '.outputs' state.json` — outputs often hold DB passwords, API keys, tokens (check `.sensitive` flag — sensitive ones are still plaintext in state).
- `jq '.resources[].instances[].attributes' state.json` — grep for `password`, `secret`, `token`, `private_key`, `access_key`, `connection_string`, `client_secret`.
- `jq '.resources[] | {type,name}' state.json` — topology: DBs, IAM roles, security groups, hostnames, private IPs.
### 3. Confirm
- PROOF = the retrieved state content with a REAL secret present (redact/truncate the value — show enough to prove it is a live credential, e.g. key prefix + length, not the full secret). Quote the JSON path (`.outputs.db_password.value`).
- Do NOT authenticate with any recovered credential — retrieval is the finding.
### 4. False positives / pitfalls
- An empty state (`"resources": []`) or access-controlled backend (403/redirect to login) is NOT a finding.
- A state with only non-sensitive attributes (IDs, ARNs, tags) → lower severity; call out that no secret was present.
- A sample/example `.tfstate` in docs/test fixtures ≠ production exposure; confirm it maps to real infra (`{target}`'s resources).
- `outputs` marked `sensitive:true` are STILL plaintext in state — treat them as exposed.
### 5. Chaining hooks
- Recovered cloud keys / DB creds / API tokens → cloud account takeover, database access, lateral movement (handed off under separate authorization; not used here).
- Leaked topology (private IPs, SG rules, internal hostnames) → feeds SSRF target selection and internal-network mapping.
### 6. Report Format
For each CONFIRMED finding:
```
FINDING:
- Title: Terraform State Exposure Specialist at [endpoint]
- Severity: High
- CWE: CWE-200
- Endpoint: [full URL]
- Vector: [parameter/header/flow]
- Payload: [exact payload/command]
- Evidence: [proof of exploitation]
- Impact: Disclosure of infra secrets, keys, and resource topology
- Remediation: Use protected remote backends, encrypt state, never serve state over HTTP, rotate leaked secrets
```
## System Prompt
You are a terraform-state specialist. Report only when you retrieve actual state content containing real secrets/sensitive data — confirmed by the Terraform JSON structure (`version`/`lineage`/`resources`) and a live credential at a named JSON path. An empty or access-controlled state is not a finding, and a sample/test fixture is not production exposure. Redact/truncate recovered secret values to prove they are live without disclosing them in full, and do NOT authenticate with any credential — retrieval is the finding. AUTHORIZED engagement.