SKILL.md
SKILL.mdBrowse 9 files
3,232 tokens
13,090 bytes
Token encoding: o200k_base
Snapshot 24fd22b
1---2name: web-pentest3description: "Authorized web pentest: recon, proof-based exploits, report."4version: 1.0.05author: Teknium (teknium1), Hermes Agent6license: MIT7platforms: [linux, macos]8category: security9triggers:10 - "pentest [URL]"11 - "pentest this app"12 - "penetration test [URL]"13 - "security test this web app"14 - "test [URL] for vulnerabilities"15 - "find vulns in [URL]"16 - "OWASP test [URL]"17toolsets:18 - terminal19 - web20 - browser21 - file22 - delegation23metadata:24 hermes:25 tags: [Security, Pentest, Web, Recon]26 related_skills: []27---28 29# Web Application Penetration Testing30 31A phased pentesting workflow for running web applications. Adapted from32Shannon's pipeline (Keygraph, AGPL — concepts only, no code borrowed).33Built around three rules:34 351. No exploit, no report — every finding requires reproducible evidence.362. Bounded scope — every active request goes against a target the operator37 pre-declared. Off-scope hosts are refused.383. Bypass exhaustion before false-positive dismissal — a "blocked" payload39 is not a clean bill of health until you've tried the bypass set.40 41---42 43## ⚠️ Hard Guardrails — Read Before Every Engagement44 45Violating any of these invalidates the engagement and may be illegal.46 471. **Authorization gate.** Before the first active scan in a session, you48 MUST confirm with the user, in writing, that they own or have written49 authorization to test the target. Record the acknowledgement in50 `engagement/authorization.md` (see template). No acknowledgement → no51 active scanning. Reading public pages with `curl` is fine; sending52 payloads is not.53 542. **Scope allowlist.** Maintain `engagement/scope.txt` — one hostname or55 CIDR per line. Every `nmap`, `curl`, `whatweb`, browser navigation, or56 payload-bearing request MUST be against an entry in scope. If a target57 redirects you off-scope (3xx to a different host, a link in HTML),58 STOP and confirm with the user before following.59 603. **No production systems without paper.** If the user hasn't told you61 "yes, prod is in scope and I have written sign-off," assume not. Default62 targets are staging, local docker, dedicated test instances.63 644. **Cloud metadata is off by default.** Do not probe `169.254.169.254`,65 `metadata.google.internal`, `100.100.100.200`, `[fd00:ec2::254]`, or66 equivalent unless the engagement explicitly includes SSRF-to-metadata67 as a goal AND the target is one you control. The agent's browser tool68 can reach these from inside your own infrastructure — don't.69 705. **Destructive payloads need approval.** SQLi payloads that DROP/DELETE,71 filesystem-write SSTI, command injection with `rm`/`shutdown`/`mkfs`,72 anything that mutates beyond a single test row → ASK FIRST. The73 `approval.py` system catches some; don't rely on it alone.74 756. **Aux-client leakage risk (Hermes-specific).** This skill produces76 sessions full of SQLi/XSS/RCE payloads, captured credentials, JWT77 tokens. Hermes' compression and title-generation paths replay history78 through the auxiliary client (often the main model). Anything sensitive79 you write to the conversation can leave the box on the next compress.80 Mitigation:81 - Redact captured tokens/credentials to the LAST 6 CHARS before logging82 them in any message. Full values go to `engagement/evidence/` files,83 never into chat history.84 - If the engagement is sensitive, set `auxiliary.title_generation.enabled: false`85 in `~/.hermes/config.yaml` for the session.86 877. **Rate limit yourself.** Default 200ms between active requests against88 any single host. The recon-scan.sh script enforces this. Don't bypass89 it without operator approval.90 918. **Authority of the report.** This skill produces a security92 assessment, not a "PASS." Even a clean run is "no exploitable issues93 FOUND in scope X within time T using methods Y" — not "the application94 is secure." Mirror that language in the report.95 96---97 98## Phase 0: Engagement Setup99 100Before any scanning happens, create the engagement directory and101authorization acknowledgement.102 103```bash104ENGAGEMENT=engagement-$(date +%Y%m%d-%H%M%S)105mkdir -p "$ENGAGEMENT"/{evidence,findings,reports}106cd "$ENGAGEMENT"107```108 1091. **Ask the user (verbatim):**110 > "Confirm: (a) the target URL is [X], (b) you own this application111 > or have written authorization to test it, and (c) the engagement112 > may run for up to [N] hours starting now. Reply 'authorized' to113 > proceed."114 1152. **Wait for explicit `authorized` response.** Any other answer means STOP.116 1173. **Record authorization** to `engagement/authorization.md` using the118 template in `templates/authorization.md`. Include:119 - Target URL(s) and IP(s)120 - Authorization basis (ownership / written authz from $name)121 - Engagement window122 - Out-of-scope items (production, third-party services, etc.)123 - Operator name (the user driving this session)124 1254. **Build scope.txt:**126 ```127 localhost128 127.0.0.1129 staging.example.com130 192.168.1.0/24 # internal lab only, with operator OK131 ```132 1335. **Read** `references/scope-enforcement.md` before issuing the first134 active request — that doc has the host-extraction rules you apply135 to every command/URL before it goes out.136 137---138 139## Phase 1: Pre-Recon (Code Analysis, optional)140 141Skip if no source access (black-box engagement).142 143If you have read access to the application source:144 1451. **Map the architecture** — framework, routing, middleware stack1462. **Inventory sinks** — every `execute(`, `os.system(`, `eval(`,147 template render, file read/write, redirect target1483. **Map auth** — session cookie vs JWT, OAuth flows, password reset,149 privileged endpoints1504. **Identify trust boundaries** — what's authenticated, what's not,151 what comes from `request.*`1525. **Backward taint** from each sink to a request source. Early-terminate153 when proper sanitization is found (parameterized queries, allowlists,154 `shlex.quote`, well-known escapers).155 156Output: `evidence/pre-recon.md` — architecture map, sink inventory,157suspected vulnerable code paths.158 159This is OFFLINE work. No traffic to the target.160 161---162 163## Phase 2: Recon (Live, Read-Only)164 165Maps the attack surface. All requests are GETs of public pages, no166payloads yet. Still scope-bounded.167 1681. **Verify scope.** Resolve every target hostname → IP. Confirm IPs are169 in scope (avoids the "DNS points somewhere unexpected" trap).170 1712. **Network surface** (only if scope permits port scanning):172 ```bash173 nmap -sT -T3 --top-ports 100 -oN evidence/nmap.txt $TARGET174 ```175 Use `-T3` (default), not `-T4/-T5`. Stealthier and avoids tripping176 IDS/IPS in shared environments.177 1783. **Tech fingerprint:**179 ```bash180 whatweb -v $TARGET_URL > evidence/whatweb.txt181 curl -sIk $TARGET_URL > evidence/headers.txt182 ```183 1844. **Endpoint discovery:**185 - Crawl the app with the browser tool (`browser_navigate`,186 `browser_get_images`, follow links).187 - Inspect `robots.txt`, `sitemap.xml`, `.well-known/*`.188 - Use the developer tools network panel via browser tool to capture189 XHR/fetch calls.190 1915. **Auth surface:** Identify login, registration, password reset,192 session cookie names, token formats. Do NOT send credentials yet —193 just observe.194 1956. **Correlate with pre-recon** (if you have source). For each196 `evidence/pre-recon.md` finding, mark whether the live surface197 confirms it's reachable.198 199Output: `evidence/recon.md` — endpoints, technologies, auth model,200input vectors.201 202---203 204## Phase 3: Vulnerability Analysis205 206One delegate_task per vulnerability class. Each agent reads207`evidence/recon.md` (+ `evidence/pre-recon.md` if present), produces208`findings/<class>-queue.json` using `templates/exploitation-queue.json`.209 210Use `delegate_task` with these focused subagents (parallel where possible):211 212| Class | Goal | Reference |213|-------|------|-----------|214| `injection` | SQLi, command, path traversal, SSTI, LFI/RFI, deserialization | `references/vuln-taxonomy.md` (slot types) |215| `xss` | Reflected, stored, DOM-based | `references/vuln-taxonomy.md` (render contexts) |216| `auth` | Login bypass, JWT confusion, session fixation, OAuth flaws | `references/exploitation-techniques.md` |217| `authz` | IDOR, vertical/horizontal escalation, business logic | `references/exploitation-techniques.md` |218| `ssrf` | Internal reachability, metadata, protocol smuggling | Skip metadata unless explicitly authorized |219| `infra` | Misconfig, info disclosure, default creds, exposed admin | `references/exploitation-techniques.md` |220 221Each queue entry has: id, vuln class, source (file:line if known),222endpoint, parameter, slot type, suspected defense, verdict223(`identified` / `partial` / `confirmed` / `critical`), witness payload,224confidence (0-1), notes.225 226The analysis phase doesn't send malicious payloads yet — it stages them.227The exploitation phase actually fires them.228 229---230 231## Phase 4: Exploitation (Proof-Based, Conditional)232 233Only run a sub-agent per class where the analysis queue has actionable234entries (`identified` or `partial`).235 236For each candidate:237 2381. **Pre-send check** — host in scope? auth gate satisfied? payload239 approved if destructive?2402. **Send the witness payload** — minimal proof. SQLi: `' AND 1=1--`241 then `' AND 1=2--`. XSS: a benign marker like242 `<svg/onload=console.log("HERMES-PENTEST-XSS")>`. Never `alert(1)` in243 stored XSS — it'll fire for other users in shared environments.2443. **Verify the witness fires** — for blind injection, use a sleep245 probe (`SLEEP(5)`) and time the response. For SSRF, use a246 tester-controlled callback host you own (NOT a public service like247 webhook.site for sensitive engagements — exfil paths).2484. **Promote level:**249 - **L1 Identified** — pattern matched, no behavior change250 - **L2 Partial** — sink reached, but defense in place251 - **L3 Confirmed** — payload changed app behavior in observable way252 - **L4 Critical** — data extracted, code executed, access escalated2535. **Bypass exhaustion before classifying as FP.** For each candidate254 that blocks: try at least the bypass set in255 `references/bypass-techniques.md` for that class. Only after the set256 is exhausted may you write `verdict: false_positive`.2576. **Record evidence** for every L3/L4:258 - Full request (method, URL, headers, body)259 - Response (status, headers, relevant body excerpt)260 - Reproducer command (curl one-liner)261 - Impact statement262 263Output: `findings/exploitation-evidence.md`264 265**Redact in evidence files:**266- Any captured credentials/tokens → last 6 chars only in chat;267 full value to `findings/secrets-vault.md` (gitignored).268- Other users' PII → redact.269- Your test credentials → fine to keep.270 271---272 273## Phase 5: Reporting274 275Generate the final report using `templates/pentest-report.md`. Sections:276 2771. Executive summary2782. Engagement scope (from `engagement/scope.txt`)2793. Authorization (from `engagement/authorization.md`)2804. Findings (L3/L4 only — proof-required). Per finding:281 - Title, severity (CVSS 3.1), CWE282 - Affected endpoint(s)283 - Proof (request + response excerpt)284 - Reproduction steps285 - Impact286 - Remediation2875. Not-exploited candidates (L1/L2 with notes on what blocked them)2886. Out-of-scope observations2897. Methodology / tools used2908. Limitations and what was NOT tested291 292**Severity policy:** CVSS only for L3/L4. L1/L2 are "candidates pending293verification" — don't assign CVSS to unverified findings.294 295---296 297## When to Stop298 299- The user revokes authorization.300- A candidate finding clearly impacts production data and you don't have301 approval for destructive testing — STOP and ask.302- The target starts returning 503/429 storms — back off, reconvene with303 the operator.304- You discover something *outside* the contracted scope (e.g. an exposed305 customer database while testing an unrelated endpoint). STOP, document,306 report to the operator. Do not pivot without explicit approval — that307 pivot is what makes pentesting illegal.308 309---310 311## What This Skill Does NOT Cover312 313- Network-layer pentesting beyond port scanning (no Metasploit,314 Cobalt Strike, AD attacks, network protocol fuzzing).315- Reverse engineering / binary analysis (see issue #383).316- Source-only static analysis (see issue #382).317- Active social engineering / phishing.318- Anything against systems the operator hasn't pre-authorized.319 320If the engagement needs any of these, escalate to a professional321pentester. This skill complements professional pentesting; it does322not replace it.323 324---325 326## Further Reading327 328- `references/scope-enforcement.md` — how to bound every active request329- `references/vuln-taxonomy.md` — slot types, render contexts, OWASP map330- `references/exploitation-techniques.md` — per-class payload patterns331- `references/bypass-techniques.md` — common WAF/filter bypasses332- `templates/authorization.md` — engagement authorization template333- `templates/pentest-report.md` — final report template334- `templates/exploitation-queue.json` — per-class finding queue schema335- `scripts/recon-scan.sh` — rate-limited nmap+whatweb+headers wrapper336 Discovery context
Discovered by repository scan. No exact path reference found in the snapshot’s root AGENTS.md.