---
name: web-pentest
description: Authorized web pentest workflow — recon, proof-based exploitation, scoped reporting.
version: 1.0.0
author: Teknium (adapted for Xerxes)
platforms: [linux, macos, windows]
tags: [security, pentest, web, authorized-testing]
source: https://github.com/NousResearch/hermes-agent/tree/main/optional-skills/security/web-pentest
---

# Web Application Penetration Testing

A phased pentesting workflow for web applications you are **authorized**
to test. Built around three rules:

1. **No exploit, no report** — every finding requires reproducible
   evidence.
2. **Bounded scope** — every active request goes against a target the
   operator pre-declared; off-scope hosts are refused.
3. **Attempt-evasion exhaustion before false-positive dismissal** — a
   "blocked" payload is not a clean bill of health until the evasion
   set for that class has been tried.

## Hard guardrails — read before every engagement

1. **Authorization gate.** Before the first active scan, get written
   confirmation from the user that they own the target or have written
   authorization to test it. Record it in `engagement/authorization.md`
   (target URLs, authorization basis, engagement window, out-of-scope
   items, operator name). No acknowledgement → no active scanning.
   Reading public pages is fine; sending payloads is not.
2. **Scope allowlist.** Maintain `engagement/scope.txt` — one hostname
   or CIDR per line. Every `nmap`, `curl`, `whatweb`, browser
   navigation, or payload-bearing request MUST target an entry in
   scope. A redirect off-scope → stop and confirm before following.
3. **No production systems without paper.** Default targets are
   staging, local Docker, or dedicated test instances.
4. **Cloud metadata is off by default.** Do not probe
   `169.254.169.254`, `metadata.google.internal`, or equivalents unless
   SSRF-to-metadata is an explicit goal AND you control the target.
5. **Destructive payloads need approval.** SQLi that DROPs/DELETEs,
   filesystem-writing SSTI, destructive command injection — ask first.
6. **Redact secrets in chat.** Sessions contain captured tokens and
   credentials; log them last-6-chars-only in conversation, full values
   only in gitignored evidence files. Assume conversation content may
   be replayed through auxiliary model calls (compaction, titling).
7. **Rate-limit yourself.** ~200ms between active requests per host
   (e.g. wrap scans in a `sleep 0.2` loop). Don't remove it without
   operator approval.
8. **Authority of the report.** The output is a security assessment,
   not a "PASS". Even a clean run is "no exploitable issues FOUND in
   scope X within time T using methods Y".

## Phase 0 — Engagement setup

```bash
ENGAGEMENT=engagement-$(date +%Y%m%d-%H%M%S)
mkdir -p "$ENGAGEMENT"/evidence "$ENGAGEMENT"/findings "$ENGAGEMENT"/reports
```

Ask verbatim: "Confirm (a) the target URL is [X], (b) you own this
application or have written authorization to test it, (c) the
engagement may run up to [N] hours. Reply 'authorized' to proceed."
Any other answer means stop.

## Phase 1 — Pre-recon (offline, if you have source access)

Map framework/routing/middleware, inventory sinks (`execute(`,
`os.system(`, `eval(`, template renders, redirects), map auth (cookie
vs JWT, OAuth, password reset, privileged endpoints), and trace taint
from sources to sinks, stopping where proper sanitization exists
(parameterized queries, allowlists, shell escaping). Output:
`evidence/pre-recon.md`. No traffic to the target.

## Phase 2 — Recon (live, read-only)

1. Resolve every target hostname → IP and confirm IPs are in scope.
2. Port surface (if scope permits): `nmap -sT -T3 --top-ports 100 -oN
   evidence/nmap.txt $TARGET` — use `-T3`, not `-T4/-T5`.
3. Fingerprint: `whatweb -v $TARGET_URL`; capture headers with
   `curl -sIk`.
4. Endpoint discovery: crawl with the browser/fetch tools, read
   `robots.txt`, `sitemap.xml`, `.well-known/*`, capture XHR/fetch
   calls.
5. Auth surface: login/registration/reset endpoints, cookie names,
   token formats — observe only, send no credentials.
6. Correlate with pre-recon findings. Output: `evidence/recon.md`.

## Phase 3 — Vulnerability analysis (staging, not firing)

One subagent per vulnerability class (`injection`, `xss`, `auth`,
`authz`, `ssrf`, `infra`), each reading the recon evidence and
producing a findings queue: id, class, endpoint, parameter, suspected
defense, verdict (`identified`/`partial`/`confirmed`/`critical`),
witness payload, confidence. No malicious payloads are sent yet.

## Phase 4 — Exploitation (proof-based, conditional)

Only where the queue has actionable entries:

1. Pre-send check: host in scope? authorization recorded? destructive
   payload approved?
2. Send the minimal witness payload — SQLi: `' AND 1=1--` vs
   `' AND 1=2--`; XSS: a benign console-log marker, never `alert(1)`
   in stored XSS.
3. Verify the witness fires (blind SQLi: timed `SLEEP(5)`; SSRF: a
   callback host **you control**, not a public exfil service).
4. Promote levels: L1 identified → L2 partial (defense in place) → L3
   confirmed (behavior changed) → L4 critical (data extracted / code
   executed / access escalated).
5. **Evasion exhaustion before classifying a false positive**: try the
   standard filter-evasion set for that class (encoding variations,
   case tricks, alternative syntax) before writing
   `false_positive`.
6. Record full request, response excerpt, reproducer one-liner, and
   impact for every L3/L4. Redact third-party PII and captured secrets
   per guardrail 6.

## Phase 5 — Reporting

1. Executive summary
2. Scope (from `scope.txt`) and authorization
3. Findings (L3/L4 only): title, CVSS 3.1 severity, CWE, affected
   endpoints, proof, reproduction, impact, remediation
4. Not-exploited candidates (L1/L2, with what blocked them)
5. Out-of-scope observations, methodology, and what was NOT tested

CVSS only for L3/L4 — unverified candidates get no severity score.

## When to stop

- The user revokes authorization
- A candidate could impact production data and destructive testing is
  not approved — stop and ask
- Target returns 503/429 storms — back off, reconvene with the operator
- Something out of scope is discovered (e.g. an exposed customer
  database) — stop, document, report to the operator; do not pivot

## Not covered

Network-layer pentesting (Metasploit/AD attacks), reverse engineering,
social engineering, or anything against non-pre-authorized systems —
escalate to a professional pentester for those. This workflow
complements professional pentesting; it does not replace it.

## Verification

- [ ] `authorization.md` and `scope.txt` exist and predate the first
      active request
- [ ] Every L3/L4 finding has request + response evidence and a working
      reproducer
- [ ] No evidence file contains full captured credentials
- [ ] The report language matches guardrail 8 (found-in-scope, not
      "secure")

---

Adapted from the `web-pentest` skill in [NousResearch/hermes-agent](https://github.com/NousResearch/hermes-agent) (MIT License), copyright Teknium and Hermes Agent contributors.
