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>
4.2 KiB
File Upload → RCE Chain Agent
User Prompt
You are executing a multi-stage ATTACK CHAIN against {target}: insecure file upload → webshell → remote code execution.
Recon Context / prior findings: {recon_json}
GOAL: Turn an unrestricted/insecure upload into 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. Probe the upload
- Map the endpoint: accepted extensions/MIME, max size, storage path, and HOW files are served back (same origin? CDN? rewritten name? download-only
Content-Disposition?). - Fingerprint the stack (recon): PHP/ASP(X)/JSP/Node determines the payload language and which bypass matters.
- Test bypasses systematically, ONE variable at a time:
- Double/alt extension:
shell.php.jpg,shell.phtml/.php5/.phar,shell.aspx;.jpg, case (.PhP). - Content-Type spoof: send
Content-Type: image/pngwith PHP bytes. - Magic-byte prefix: real
GIF89a;/PNG header then<?php ... ?>. - Null byte (legacy), trailing dot/space (Windows), path traversal in
filename(../). - Config drop:
.htaccess(AddType application/x-httpd-php .jpg) then a.jpgshell;web.configon IIS.
- Double/alt extension:
- DECISION POINTS: server-side extension allowlist vs blocklist (blocklist → find an unlisted exec ext); MIME-only check → magic-byte/CT bypass; image re-encoding (ImageMagick/GD) → needs a polyglot that survives, or target the processor itself.
- PROOF: an upload accepted (201/200 + stored path) despite carrying executable content.
- PITFALLS: an "accepted" upload stored OUTSIDE the webroot or served as
text/plainwon't execute — verify serving before claiming RCE; a sanitized/re-encoded image drops your payload.
Stage 2. Upload a payload
- Place a MINIMAL benign webshell/handler in a web-served, executable location: PHP
<?php system($_GET['c']); ?>, JSP/ASPX equivalent — parameterized so the command is passed at request time (kept benign). - Prefer a uniquely-named file (
nrsplt_<nonce>.php) so you can find and later note it for cleanup. - PROOF: the upload response + the exact stored filename/path.
Stage 3. Locate & trigger
- Find the served URL (from the response, a listing, or the known upload dir). Request it:
curl '{target}/uploads/nrsplt_<nonce>.php?c=id'. - If path is unknown, use recon/dir-brute of the upload dir (light).
- PROOF: the request URL that reaches the shell.
Stage 4. Confirm RCE
- Run a BENIGN command:
id/whoami/hostname,echo NRSPLT-<nonce>, or an OOB callback with the nonce. - CHAINING HOOKS: shell as the web user → host loot (
.env, keys), then LPE and cloud/lateral chains; note the uploaded artifact for post-engagement cleanup. - PROOF: the command output (
uid=... gid=...) or OOB nonce tied to THIS request. No output/callback ⇒ NOT proven; report up to the last proven stage.
5. Report Format
Report the chain as ONE finding (plus per-stage evidence):
FINDING:
- Title: File Upload → RCE Chain
- Severity: Critical
- CWE: CWE-434
- 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: Remote code execution via uploaded executable content
- Remediation: Validate type by content; randomize names; store outside webroot; non-exec 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. An accepted upload is not RCE until you prove the file is served AND executes; verify serving/exec before claiming it. Use a minimal, uniquely-named, parameterized shell, keep every command benign (a unique marker, a single read, an OOB ping), and note the artifact for cleanup. 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.