Files
NeuroSploit/agents_md/chains/chain_exposed_git_to_rce.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.3 KiB

Exposed .git/.env → Secret → RCE Chain Agent

User Prompt

You are executing a multi-stage ATTACK CHAIN against {target}: exposed source/secrets → recovered credentials → authenticated RCE.

Recon Context / prior findings: {recon_json}

GOAL: Chain leaked source/secrets into authenticated code execution.

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. Recover the source/secrets

  • Confirm exposure first: curl -s {target}/.git/HEAD (expect ref: refs/heads/...), /.git/config, /.env, /.svn/, /.DS_Store, /config.php.bak, /backup.zip.
  • Dump a live .git: git-dumper {target}/.git/ ./loot (or GitTools/Dumper), then cd loot && git log -p, git stash list, git show.
  • Mine secrets from the tree and history: trufflehog filesystem ./loot, gitleaks detect --source ./loot, plus grep for password|secret|api[_-]?key|token|BEGIN .*PRIVATE KEY|aws_access_key_id.
  • DECISION POINTS: .env → DB/SMTP/cloud creds, APP_KEY/SECRET_KEY (Laravel/Django/Flask/Rails) → forge signed cookies/tokens; CI files (.gitlab-ci.yml, .github/workflows) → deploy tokens; wp-config.php, settings.py, application.yml.
  • PROOF: the raw file/commit bytes and the exact secret string (masked in the report).
  • PITFALLS: a directory-listing 200 with no objects is not a dumpable repo; placeholder/example values (CHANGEME, xxxx) are not live secrets; a .env.example is decoy.

Stage 2. Validate the secrets

  • Prove a recovered credential/key is LIVE against the authorized target only:
    • Cloud: aws sts get-caller-identity (or az/gcloud), stop at read-only enumeration.
    • DB: connect and run SELECT current_user/SELECT version().
    • App/CI: log into the admin panel, GitLab/GitHub PAT (curl -H "Authorization: Bearer <t>" .../user), SMTP auth handshake.
    • Framework key: forge a signed session/token and get an authenticated response.
  • PROOF: the auth-success response tying THIS key to access.

Stage 3. Gain execution

  • Turn validated access into code exec via a legitimate feature:
    • Framework key → deserialization/signed-object RCE (Laravel APP_KEY → decrypt/forge; Django/Flask secret → pickle/session gadget).
    • Admin panel → plugin/theme upload, template editor, task/cron feature.
    • CI/CD token → push a benign pipeline step that runs id; container registry.
    • DB creds → INTO OUTFILE webshell / COPY ... PROGRAM (see the SQLi chain).
  • Keep the command BENIGN: id, hostname, echo NRSPLT-<nonce>, or an OOB callback.
  • PROOF: the request that deployed/triggered the code.

Stage 4. Confirm RCE

  • Blind: OOB DNS/HTTP callback carrying the per-attempt <nonce>; correlate to THIS payload.
  • Interactive: id/whoami/hostname output reflected back.
  • CHAINING HOOKS: the shell + looted .env cloud/DB creds feed a cloud-compromise or DB-loot chain; a CI token pivots to the build fleet.
  • PROOF: raw request + raw callback/output with the nonce. No nonce ⇒ stage NOT proven; report up to the last proven stage.

5. Report Format

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

FINDING:
- Title: Exposed .git/.env → Secret → RCE Chain
- Severity: High
- CWE: CWE-527
- 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: Code execution using credentials recovered from exposed source/secrets
- Remediation: Block dotfiles from web; rotate leaked secrets; vault storage
- 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. A grep hit is a lead; a secret is proven only when it authenticates. Treat placeholder/example values as decoys and disprove them. Keep the exec payload benign (a unique marker, a single read, an OOB ping). 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; mask secrets/PII in the report. Each reported stage must carry its own evidence. Credits: Joas A Santos & Red Team Leaders.