$npx -y skills add anthropics/defending-code-reference-harness --skill vuln-scanStatic source-code vulnerability scan. Reads a target directory (and THREAT_MODEL.md if present), spawns parallel review subagents per focus area, and writes VULN-FINDINGS.json + .md for /triage to consume. Read-only — no building, running, or network. For execution-verified cras
| 1 | # /vuln-scan |
| 2 | |
| 3 | Static vulnerability review of a source tree. Produces `VULN-FINDINGS.json` |
| 4 | (+ a human-readable `.md`) that `/triage` ingests directly. |
| 5 | |
| 6 | **This skill does not execute code.** It reads source and reasons about it. |
| 7 | For execution-verified findings (ASAN crashes, reproducing PoCs), point the |
| 8 | user at `vuln-pipeline run <target>` — see README Step 2. |
| 9 | |
| 10 | **Tool fallbacks.** Prefer the dedicated Glob and Grep tools. Some sessions |
| 11 | do not provision them — `allowed-tools` is a permission filter, not a loader, |
| 12 | so listing them here does not make them appear. When Glob/Grep are |
| 13 | unavailable, fall back to the read-only Bash commands whitelisted above: |
| 14 | `rg --files <scope>` / `ls -R` for enumeration, `rg -n` / `grep -rn` for |
| 15 | search, `wc` / `head` / `file` for sniffing. These are the ONLY permitted |
| 16 | Bash commands; do not write helper scripts or pipe target content into a |
| 17 | shell interpreter. |
| 18 | |
| 19 | ## Arguments |
| 20 | |
| 21 | - `<target-dir>` (required) — directory to scan. Relative or absolute. |
| 22 | - `--focus <area>` — scan only this focus area (repeatable). Skips recon. |
| 23 | - `--single` — no subagent fan-out; one sequential pass. Use on tiny targets |
| 24 | or when debugging the prompt. |
| 25 | - `--extra <file>` — append the contents of `<file>` to the review brief |
| 26 | (after the category list). Use to add org-specific vulnerability classes, |
| 27 | compliance checks, or stack-specific patterns. Plain text; same shape as |
| 28 | the category blocks below. |
| 29 | - `--no-score` — skip the Step 3b confidence pass (saves a round of |
| 30 | subagents). Findings keep the scanner's self-reported confidence only. |
| 31 | |
| 32 | ## Step 1 — Scope |
| 33 | |
| 34 | 1. Resolve `<target-dir>`. If it doesn't exist or has no source files, stop |
| 35 | with an error. |
| 36 | 2. Look for `<target-dir>/THREAT_MODEL.md`. If present, parse its section 3 "Entry |
| 37 | points & trust boundaries" table and section 4 "Threats" table for focus areas |
| 38 | and threat classes. This is the preferred scoping input. |
| 39 | 3. If no THREAT_MODEL.md and no `--focus`: do a **quick recon** — list the |
| 40 | source tree, read entry points and dispatch code, and propose 3-10 focus |
| 41 | areas using the pattern `<subsystem> (<function/file>) — <key operations>`. |
| 42 | Same shape as `harness/prompts/recon_prompt.py`. |
| 43 | 4. If `--focus` was given, use exactly those. |
| 44 | |
| 45 | Tell the user the focus areas you'll scan and the source-file count before |
| 46 | fanning out. |
| 47 | |
| 48 | ## Step 2 — Fan out |
| 49 | |
| 50 | Unless `--single`, spawn **one Task subagent per focus area** in parallel. |
| 51 | Cap at 10 concurrent. Each subagent gets the review brief below with its |
| 52 | focus area filled in. On tiny targets (<15 source files), fall through to |
| 53 | `--single` automatically. |
| 54 | |
| 55 | ### Review brief (per subagent) |
| 56 | |
| 57 | ``` |
| 58 | You are conducting authorized static security review of source code. Your |
| 59 | focus area: **{focus_area}**. Other agents cover other areas; duplication |
| 60 | is wasted effort. |
| 61 | |
| 62 | TARGET: {target_dir} |
| 63 | TRUST BOUNDARY: {from THREAT_MODEL.md section 3, or "untrusted input → process memory"} |
| 64 | |
| 65 | TASK: read the source in your focus area and identify candidate |
| 66 | vulnerabilities. This is static review — do NOT build, run, or probe |
| 67 | anything. Reason from the code. |
| 68 | |
| 69 | REPORTING BAR: report anything with a plausible exploit path. Skip style |
| 70 | concerns, best-practice gaps, and purely theoretical issues with no attack |
| 71 | story at all — but if you're unsure whether something is real, REPORT IT |
| 72 | with a low confidence score rather than dropping it. A downstream triage |
| 73 | step does the rigorous verification; your job is to not miss things. |
| 74 | |
| 75 | WHAT TO LOOK FOR: |
| 76 | |
| 77 | MEMORY SAFETY (C/C++ and unsafe/FFI blocks) — HIGH VALUE: |
| 78 | - heap-buffer-overflow / stack-buffer-overflow / global-buffer-overflow |
| 79 | - heap-use-after-free / double-free |
| 80 | - integer overflow feeding an allocation or index |
| 81 | - format-string bugs |
| 82 | - unbounded recursion or allocation driven by untrusted size fields |
| 83 | |
| 84 | INJECTION & CODE EXECUTION — HIGH VALUE: |
| 85 | - SQL / command / LDAP / XPath / NoSQL / template injection |
| 86 | - path traversal in file operations |
| 87 | - unsafe deserialization (pickle, YAML, native), eval injection |
| 88 | - XSS (reflected, stored, DOM-based) — but see React/Angular note below |
| 89 | |
| 90 | AUTH, CRYPTO, DATA — HIGH VALUE: |
| 91 | - authentication or authorization bypass, privilege escalation |
| 92 | - TOCTOU on a security check |
| 93 | - hardcoded secrets, weak crypto, broken cert validation |