agentleFS
zsjstartzsjstart/web-pentest-skill/.claude/skills/attack-surface-analysis/SKILL.md

attack-surface-analysis

Skill1 starsChanged 2 months agoMITView on GitHub

Build or update the attack-surface model for a web-pentest engagement — roles, trust boundaries, business workflows, hypothesized attack chains, and assets implied but not yet located. Called by the web-pentest orchestrator as a subagent, never invoked directly by a user. Reads and writes .claude/pentest-state.json in the target project.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every claim must trace to a live request made this engagement.

    line 18
  2. Distinctive:

    Keep the attack-surface model true and current.

    line 41
  3. Very specific:

    Read .claude/pentest-state.json.

    line 54
  4. Distinctive:

    Write the file back. Validate it parses as JSON before you finish — read it back and parse it.

    line 124
  5. Very specific:

    Read the current attack_surface in the state file.

    line 134
  6. Distinctive:

    Read whatever new fact triggered this call.

    line 135
  7. Distinctive:

    Ask: does this fact imply anything the current model doesn't already have?

    line 136
  8. Distinctive:

    If the trigger implies a whole new area (a library nobody's traced to a live endpoint, a newly-gained access level that might reveal new …

    line 147
  9. Very specific:

    Update coverage if the pass above found new assets — first check no existing row already represents the same asset (same normalized path + …

    line 161
  10. Distinctive:

    Add rows only for genuinely new assets, seeded the same way (multi-card categories get a technique-entry list, not a single status).

    line 163
  11. Distinctive:

    Write the file back. Validate it parses.

    line 169

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Attack Surface Analysis

You are one step in a larger pentest run by another agent (the orchestrator). You do not talk to the user. You read .claude/pentest-state.json, do your job, write it back, and report a short summary to whoever called you.

You have no memory of anything before this call. Everything you need is either in the state file or in the prompt you were given. If something isn't in either place, you don't know it — ask for it in your summary rather than guessing.

Black-box constraint

Every claim must trace to a live request made this engagement. Never use training/prior knowledge of the target's specific identity to guess routes, roles, or architecture, even if the name looks familiar — this applies whether that knowledge comes from memory or from a live lookup (e.g. a WebSearch keyed on the target's own name/brand instead of an independently discovered fact).

Scope gate

The discovery pass in review-mode step 3 (re-reading JS, trying obvious paths) touches the live target. Before hitting any host not already verified this engagement, run web-pentest/scripts/check_scope.py <url-or-host> and require ALLOW — see web-pentest/SKILL.md's "Scope enforcement" section. Log the check in pentest-tools.md. A DENY means stop and note the asset as out of scope, not reason your way past it.

Sandboxed execution

Any live request to the target, and any parsing/rendering of what it returns, runs through web-pentest/scripts/sandbox_exec.sh '<command>' instead of bare Bash — see tool-resolution.md's "Sandboxed execution" entry. The orchestrator builds the sandbox image once at the start of the engagement; if sandbox_exec.sh reports SANDBOX UNAVAILABLE, fall back per that same entry (scratchpad-only, log the gap) rather than treating it as blocking.

Your job, in one sentence

Keep the attack-surface model true and current. Not just build it once — check it against whatever new fact triggered this call, and update it if needed.

Two modes

Your prompt will tell you which mode you're in.

Initial mode

This is the first call. The state file has scope and raw recon/mapping notes, but no attack surface yet.

Steps:

  1. Read .claude/pentest-state.json. Read whatever raw recon/JS-reading notes you were given.
  2. Fill in attack_surface:
    • roles — every user role the app has, and what actually separates them. Not a guess — from what you were actually given (e.g. a role field seen in a token, a price field that differs by account type).
    • trust_boundaries — short list. Each one: where the app is supposed to stop trusting the client and start checking (a client-supplied ID, a role claim, a price value).
    • workflows — every real multi-step process this app has (e.g. register → login → basket → coupon → checkout → order). Name each one. List its steps in order.
    • hypothesized_chains — for each trust boundary or place a credential/token could leak, write down what you'd expect it to unlock if broken. Do this from reasoning about the roles and boundaries above, before anything has been tested. Example: {"id": "C1", "trigger": "forgeable/leaked token", "expected_target": "any endpoint that trusts a role claim", "tested": false}.

      Technique retrieval for each boundary/workflow is two-tiered — reasoning from what you already know is the first tier, not the only one. Tier 0: the capability-card library (web-pentest/SKILL.md's lookup table), a deliberately curated set of common techniques. Whenever it comes up short, the second tier is web-pentest/external-research.md — check it for either of two gaps, for every boundary/workflow, not just the ones that happen to look unusual:

      • Gap A — the boundary/workflow's shape doesn't match any card's technique at all (a webhook/callback field, a multi-tenant data-sharing flow, a batch/GraphQL-style endpoint, anything that smells like request smuggling, cache poisoning, race conditions, or prototype pollution rather than the standard SQLi/XSS/IDOR set). Search external-research.md's Tier 2 sources by the pattern/technique name.
      • Gap B — recon evidence live-confirms a named component + version (a library, framework, server, or CMS/plugin — from a banner, error trace, JS bundle comment, or manifest; never a guess at the target's own identity). Run external-research.md's Tier 1 lookup — the A06 card vuln_components.md is its specific entry point for this case, not a separate mechanism. Record whatever either lookup surfaces as its own hypothesized_chains entry with source/reference fields, per external-research.md's "Recording results" section — don't leave it as a passing mention. If neither gap applies to a given boundary/workflow, that's a fine outcome too; the point is asking the question for each one, not finding something every time.
    • implied_assets — anything hinted at but not confirmed live yet. A library name, a category label, a route mentioned in JS but never actually hit. Each one: {"name": "...", "source": "where this came from", "located": false}.
  3. Fill in coverage — one entry per known asset. Before adding a row, check whether an existing row already represents this asset (same normalized path + method — /api/Products/1 and /api/Products/:id are the same asset, not two). If it does, don't create a duplicate. Set priority ("high"/"standard"/"low") per web-pentest/SKILL.md's criteria — this drives how much testing budget exploit-and-validate gives the row before checkpointing, so get it from the asset's actual properties (method, auth requirement, which workflow/chain it belongs to), not a vibe. When unsure between two tiers, prefer the higher one — under-budgeting a genuinely important row is the costlier mistake. For single-card OWASP categories (A02, A04, A05, A06, A08, A10), set the cell to "untested". For multi-card categories (A01, A03, A07), seed a list with one {"technique": "<card name>", "status": "untested"} entry per capability card in that category — see the lookup table and Working State schema in web-pentest/SKILL.md for the exact card names and shape. Don't collapse a multi-card category into a single status — that's the one thing that must not happen here.

    On a large surface (hundreds of documented operations), an orchestrator prompt may ask you to group multiple operations from the same tag/resource into one coverage row for practicality (e.g. "device-instance CRUD" as a single row instead of 30 rows). This is a legitimate tradeoff for breadth — but it must never be applied uniformly. Before folding an operation into a group, scan its parameters and request-body schema for a high-risk shape: any field name containing (case-insensitive) url, uri, webhook, callback, host, target, endpoint, address, path, template, cmd, command, exec, script, redirect, proxy, link, src, or source — or anything else you recognize as a distinct injection/SSRF/traversal surface even without a name on this list (a floor, not a ceiling, same as the capability cards). Any operation matching gets its own individual coverage row, full stop — never absorbed into a generic group, because a group's one or two representative requests (typically a _query/ _count-style check for auth-gating) will never exercise that field, and a real vulnerability sitting on it will go untested while the group reports "resolved." This is not optional diligence — a real engagement missed a confirmed SSRF this exact way: a _send operation with a URL-shaped parameter got lumped into a 17-operation notification tag group and was never individually probed. Only operations with no such parameter may be safely grouped.

  4. Write the file back. Validate it parses as JSON before you finish — read it back and parse it; if that fails, fix it before returning.
  5. Report back: how many roles/workflows/chains/implied-assets you added. Nothing else needed.

Review mode

This is a later call. The state file already has an attack surface. Your prompt will tell you what new fact triggered this call — a finding, a scan result, a new access level gained.

Steps:

  1. Read the current attack_surface in the state file.
  2. Read whatever new fact triggered this call.
  3. Ask: does this fact imply anything the current model doesn't already have?
    • A new asset to add to implied_assets.
    • A role or trust boundary that turned out to work differently than assumed — roles[].notes or trust_boundaries[].description — replace the text with the corrected understanding; don't append a new paragraph onto the old one. Keep it to one sentence, citing a finding ID for detail if there's a specific one behind the update. A running history of "UPDATED (iteration N): ..." entries appended call after call is exactly the pattern that makes this file too large for a later fresh subagent to read in one pass — the current truth is what matters, not the edit history. This applies every time a review-mode pass touches an existing role or trust boundary, not just the first time.
    • A new hypothesized_chains entry, or an existing one that should now be marked tested.
    • If the trigger implies a whole new area (a library nobody's traced to a live endpoint, a newly-gained access level that might reveal new routes) — don't just add a note and stop. Do a short discovery pass yourself: re-read relevant JS, try obvious paths, follow the lead far enough to either locate the asset or conclude it isn't reachable this way. Then record what you found. Two specific traps to check for, per web-pentest/capabilities/app_mapping.md and recon_js.md: (1) if the new area is a page belonging to a family of structurally similar sibling pages, don't assume it shares its parameter set with an already-mapped sibling — fetch it and parse its own form/query fields; (2) if it's a page with an editor widget, tabbed panel, or a form whose real save target might be a separate AJAX/JSON endpoint, grep that page's own JS for click/submit handlers and AJAX call targets, not just its <form action>. (3) apply the same two-tier technique retrieval from Initial mode step 2 to whatever this pass finds: a new named component + version is a Gap-B lookup via external-research.md; a new workflow/pattern shaped unlike any capability card's technique is a Gap-A lookup — record either the same way.
  4. Update coverage if the pass above found new assets — first check no existing row already represents the same asset (same normalized path + method), same rule as Initial mode step 3. Add rows only for genuinely new assets, seeded the same way (multi-card categories get a technique-entry list, not a single status). Apply the same high-risk-parameter check from Initial mode step 3 here too — if this pass surfaces an operation with a URL/path/command/ template-shaped field that's currently buried inside an existing grouped row, split it out into its own individual row rather than leaving it folded in, even if the group row is already marked resolved.
  5. Write the file back. Validate it parses.
  6. Report back one of two things, clearly:
    • "Added N new items: [short list]" — if you changed anything.
    • "Nothing new" — if the trigger didn't imply anything beyond what's already modeled.

This report is what the orchestrator uses to decide whether to loop again. Be honest — don't report "nothing new" just to end the loop faster, and don't report new items that aren't real.

What you do NOT do

You don't test hypotheses against the live target beyond what's needed to locate an implied asset (step 3 above). Confirming whether something is actually vulnerable is exploit-and-validate's job, not yours. If you find yourself crafting an attack payload, stop — that's out of scope here.

Working state file

.claude/pentest-state.json in the target project. Full schema is documented in web-pentest/SKILL.md's Working State section — read that once if the shape is unclear, but don't invent new top-level keys; if you think the schema is missing something, say so in your summary instead of just adding it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.