Web Application Penetration Testing
A phased pentesting workflow for running web applications.
Built around three rules:
- No exploit, no report — every finding requires reproducible evidence.
- Bounded scope — every active request goes against a target the operator
pre-declared. Off-scope hosts are refused.
- Bypass exhaustion before false-positive dismissal — a "blocked" payload
is not a clean bill of health until you've tried the bypass set.
⚠️ Hard Guardrails — Read Before Every Engagement
Violating any of these invalidates the engagement and may be illegal.
Authorization gate. Before the first active scan in a session, you
MUST confirm with the user, in writing, that they own or have written
authorization to test the target. Record the acknowledgement in
engagement/authorization.md (see template). No acknowledgement → no
active scanning. Reading public pages with curl is fine; sending
payloads is not.
Scope allowlist. Maintain engagement/scope.txt — one hostname or
CIDR per line. Every nmap, curl, whatweb, browser navigation, or
payload-bearing request MUST be against an entry in scope. If a target
redirects you off-scope (3xx to a different host, a link in HTML),
STOP and confirm with the user before following.
No production systems without paper. If the user hasn't told you
"yes, prod is in scope and I have written sign-off," assume not. Default
targets are staging, local docker, dedicated test instances.
Cloud metadata is off by default. Do not probe 169.254.169.254,
metadata.google.internal, 100.100.100.200, [fd00:ec2::254], or
equivalent unless the engagement explicitly includes SSRF-to-metadata
as a goal AND the target is one you control. The agent's browser tool
can reach these from inside your own infrastructure — don't.
Destructive payloads need approval. SQLi payloads that DROP/DELETE,
filesystem-write SSTI, command injection with rm/shutdown/mkfs,
anything that mutates beyond a single test row → ASK FIRST. The
approval.py system catches some; don't rely on it alone.
Aux-client leakage risk. This skill produces sessions full of SQLi/XSS/RCE
payloads, captured credentials, and JWT tokens. Anything sensitive you write to
the conversation can be replayed in context compression passes.
Mitigation:
- Redact captured tokens/credentials to the LAST 6 CHARS before logging
them in any message. Full values go to
engagement/evidence/ files,
never into chat history.
Rate limit yourself. Default 200ms between active requests against
any single host. The recon-scan.sh script enforces this. Don't bypass
it without operator approval.
Authority of the report. This skill produces a security
assessment, not a "PASS." Even a clean run is "no exploitable issues
FOUND in scope X within time T using methods Y" — not "the application
is secure." Mirror that language in the report.
Phase 0: Engagement Setup
Before any scanning happens, create the engagement directory and
authorization acknowledgement.
ENGAGEMENT=engagement-$(date +%Y%m%d-%H%M%S)
mkdir -p "$ENGAGEMENT"/{evidence,findings,reports}
cd "$ENGAGEMENT"
Ask the user (verbatim):
"Confirm: (a) the target URL is [X], (b) you own this application
or have written authorization to test it, and (c) the engagement
may run for up to [N] hours starting now. Reply 'authorized' to
proceed."
Wait for explicit authorized response. Any other answer means STOP.
Record authorization to engagement/authorization.md using the
template in templates/authorization.md. Include:
- Target URL(s) and IP(s)
- Authorization basis (ownership / written authz from $name)
- Engagement window
- Out-of-scope items (production, third-party services, etc.)
- Operator name (the user driving this session)
Build scope.txt:
localhost
127.0.0.1
staging.example.com
192.168.1.0/24 # internal lab only, with operator OK
Read references/scope-enforcement.md before issuing the first
active request — that doc has the host-extraction rules you apply
to every command/URL before it goes out.
Phase 1: Pre-Recon (Code Analysis, optional)
Skip if no source access (black-box engagement).
If you have read access to the application source:
- Map the architecture — framework, routing, middleware stack
- Inventory sinks — every
execute(, os.system(, eval(,
template render, file read/write, redirect target
- Map auth — session cookie vs JWT, OAuth flows, password reset,
privileged endpoints
- Identify trust boundaries — what's authenticated, what's not,
what comes from
request.*
- Backward taint from each sink to a request source. Early-terminate
when proper sanitization is found (parameterized queries, allowlists,
shlex.quote, well-known escapers).
Output: evidence/pre-recon.md — architecture map, sink inventory,
suspected vulnerable code paths.
This is OFFLINE work. No traffic to the target.
Phase 2: Recon (Live, Read-Only)
Maps the attack surface. All requests are GETs of public pages, no
payloads yet. Still scope-bounded.
Verify scope. Resolve every target hostname → IP. Confirm IPs are
in scope (avoids the "DNS points somewhere unexpected" trap).
Network surface (only if scope permits port scanning):
nmap -sT -T3 --top-ports 100 -oN evidence/nmap.txt $TARGET
Use -T3 (default), not -T4/-T5. Stealthier and avoids tripping
IDS/IPS in shared environments.
Tech fingerprint:
whatweb -v $TARGET_URL > evidence/whatweb.txt
curl -sIk $TARGET_URL > evidence/headers.txt
Endpoint discovery:
- Crawl the app with the browser tool (
browser_navigate,
browser_get_images, follow links).
- Inspect
robots.txt, sitemap.xml, .well-known/*.
- Use the developer tools network panel via browser tool to capture
XHR/fetch calls.
Auth surface: Identify login, registration, password reset,
session cookie names, token formats. Do NOT send credentials yet —
just observe.
Correlate with pre-recon (if you have source). For each
evidence/pre-recon.md finding, mark whether the live surface
confirms it's reachable.
Output: evidence/recon.md — endpoints, technologies, auth model,
input vectors.
Phase 3: Vulnerability Analysis
One Agent per vulnerability class. Each agent reads
evidence/recon.md (+ evidence/pre-recon.md if present), produces
findings/<class>-queue.json using templates/exploitation-queue.json.
Use Agent with these focused subagents (parallel where possible):
| Class |
Goal |
Reference |
injection |
SQLi, command, path traversal, SSTI, LFI/RFI, deserialization |
references/vuln-taxonomy.md (slot types) |
xss |
Reflected, stored, DOM-based |
references/vuln-taxonomy.md (render contexts) |
auth |
Login bypass, JWT confusion, session fixation, OAuth flaws |
references/exploitation-techniques.md |
authz |
IDOR, vertical/horizontal escalation, business logic |
references/exploitation-techniques.md |
ssrf |
Internal reachability, metadata, protocol smuggling |
Skip metadata unless explicitly authorized |
infra |
Misconfig, info disclosure, default creds, exposed admin |
references/exploitation-techniques.md |
Each queue entry has: id, vuln class, source (file:line if known),
endpoint, parameter, slot type, suspected defense, verdict
(identified / partial / confirmed / critical), witness payload,
confidence (0-1), notes.
The analysis phase doesn't send malicious payloads yet — it stages them.
The exploitation phase actually fires them.
Phase 4: Exploitation (Proof-Based, Conditional)
Only run a sub-agent per class where the analysis queue has actionable
entries (identified or partial).
For each candidate:
- Pre-send check — host in scope? auth gate satisfied? payload
approved if destructive?
- Send the witness payload — minimal proof. SQLi:
' AND 1=1--
then ' AND 1=2--. XSS: a benign marker like
<svg/onload=console.log("HERMES-PENTEST-XSS")>. Never alert(1) in
stored XSS — it'll fire for other users in shared environments.
- Verify the witness fires — for blind injection, use a sleep
probe (
SLEEP(5)) and time the response. For SSRF, use a
tester-controlled callback host you own (NOT a public service like
webhook.site for sensitive engagements — exfil paths).
- Promote level:
- L1 Identified — pattern matched, no behavior change
- L2 Partial — sink reached, but defense in place
- L3 Confirmed — payload changed app behavior in observable way
- L4 Critical — data extracted, code executed, access escalated
- Bypass exhaustion before classifying as FP. For each candidate
that blocks: try at least the bypass set in
references/bypass-techniques.md for that class. Only after the set
is exhausted may you write verdict: false_positive.
- Record evidence for every L3/L4:
- Full request (method, URL, headers, body)
- Response (status, headers, relevant body excerpt)
- Reproducer command (curl one-liner)
- Impact statement
Output: findings/exploitation-evidence.md
Redact in evidence files:
- Any captured credentials/tokens → last 6 chars only in chat;
full value to
findings/secrets-vault.md (gitignored).
- Other users' PII → redact.
- Your test credentials → fine to keep.
Phase 5: Reporting
Generate the final report using templates/pentest-report.md. Sections:
- Executive summary
- Engagement scope (from
engagement/scope.txt)
- Authorization (from
engagement/authorization.md)
- Findings (L3/L4 only — proof-required). Per finding:
- Title, severity (CVSS 3.1), CWE
- Affected endpoint(s)
- Proof (request + response excerpt)
- Reproduction steps
- Impact
- Remediation
- Not-exploited candidates (L1/L2 with notes on what blocked them)
- Out-of-scope observations
- Methodology / tools used
- Limitations and what was NOT tested
Severity policy: CVSS only for L3/L4. L1/L2 are "candidates pending
verification" — don't assign CVSS to unverified findings.
When to Stop
- The user revokes authorization.
- A candidate finding clearly impacts production data and you don't have
approval for destructive testing — STOP and ask.
- The target starts returning 503/429 storms — back off, reconvene with
the operator.
- You discover something outside the contracted scope (e.g. an exposed
customer database while testing an unrelated endpoint). STOP, document,
report to the operator. Do not pivot without explicit approval — that
pivot is what makes pentesting illegal.
What This Skill Does NOT Cover
- Network-layer pentesting beyond port scanning (no Metasploit,
Cobalt Strike, AD attacks, network protocol fuzzing).
- Reverse engineering / binary analysis (see issue #383).
- Source-only static analysis (see issue #382).
- Active social engineering / phishing.
- Anything against systems the operator hasn't pre-authorized.
If the engagement needs any of these, escalate to a professional
pentester. This skill complements professional pentesting; it does
not replace it.
Further Reading
references/scope-enforcement.md — how to bound every active request
references/vuln-taxonomy.md — slot types, render contexts, OWASP map
references/exploitation-techniques.md — per-class payload patterns
references/bypass-techniques.md — common WAF/filter bypasses
templates/authorization.md — engagement authorization template
templates/pentest-report.md — final report template
templates/exploitation-queue.json — per-class finding queue schema
scripts/recon-scan.sh — rate-limited nmap+whatweb+headers wrapper
Mandatory actions when this skill is active
Before applying this skill:
While working:
After completing:
1---2name: web-pentest-23description: Authorized web application penetration testing — reconnaissance, vulnerability analysis, proof-based exploitation, and professional reporting.4---56# Web Application Penetration Testing78A phased pentesting workflow for running web applications.9Built around three rules:10111. No exploit, no report — every finding requires reproducible evidence.122. Bounded scope — every active request goes against a target the operator13 pre-declared. Off-scope hosts are refused.143. Bypass exhaustion before false-positive dismissal — a "blocked" payload15 is not a clean bill of health until you've tried the bypass set.1617---1819## ⚠️ Hard Guardrails — Read Before Every Engagement2021Violating any of these invalidates the engagement and may be illegal.22231. **Authorization gate.** Before the first active scan in a session, you24 MUST confirm with the user, in writing, that they own or have written25 authorization to test the target. Record the acknowledgement in26 `engagement/authorization.md` (see template). No acknowledgement → no27 active scanning. Reading public pages with `curl` is fine; sending28 payloads is not.29302. **Scope allowlist.** Maintain `engagement/scope.txt` — one hostname or31 CIDR per line. Every `nmap`, `curl`, `whatweb`, browser navigation, or32 payload-bearing request MUST be against an entry in scope. If a target33 redirects you off-scope (3xx to a different host, a link in HTML),34 STOP and confirm with the user before following.35363. **No production systems without paper.** If the user hasn't told you37 "yes, prod is in scope and I have written sign-off," assume not. Default38 targets are staging, local docker, dedicated test instances.39404. **Cloud metadata is off by default.** Do not probe `169.254.169.254`,41 `metadata.google.internal`, `100.100.100.200`, `[fd00:ec2::254]`, or42 equivalent unless the engagement explicitly includes SSRF-to-metadata43 as a goal AND the target is one you control. The agent's browser tool44 can reach these from inside your own infrastructure — don't.45465. **Destructive payloads need approval.** SQLi payloads that DROP/DELETE,47 filesystem-write SSTI, command injection with `rm`/`shutdown`/`mkfs`,48 anything that mutates beyond a single test row → ASK FIRST. The49 `approval.py` system catches some; don't rely on it alone.50516. **Aux-client leakage risk.** This skill produces sessions full of SQLi/XSS/RCE52 payloads, captured credentials, and JWT tokens. Anything sensitive you write to53 the conversation can be replayed in context compression passes.54 Mitigation:55 - Redact captured tokens/credentials to the LAST 6 CHARS before logging56 them in any message. Full values go to `engagement/evidence/` files,57 never into chat history.58597. **Rate limit yourself.** Default 200ms between active requests against60 any single host. The recon-scan.sh script enforces this. Don't bypass61 it without operator approval.62638. **Authority of the report.** This skill produces a security64 assessment, not a "PASS." Even a clean run is "no exploitable issues65 FOUND in scope X within time T using methods Y" — not "the application66 is secure." Mirror that language in the report.6768---6970## Phase 0: Engagement Setup7172Before any scanning happens, create the engagement directory and73authorization acknowledgement.7475```bash76ENGAGEMENT=engagement-$(date +%Y%m%d-%H%M%S)77mkdir -p "$ENGAGEMENT"/{evidence,findings,reports}78cd "$ENGAGEMENT"79```80811. **Ask the user (verbatim):**82 > "Confirm: (a) the target URL is [X], (b) you own this application83 > or have written authorization to test it, and (c) the engagement84 > may run for up to [N] hours starting now. Reply 'authorized' to85 > proceed."86872. **Wait for explicit `authorized` response.** Any other answer means STOP.88893. **Record authorization** to `engagement/authorization.md` using the90 template in `templates/authorization.md`. Include:91 - Target URL(s) and IP(s)92 - Authorization basis (ownership / written authz from $name)93 - Engagement window94 - Out-of-scope items (production, third-party services, etc.)95 - Operator name (the user driving this session)96974. **Build scope.txt:**98 ```99 localhost100 127.0.0.1101 staging.example.com102 192.168.1.0/24 # internal lab only, with operator OK103 ```1041055. **Read** `references/scope-enforcement.md` before issuing the first106 active request — that doc has the host-extraction rules you apply107 to every command/URL before it goes out.108109---110111## Phase 1: Pre-Recon (Code Analysis, optional)112113Skip if no source access (black-box engagement).114115If you have read access to the application source:1161171. **Map the architecture** — framework, routing, middleware stack1182. **Inventory sinks** — every `execute(`, `os.system(`, `eval(`,119 template render, file read/write, redirect target1203. **Map auth** — session cookie vs JWT, OAuth flows, password reset,121 privileged endpoints1224. **Identify trust boundaries** — what's authenticated, what's not,123 what comes from `request.*`1245. **Backward taint** from each sink to a request source. Early-terminate125 when proper sanitization is found (parameterized queries, allowlists,126 `shlex.quote`, well-known escapers).127128Output: `evidence/pre-recon.md` — architecture map, sink inventory,129suspected vulnerable code paths.130131This is OFFLINE work. No traffic to the target.132133---134135## Phase 2: Recon (Live, Read-Only)136137Maps the attack surface. All requests are GETs of public pages, no138payloads yet. Still scope-bounded.1391401. **Verify scope.** Resolve every target hostname → IP. Confirm IPs are141 in scope (avoids the "DNS points somewhere unexpected" trap).1421432. **Network surface** (only if scope permits port scanning):144 ```bash145 nmap -sT -T3 --top-ports 100 -oN evidence/nmap.txt $TARGET146 ```147 Use `-T3` (default), not `-T4/-T5`. Stealthier and avoids tripping148 IDS/IPS in shared environments.1491503. **Tech fingerprint:**151 ```bash152 whatweb -v $TARGET_URL > evidence/whatweb.txt153 curl -sIk $TARGET_URL > evidence/headers.txt154 ```1551564. **Endpoint discovery:**157 - Crawl the app with the browser tool (`browser_navigate`,158 `browser_get_images`, follow links).159 - Inspect `robots.txt`, `sitemap.xml`, `.well-known/*`.160 - Use the developer tools network panel via browser tool to capture161 XHR/fetch calls.1621635. **Auth surface:** Identify login, registration, password reset,164 session cookie names, token formats. Do NOT send credentials yet —165 just observe.1661676. **Correlate with pre-recon** (if you have source). For each168 `evidence/pre-recon.md` finding, mark whether the live surface169 confirms it's reachable.170171Output: `evidence/recon.md` — endpoints, technologies, auth model,172input vectors.173174---175176## Phase 3: Vulnerability Analysis177178One Agent per vulnerability class. Each agent reads179`evidence/recon.md` (+ `evidence/pre-recon.md` if present), produces180`findings/<class>-queue.json` using `templates/exploitation-queue.json`.181182Use `Agent` with these focused subagents (parallel where possible):183184| Class | Goal | Reference |185|-------|------|-----------|186| `injection` | SQLi, command, path traversal, SSTI, LFI/RFI, deserialization | `references/vuln-taxonomy.md` (slot types) |187| `xss` | Reflected, stored, DOM-based | `references/vuln-taxonomy.md` (render contexts) |188| `auth` | Login bypass, JWT confusion, session fixation, OAuth flaws | `references/exploitation-techniques.md` |189| `authz` | IDOR, vertical/horizontal escalation, business logic | `references/exploitation-techniques.md` |190| `ssrf` | Internal reachability, metadata, protocol smuggling | Skip metadata unless explicitly authorized |191| `infra` | Misconfig, info disclosure, default creds, exposed admin | `references/exploitation-techniques.md` |192193Each queue entry has: id, vuln class, source (file:line if known),194endpoint, parameter, slot type, suspected defense, verdict195(`identified` / `partial` / `confirmed` / `critical`), witness payload,196confidence (0-1), notes.197198The analysis phase doesn't send malicious payloads yet — it stages them.199The exploitation phase actually fires them.200201---202203## Phase 4: Exploitation (Proof-Based, Conditional)204205Only run a sub-agent per class where the analysis queue has actionable206entries (`identified` or `partial`).207208For each candidate:2092101. **Pre-send check** — host in scope? auth gate satisfied? payload211 approved if destructive?2122. **Send the witness payload** — minimal proof. SQLi: `' AND 1=1--`213 then `' AND 1=2--`. XSS: a benign marker like214 `<svg/onload=console.log("HERMES-PENTEST-XSS")>`. Never `alert(1)` in215 stored XSS — it'll fire for other users in shared environments.2163. **Verify the witness fires** — for blind injection, use a sleep217 probe (`SLEEP(5)`) and time the response. For SSRF, use a218 tester-controlled callback host you own (NOT a public service like219 webhook.site for sensitive engagements — exfil paths).2204. **Promote level:**221 - **L1 Identified** — pattern matched, no behavior change222 - **L2 Partial** — sink reached, but defense in place223 - **L3 Confirmed** — payload changed app behavior in observable way224 - **L4 Critical** — data extracted, code executed, access escalated2255. **Bypass exhaustion before classifying as FP.** For each candidate226 that blocks: try at least the bypass set in227 `references/bypass-techniques.md` for that class. Only after the set228 is exhausted may you write `verdict: false_positive`.2296. **Record evidence** for every L3/L4:230 - Full request (method, URL, headers, body)231 - Response (status, headers, relevant body excerpt)232 - Reproducer command (curl one-liner)233 - Impact statement234235Output: `findings/exploitation-evidence.md`236237**Redact in evidence files:**238- Any captured credentials/tokens → last 6 chars only in chat;239 full value to `findings/secrets-vault.md` (gitignored).240- Other users' PII → redact.241- Your test credentials → fine to keep.242243---244245## Phase 5: Reporting246247Generate the final report using `templates/pentest-report.md`. Sections:2482491. Executive summary2502. Engagement scope (from `engagement/scope.txt`)2513. Authorization (from `engagement/authorization.md`)2524. Findings (L3/L4 only — proof-required). Per finding:253 - Title, severity (CVSS 3.1), CWE254 - Affected endpoint(s)255 - Proof (request + response excerpt)256 - Reproduction steps257 - Impact258 - Remediation2595. Not-exploited candidates (L1/L2 with notes on what blocked them)2606. Out-of-scope observations2617. Methodology / tools used2628. Limitations and what was NOT tested263264**Severity policy:** CVSS only for L3/L4. L1/L2 are "candidates pending265verification" — don't assign CVSS to unverified findings.266267---268269## When to Stop270271- The user revokes authorization.272- A candidate finding clearly impacts production data and you don't have273 approval for destructive testing — STOP and ask.274- The target starts returning 503/429 storms — back off, reconvene with275 the operator.276- You discover something *outside* the contracted scope (e.g. an exposed277 customer database while testing an unrelated endpoint). STOP, document,278 report to the operator. Do not pivot without explicit approval — that279 pivot is what makes pentesting illegal.280281---282283## What This Skill Does NOT Cover284285- Network-layer pentesting beyond port scanning (no Metasploit,286 Cobalt Strike, AD attacks, network protocol fuzzing).287- Reverse engineering / binary analysis (see issue #383).288- Source-only static analysis (see issue #382).289- Active social engineering / phishing.290- Anything against systems the operator hasn't pre-authorized.291292If the engagement needs any of these, escalate to a professional293pentester. This skill complements professional pentesting; it does294not replace it.295296---297298## Further Reading299300- `references/scope-enforcement.md` — how to bound every active request301- `references/vuln-taxonomy.md` — slot types, render contexts, OWASP map302- `references/exploitation-techniques.md` — per-class payload patterns303- `references/bypass-techniques.md` — common WAF/filter bypasses304- `templates/authorization.md` — engagement authorization template305- `templates/pentest-report.md` — final report template306- `templates/exploitation-queue.json` — per-class finding queue schema307- `scripts/recon-scan.sh` — rate-limited nmap+whatweb+headers wrapper308309## Mandatory actions when this skill is active310311Before applying this skill:312- [ ] Read the task requirements fully before acting313- [ ] Confirm you understand the goal and constraints314- [ ] Check for existing work or prior context in the codebase315316While working:317- [ ] Follow the methodology described above step by step318- [ ] Document any decisions or findings as you go319320After completing:321- [ ] Self-check: does the output satisfy the original requirement?322- [ ] Verify no regressions or unintended side effects323