@vigolium/piolium 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/agents/access-auditor.md +300 -0
  4. package/agents/assumption-breaker.md +154 -0
  5. package/agents/attack-designer.md +116 -0
  6. package/agents/code-scanner.md +139 -0
  7. package/agents/concurrency-auditor.md +238 -0
  8. package/agents/confirm-writer.md +257 -0
  9. package/agents/context-reviewer.md +274 -0
  10. package/agents/cross-verifier.md +165 -0
  11. package/agents/cve-scout.md +381 -0
  12. package/agents/env-builder.md +282 -0
  13. package/agents/env-profiler.md +205 -0
  14. package/agents/evidence-collector.md +140 -0
  15. package/agents/finding-grader.md +142 -0
  16. package/agents/finding-writer.md +148 -0
  17. package/agents/flow-tracer.md +106 -0
  18. package/agents/goal-backtracer.md +146 -0
  19. package/agents/history-miner.md +467 -0
  20. package/agents/independent-verifier.md +118 -0
  21. package/agents/intent-mapper.md +183 -0
  22. package/agents/longshot-collector.md +128 -0
  23. package/agents/longshot-prober.md +126 -0
  24. package/agents/patch-auditor.md +73 -0
  25. package/agents/poc-author.md +124 -0
  26. package/agents/poc-runner.md +194 -0
  27. package/agents/probe-lead.md +269 -0
  28. package/agents/red-challenger.md +101 -0
  29. package/agents/report-composer.md +208 -0
  30. package/agents/review-adjudicator.md +216 -0
  31. package/agents/spec-auditor.md +155 -0
  32. package/agents/taint-tracer.md +265 -0
  33. package/agents/test-locator.md +209 -0
  34. package/agents/threat-modeler.md +132 -0
  35. package/agents/variant-scanner.md +108 -0
  36. package/agents/variant-spotter.md +110 -0
  37. package/bin/piolium.mjs +376 -0
  38. package/extensions/piolium/_vendor/yaml.bundle.d.mts +6 -0
  39. package/extensions/piolium/_vendor/yaml.bundle.mjs +139 -0
  40. package/extensions/piolium/agent-runner.ts +322 -0
  41. package/extensions/piolium/agents.ts +266 -0
  42. package/extensions/piolium/audit-state.ts +522 -0
  43. package/extensions/piolium/bundled-resources.ts +97 -0
  44. package/extensions/piolium/candidate-scan.ts +966 -0
  45. package/extensions/piolium/command-target.ts +177 -0
  46. package/extensions/piolium/console-stream.ts +57 -0
  47. package/extensions/piolium/export-results.ts +380 -0
  48. package/extensions/piolium/findings.ts +448 -0
  49. package/extensions/piolium/heartbeat.ts +182 -0
  50. package/extensions/piolium/help.ts +234 -0
  51. package/extensions/piolium/index.ts +1865 -0
  52. package/extensions/piolium/longshot.ts +530 -0
  53. package/extensions/piolium/matcher-suggestions.ts +196 -0
  54. package/extensions/piolium/matcher-utils.ts +83 -0
  55. package/extensions/piolium/modes/balanced.ts +750 -0
  56. package/extensions/piolium/modes/confirm-bootstrap.ts +186 -0
  57. package/extensions/piolium/modes/confirm.ts +697 -0
  58. package/extensions/piolium/modes/deep.ts +917 -0
  59. package/extensions/piolium/modes/diff.ts +177 -0
  60. package/extensions/piolium/modes/lite.ts +540 -0
  61. package/extensions/piolium/modes/longshot.ts +595 -0
  62. package/extensions/piolium/modes/merge.ts +204 -0
  63. package/extensions/piolium/modes/phase-runner.ts +267 -0
  64. package/extensions/piolium/modes/reinvest.ts +546 -0
  65. package/extensions/piolium/modes/revisit.ts +279 -0
  66. package/extensions/piolium/modes.ts +48 -0
  67. package/extensions/piolium/phase-labels.ts +123 -0
  68. package/extensions/piolium/phase-status-strip.ts +92 -0
  69. package/extensions/piolium/prompt-prefix-editor.ts +39 -0
  70. package/extensions/piolium/providers/anthropic-vertex.ts +836 -0
  71. package/extensions/piolium/recon.ts +409 -0
  72. package/extensions/piolium/result-stats.ts +105 -0
  73. package/extensions/piolium/retry.ts +120 -0
  74. package/extensions/piolium/scheduler.ts +212 -0
  75. package/extensions/piolium/secrets.ts +368 -0
  76. package/extensions/piolium/tools/web-tools.ts +148 -0
  77. package/package.json +77 -0
  78. package/skills/agentic-actions-auditor/SKILL.md +327 -0
  79. package/skills/agentic-actions-auditor/references/action-profiles.md +186 -0
  80. package/skills/agentic-actions-auditor/references/cross-file-resolution.md +209 -0
  81. package/skills/agentic-actions-auditor/references/foundations.md +94 -0
  82. package/skills/agentic-actions-auditor/references/vector-a-env-var-intermediary.md +77 -0
  83. package/skills/agentic-actions-auditor/references/vector-b-direct-expression-injection.md +83 -0
  84. package/skills/agentic-actions-auditor/references/vector-c-cli-data-fetch.md +83 -0
  85. package/skills/agentic-actions-auditor/references/vector-d-pr-target-checkout.md +88 -0
  86. package/skills/agentic-actions-auditor/references/vector-e-error-log-injection.md +88 -0
  87. package/skills/agentic-actions-auditor/references/vector-f-subshell-expansion.md +82 -0
  88. package/skills/agentic-actions-auditor/references/vector-g-eval-of-ai-output.md +91 -0
  89. package/skills/agentic-actions-auditor/references/vector-h-dangerous-sandbox-configs.md +102 -0
  90. package/skills/agentic-actions-auditor/references/vector-i-wildcard-allowlists.md +88 -0
  91. package/skills/audit/SKILL.md +562 -0
  92. package/skills/audit/assets/icon.svg +7 -0
  93. package/skills/audit/hooks/scripts/validate_phase_output.py +550 -0
  94. package/skills/audit/references/adversarial-review.md +148 -0
  95. package/skills/audit/references/architecture-aware-sast.md +306 -0
  96. package/skills/audit/references/audit-workflow.md +737 -0
  97. package/skills/audit/references/chamber-protocol.md +384 -0
  98. package/skills/audit/references/creative-attack-modes.md +221 -0
  99. package/skills/audit/references/deep-analysis.md +273 -0
  100. package/skills/audit/references/domain-attack-playbooks.md +1129 -0
  101. package/skills/audit/references/knowledge-base-template.md +513 -0
  102. package/skills/audit/references/real-env-validation.md +191 -0
  103. package/skills/audit/references/report-templates.md +417 -0
  104. package/skills/audit/references/triage-and-prereqs.md +134 -0
  105. package/skills/audit/scripts/consolidate_drafts.py +554 -0
  106. package/skills/audit/scripts/partition_findings.py +152 -0
  107. package/skills/audit/scripts/rg-hotspots.sh +121 -0
  108. package/skills/audit/scripts/stamp_file_state.py +349 -0
  109. package/skills/code-reviewer/SKILL.md +65 -0
  110. package/skills/codeql/SKILL.md +281 -0
  111. package/skills/codeql/references/build-fixes.md +90 -0
  112. package/skills/codeql/references/diagnostic-query-templates.md +339 -0
  113. package/skills/codeql/references/extension-yaml-format.md +209 -0
  114. package/skills/codeql/references/important-only-suite.md +153 -0
  115. package/skills/codeql/references/language-details.md +207 -0
  116. package/skills/codeql/references/macos-arm64e-workaround.md +179 -0
  117. package/skills/codeql/references/performance-tuning.md +111 -0
  118. package/skills/codeql/references/quality-assessment.md +172 -0
  119. package/skills/codeql/references/ruleset-catalog.md +63 -0
  120. package/skills/codeql/references/run-all-suite.md +92 -0
  121. package/skills/codeql/references/sarif-processing.md +79 -0
  122. package/skills/codeql/references/threat-models.md +51 -0
  123. package/skills/codeql/workflows/build-database.md +280 -0
  124. package/skills/codeql/workflows/create-data-extensions.md +261 -0
  125. package/skills/codeql/workflows/run-analysis.md +301 -0
  126. package/skills/differential-review/SKILL.md +220 -0
  127. package/skills/differential-review/adversarial.md +203 -0
  128. package/skills/differential-review/methodology.md +234 -0
  129. package/skills/differential-review/patterns.md +300 -0
  130. package/skills/differential-review/reporting.md +369 -0
  131. package/skills/fp-check/SKILL.md +125 -0
  132. package/skills/fp-check/references/bug-class-verification.md +114 -0
  133. package/skills/fp-check/references/deep-verification.md +143 -0
  134. package/skills/fp-check/references/evidence-templates.md +91 -0
  135. package/skills/fp-check/references/false-positive-patterns.md +115 -0
  136. package/skills/fp-check/references/gate-reviews.md +27 -0
  137. package/skills/fp-check/references/standard-verification.md +78 -0
  138. package/skills/insecure-defaults/SKILL.md +117 -0
  139. package/skills/insecure-defaults/references/examples.md +409 -0
  140. package/skills/last30days/SKILL.md +444 -0
  141. package/skills/sarif-parsing/SKILL.md +483 -0
  142. package/skills/sarif-parsing/resources/jq-queries.md +162 -0
  143. package/skills/sarif-parsing/resources/sarif_helpers.py +331 -0
  144. package/skills/security-threat-model/LICENSE.txt +201 -0
  145. package/skills/security-threat-model/SKILL.md +81 -0
  146. package/skills/security-threat-model/agents/openai.yaml +4 -0
  147. package/skills/security-threat-model/references/prompt-template.md +255 -0
  148. package/skills/security-threat-model/references/security-controls-and-assets.md +32 -0
  149. package/skills/semgrep/SKILL.md +212 -0
  150. package/skills/semgrep/references/rulesets.md +162 -0
  151. package/skills/semgrep/references/scan-modes.md +110 -0
  152. package/skills/semgrep/references/scanner-task-prompt.md +140 -0
  153. package/skills/semgrep/scripts/merge_sarif.py +203 -0
  154. package/skills/semgrep/workflows/scan-workflow.md +311 -0
  155. package/skills/semgrep-rule-creator/SKILL.md +168 -0
  156. package/skills/semgrep-rule-creator/references/quick-reference.md +202 -0
  157. package/skills/semgrep-rule-creator/references/workflow.md +240 -0
  158. package/skills/semgrep-rule-variant-creator/SKILL.md +205 -0
  159. package/skills/semgrep-rule-variant-creator/references/applicability-analysis.md +250 -0
  160. package/skills/semgrep-rule-variant-creator/references/language-syntax-guide.md +324 -0
  161. package/skills/semgrep-rule-variant-creator/references/workflow.md +518 -0
  162. package/skills/sharp-edges/SKILL.md +292 -0
  163. package/skills/sharp-edges/references/auth-patterns.md +252 -0
  164. package/skills/sharp-edges/references/case-studies.md +274 -0
  165. package/skills/sharp-edges/references/config-patterns.md +333 -0
  166. package/skills/sharp-edges/references/crypto-apis.md +190 -0
  167. package/skills/sharp-edges/references/lang-c.md +205 -0
  168. package/skills/sharp-edges/references/lang-csharp.md +285 -0
  169. package/skills/sharp-edges/references/lang-go.md +270 -0
  170. package/skills/sharp-edges/references/lang-java.md +263 -0
  171. package/skills/sharp-edges/references/lang-javascript.md +269 -0
  172. package/skills/sharp-edges/references/lang-kotlin.md +265 -0
  173. package/skills/sharp-edges/references/lang-php.md +245 -0
  174. package/skills/sharp-edges/references/lang-python.md +274 -0
  175. package/skills/sharp-edges/references/lang-ruby.md +273 -0
  176. package/skills/sharp-edges/references/lang-rust.md +272 -0
  177. package/skills/sharp-edges/references/lang-swift.md +287 -0
  178. package/skills/sharp-edges/references/language-specific.md +588 -0
  179. package/skills/spec-to-code-compliance/SKILL.md +357 -0
  180. package/skills/spec-to-code-compliance/resources/COMPLETENESS_CHECKLIST.md +69 -0
  181. package/skills/spec-to-code-compliance/resources/IR_EXAMPLES.md +417 -0
  182. package/skills/spec-to-code-compliance/resources/OUTPUT_REQUIREMENTS.md +105 -0
  183. package/skills/supply-chain-risk-auditor/SKILL.md +67 -0
  184. package/skills/supply-chain-risk-auditor/resources/results-template.md +41 -0
  185. package/skills/variant-analysis/METHODOLOGY.md +327 -0
  186. package/skills/variant-analysis/SKILL.md +142 -0
  187. package/skills/variant-analysis/resources/codeql/cpp.ql +119 -0
  188. package/skills/variant-analysis/resources/codeql/go.ql +69 -0
  189. package/skills/variant-analysis/resources/codeql/java.ql +71 -0
  190. package/skills/variant-analysis/resources/codeql/javascript.ql +63 -0
  191. package/skills/variant-analysis/resources/codeql/python.ql +80 -0
  192. package/skills/variant-analysis/resources/semgrep/cpp.yaml +98 -0
  193. package/skills/variant-analysis/resources/semgrep/go.yaml +63 -0
  194. package/skills/variant-analysis/resources/semgrep/java.yaml +61 -0
  195. package/skills/variant-analysis/resources/semgrep/javascript.yaml +60 -0
  196. package/skills/variant-analysis/resources/semgrep/python.yaml +72 -0
  197. package/skills/variant-analysis/resources/variant-report-template.md +75 -0
  198. package/skills/vuln-report/SKILL.md +137 -0
  199. package/skills/vuln-report/agents/openai.yaml +4 -0
  200. package/skills/vuln-report/references/report-template.md +135 -0
  201. package/skills/wooyun-legacy/SKILL.md +367 -0
  202. package/skills/wooyun-legacy/references/bank-penetration.md +222 -0
  203. package/skills/wooyun-legacy/references/checklists/command-execution-checklist.md +119 -0
  204. package/skills/wooyun-legacy/references/checklists/csrf-checklist.md +74 -0
  205. package/skills/wooyun-legacy/references/checklists/file-upload-checklist.md +108 -0
  206. package/skills/wooyun-legacy/references/checklists/info-disclosure-checklist.md +114 -0
  207. package/skills/wooyun-legacy/references/checklists/logic-flaws-checklist.md +95 -0
  208. package/skills/wooyun-legacy/references/checklists/misconfig-checklist.md +124 -0
  209. package/skills/wooyun-legacy/references/checklists/path-traversal-checklist.md +87 -0
  210. package/skills/wooyun-legacy/references/checklists/rce-checklist.md +93 -0
  211. package/skills/wooyun-legacy/references/checklists/sql-injection-checklist.md +97 -0
  212. package/skills/wooyun-legacy/references/checklists/ssrf-checklist.md +99 -0
  213. package/skills/wooyun-legacy/references/checklists/unauthorized-access-checklist.md +89 -0
  214. package/skills/wooyun-legacy/references/checklists/weak-password-checklist.md +115 -0
  215. package/skills/wooyun-legacy/references/checklists/xss-checklist.md +103 -0
  216. package/skills/wooyun-legacy/references/checklists/xxe-checklist.md +130 -0
  217. package/skills/wooyun-legacy/references/info-disclosure.md +975 -0
  218. package/skills/wooyun-legacy/references/logic-flaws.md +721 -0
  219. package/skills/wooyun-legacy/references/path-traversal.md +1191 -0
  220. package/skills/wooyun-legacy/references/telecom-penetration.md +156 -0
  221. package/skills/wooyun-legacy/references/unauthorized-access.md +980 -0
  222. package/skills/wooyun-legacy/references/xss.md +746 -0
  223. package/skills/zeroize-audit/SKILL.md +371 -0
  224. package/skills/zeroize-audit/configs/c.yaml +21 -0
  225. package/skills/zeroize-audit/configs/default.yaml +128 -0
  226. package/skills/zeroize-audit/configs/rust.yaml +83 -0
  227. package/skills/zeroize-audit/prompts/report_template.md +238 -0
  228. package/skills/zeroize-audit/prompts/system.md +163 -0
  229. package/skills/zeroize-audit/prompts/task.md +97 -0
  230. package/skills/zeroize-audit/references/compile-commands.md +231 -0
  231. package/skills/zeroize-audit/references/detection-strategy.md +191 -0
  232. package/skills/zeroize-audit/references/ir-analysis.md +252 -0
  233. package/skills/zeroize-audit/references/mcp-analysis.md +221 -0
  234. package/skills/zeroize-audit/references/poc-generation.md +470 -0
  235. package/skills/zeroize-audit/references/rust-zeroization-patterns.md +867 -0
  236. package/skills/zeroize-audit/schemas/input.json +83 -0
  237. package/skills/zeroize-audit/schemas/output.json +140 -0
  238. package/skills/zeroize-audit/tools/analyze_asm.sh +202 -0
  239. package/skills/zeroize-audit/tools/analyze_cfg.py +381 -0
  240. package/skills/zeroize-audit/tools/analyze_heap.sh +211 -0
  241. package/skills/zeroize-audit/tools/analyze_ir_semantic.py +429 -0
  242. package/skills/zeroize-audit/tools/diff_ir.sh +135 -0
  243. package/skills/zeroize-audit/tools/diff_rust_mir.sh +189 -0
  244. package/skills/zeroize-audit/tools/emit_asm.sh +67 -0
  245. package/skills/zeroize-audit/tools/emit_ir.sh +77 -0
  246. package/skills/zeroize-audit/tools/emit_rust_asm.sh +178 -0
  247. package/skills/zeroize-audit/tools/emit_rust_ir.sh +150 -0
  248. package/skills/zeroize-audit/tools/emit_rust_mir.sh +158 -0
  249. package/skills/zeroize-audit/tools/extract_compile_flags.py +284 -0
  250. package/skills/zeroize-audit/tools/generate_poc.py +1329 -0
  251. package/skills/zeroize-audit/tools/mcp/apply_confidence_gates.py +113 -0
  252. package/skills/zeroize-audit/tools/mcp/check_mcp.sh +68 -0
  253. package/skills/zeroize-audit/tools/mcp/normalize_mcp_evidence.py +125 -0
  254. package/skills/zeroize-audit/tools/scripts/check_llvm_patterns.py +481 -0
  255. package/skills/zeroize-audit/tools/scripts/check_mir_patterns.py +554 -0
  256. package/skills/zeroize-audit/tools/scripts/check_rust_asm.py +424 -0
  257. package/skills/zeroize-audit/tools/scripts/check_rust_asm_aarch64.py +300 -0
  258. package/skills/zeroize-audit/tools/scripts/check_rust_asm_x86.py +283 -0
  259. package/skills/zeroize-audit/tools/scripts/find_dangerous_apis.py +375 -0
  260. package/skills/zeroize-audit/tools/scripts/semantic_audit.py +923 -0
  261. package/skills/zeroize-audit/tools/track_dataflow.sh +196 -0
  262. package/skills/zeroize-audit/tools/validate_rust_toolchain.sh +298 -0
  263. package/skills/zeroize-audit/workflows/phase-0-preflight.md +150 -0
  264. package/skills/zeroize-audit/workflows/phase-1-source-analysis.md +144 -0
  265. package/skills/zeroize-audit/workflows/phase-2-compiler-analysis.md +139 -0
  266. package/skills/zeroize-audit/workflows/phase-3-interim-report.md +46 -0
  267. package/skills/zeroize-audit/workflows/phase-4-poc-generation.md +46 -0
  268. package/skills/zeroize-audit/workflows/phase-5-poc-validation.md +136 -0
  269. package/skills/zeroize-audit/workflows/phase-6-final-report.md +44 -0
  270. package/skills/zeroize-audit/workflows/phase-7-test-generation.md +42 -0
  271. package/themes/piolium-srcery.json +94 -0
@@ -0,0 +1,737 @@
1
+ # Audit Workflow Reference
2
+
3
+ Detailed per-phase instructions, resource management procedures, and architecture-aware attack pattern catalog for the audit skill.
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Setup](#setup)
8
+ 2. [Phase 1: Intelligence Gathering](#phase-1-intelligence-gathering)
9
+ 3. [Phase 2: Patch Bypass Analysis](#phase-2-patch-bypass-analysis)
10
+ 4. [Phase 3: Knowledge Base](#phase-3-knowledge-base)
11
+ 5. [Phase 4: Static Analysis — Resource Management](#phase-4-static-analysis--resource-management)
12
+ 6. [Phase 5: Enrichment](#phase-5-enrichment)
13
+ 7. [Phase 9: Spec Gap Analysis](#phase-6-spec-gap-analysis)
14
+ 8. [Phase 10: Deep Bug Hunting](#phase-7-deep-bug-hunting)
15
+ 9. [Phase 11: FP Elimination](#phase-8-fp-elimination)
16
+ 9. [Phase 12: Variant Analysis](#phase-9-variant-analysis)
17
+ 10. [Phase 15: Exploitation & Final Reporting](#phase-10-exploitation--final-reporting)
18
+ 11. [Architecture and Project Attack Pattern Catalog](#architecture-and-project-attack-pattern-catalog)
19
+
20
+ ---
21
+
22
+ ## Setup
23
+
24
+ ```bash
25
+ # Create the audit output directory and findings-draft staging area
26
+ mkdir -p archon/ archon/findings-draft/
27
+
28
+ # Initialize or append to audit-state.json (append-only history for this audit session)
29
+ AUDIT_ID=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
30
+ COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
31
+ BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
32
+ NEW_ENTRY="{\"audit_id\":\"$AUDIT_ID\",\"commit\":\"$COMMIT\",\"branch\":\"$BRANCH\",\"mode\":\"full\",\"model\":\"unknown\",\"agent_sdk\":\"unknown\",\"started_at\":\"$AUDIT_ID\",\"completed_at\":null,\"status\":\"in_progress\",\"phases\":{}}"
33
+
34
+ if [ -f archon/audit-state.json ]; then
35
+ # Append new entry to existing audits array
36
+ python3 -c "
37
+ import json, sys
38
+ data = json.load(open('archon/audit-state.json'))
39
+ data['audits'].append(json.loads(sys.argv[1]))
40
+ json.dump(data, open('archon/audit-state.json', 'w'), indent=2)
41
+ " "$NEW_ENTRY"
42
+ else
43
+ # Create new file with first entry
44
+ python3 -c "
45
+ import json, sys
46
+ json.dump({'audits': [json.loads(sys.argv[1])]}, open('archon/audit-state.json', 'w'), indent=2)
47
+ " "$NEW_ENTRY"
48
+ fi
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Phase 1: Intelligence Gathering
54
+
55
+ **Subagent**: `cve-scout`
56
+
57
+ **Goal**: Build a complete inventory of published security advisories, architecture context, and security-relevant dependency intelligence.
58
+
59
+ **Advisory source priority**:
60
+ 1. Project-hosted advisory page (check README, SECURITY.md, or project website)
61
+ 2. GitHub Security Advisories (`gh api graphql` or `gh api repos/{owner}/{repo}/security-advisories`)
62
+ 3. NVD/CVE database (web search for `site:nvd.nist.gov <project-name>`)
63
+ 4. OSV database (`https://osv.dev/list?q=<package-name>`)
64
+ 5. Release notes / changelog (grep for `CVE`, `security`, `vulnerability`)
65
+
66
+ **Architecture inventory**:
67
+ - Identify components, processes, services, plugins, workers, control planes, and external dependencies.
68
+ - Identify transports and protocols: HTTP, gRPC, WebSocket, queues, files, CLI, IPC, schedulers, plugins, agent/tool invocation, and any custom RPC layer.
69
+ - Identify trust boundaries and execution environments: internet-facing, internal-only, desktop-local, CI/CD, control-plane vs data-plane, tenant vs admin.
70
+ - Record the handful of highest-risk flows that deserve Phase 3 DFD/CFD slices.
71
+
72
+ **Dependency intelligence**:
73
+ - Inspect manifests, lockfiles, build files, container files, and deployment config.
74
+ - Note outdated, unsupported, or historically bug-prone dependencies that influence parsing, auth, serialization, policy enforcement, code execution, or network handling.
75
+ - **Action**: Delegate to the `supply-chain-risk-auditor` skill to perform a comprehensive dependency analysis.
76
+ - Treat dependency findings as exploit hypotheses unless a reachable abuse path is established later in the audit.
77
+
78
+ **When only a patched version is known** (no direct commit reference):
79
+
80
+ ```bash
81
+ # Find commits between vulnerable and patched tags
82
+ git log --oneline v<vulnerable>..v<patched>
83
+
84
+ # Narrow to security-relevant files
85
+ git log --oneline v<vulnerable>..v<patched> -- src/archon/ src/auth/ src/validation/
86
+
87
+ # Diff the full range
88
+ git diff v<vulnerable>..v<patched> -- <relevant-paths>
89
+ ```
90
+
91
+ **Output**: `## Advisory Intelligence` section of `archon/attack-surface/knowledge-base-report.md`, populated with advisory inventory, architecture intelligence, vulnerability class patterns, and supply chain risk summary.
92
+
93
+ ---
94
+
95
+ ## Phase 2: Patch Bypass Analysis
96
+
97
+ **Subagent**: `patch-auditor` (one instance per patch)
98
+
99
+ **Goal**: Determine whether each security patch is sound, bypassable, or relocated.
100
+
101
+ **Invocation**: spawn one `patch-auditor` instance per patch commit. Each instance receives:
102
+ - The patch diff (`git show <commit>`)
103
+ - The advisory metadata (CVE/GHSA ID, severity, description)
104
+ - The repository path
105
+
106
+ **Parallelism**: multiple patch-auditor instances can run in parallel since they are read-only.
107
+
108
+ **Output**: `## Bypass Analysis` section of `archon/attack-surface/knowledge-base-report.md`
109
+
110
+ ---
111
+
112
+ ## Phase 3: Knowledge Base
113
+
114
+ **Subagent**: `threat-modeler`
115
+
116
+ **Goal**: Understand the system deeply enough to guide all subsequent phases.
117
+
118
+ **Key questions to answer**:
119
+ - What type of project is this? (See [Architecture and Project Attack Pattern Catalog](#architecture-and-project-attack-pattern-catalog))
120
+ - What are the major components and trust boundaries?
121
+ - How do data and control move between components?
122
+ - Where are the security-critical decisions made?
123
+ - Which paths cross trust boundaries, change execution context, or propagate identity?
124
+ - What does it protect? (Assets)
125
+ - Who can attack it? (Threat actors)
126
+ - Where does attacker input enter? (Attack surface)
127
+ - What specs/RFCs does it implement? (For Phase 9)
128
+
129
+ **Required outputs inside the existing reports**:
130
+ - A compact architecture inventory.
131
+ - DFD slices for only the highest-risk attacker-controlled flows.
132
+ - CFD slices for only the highest-risk authn/authz, policy, routing, orchestration, or privilege-transition paths.
133
+ - A list of components, wrappers, generated interfaces, and unusual trust boundaries that likely require custom Phase 4 modeling.
134
+ - **Action**: Invoke the `security-threat-model` skill to formally document and capture these elements.
135
+
136
+ **Domain Attack Research (Mode A/B/C)**:
137
+
138
+ After architecture mapping and spec identification, run domain attack research:
139
+
140
+ - **Mode A -- Library-as-target**: project type is `library`, `plugin`, or `protocol`. Delegate to
141
+ `sharp-edges` (API footguns), `wooyun-legacy` (web-facing libraries only), and `last30days`
142
+ (recent CVE discussions for the library by name).
143
+
144
+ - **Mode B -- Library-as-consumer**: security-sensitive dependencies identified in Phase 1 or
145
+ Step 2. Delegate to `sharp-edges` (consumer usage), `insecure-defaults` (fail-open configs), and
146
+ `last30days` (per dependency for recent misuse disclosures).
147
+
148
+ - **Mode C -- Domain-specific**: triggered when technology domains are detected (SAML, OAuth, JWT,
149
+ HTTP, gRPC, GraphQL, WebSocket, XML/SOAP, TLS, DNS, SMTP, LDAP, SSH, serialization,
150
+ compression, crypto). For each domain, run the research action sequence from
151
+ `references/domain-attack-playbooks.md`: web search, `last30days`, `wooyun-legacy` (conditional),
152
+ MCP tools (best-effort). Produce a domain attack taxonomy, custom SAST targets, and manual review
153
+ checklist per domain.
154
+
155
+ All three modes are non-exclusive. Run Mode C alongside Mode A/B whenever domains are detected.
156
+ Write results to the `## Domain Attack Research` section of `archon/attack-surface/knowledge-base-report.md`.
157
+
158
+ **Output**: `archon/attack-surface/knowledge-base-report.md` with all Phase 3 sections populated (Project Classification, Architecture, Trust Boundaries, DFD/CFD Slices, Threat Model, Attack Surface, Domain Attack Research, Specs/RFCs, Dependencies, Phase 4 Modeling Targets)
159
+
160
+ ---
161
+
162
+ ## Phase 4: Static Analysis — Resource Management
163
+
164
+ **Subagent**: `code-scanner`
165
+
166
+ **Execution order is mandatory**:
167
+ 1. Run built-in CodeQL suites appropriate to the repo languages via the `codeql` skill.
168
+ 2. Run built-in Semgrep baseline, language, and framework rulesets via the `semgrep` skill.
169
+ 3. Check GitHub Actions workflows using the `agentic-actions-auditor` skill.
170
+ 4. Add custom CodeQL and Semgrep coverage only where the Phase 3 DFD/CFD slices show blind spots, wrappers, or unusual trust boundaries.
171
+ 5. If multiple SARIF outputs are produced, use `sarif-parsing` to deduplicate.
172
+
173
+ ### Concurrency Management
174
+
175
+ CodeQL and Semgrep are resource-intensive. Check before spawning:
176
+
177
+ ```bash
178
+ # Count running SAST processes
179
+ SAST_COUNT=$(ps aux | grep -E 'codeql|semgrep' | grep -v grep | wc -l)
180
+ echo "Running SAST processes: $SAST_COUNT"
181
+
182
+ # Only proceed if count < 2
183
+ if [ "$SAST_COUNT" -ge 2 ]; then
184
+ echo "Too many SAST processes running. Wait before starting."
185
+ exit 1
186
+ fi
187
+ ```
188
+
189
+ ### Disk Space Check
190
+
191
+ CodeQL databases can be large (1-10 GB for large repos). Check before building:
192
+
193
+ ```bash
194
+ # Check available disk space
195
+ df -h .
196
+
197
+ # Estimate repo size
198
+ du -sh <target-repo>
199
+ ```
200
+
201
+ As a rough guide: the CodeQL database is typically 2-5x the size of the source code.
202
+
203
+ ### Language Detection
204
+
205
+ ```bash
206
+ # Detect primary languages
207
+ find <target> -type f | sed 's/.*\.//' | sort | uniq -c | sort -rn | head -20
208
+
209
+ # Or use github-linguist if available
210
+ github-linguist <target>
211
+ ```
212
+
213
+ ### Architecture-Specific Modeling Decision
214
+
215
+ Custom modeling is mandatory when one or more of these are true:
216
+ - security-critical data crosses multiple components or transports
217
+ - identity or policy decisions propagate across service boundaries
218
+ - the codebase relies on custom wrappers around frameworks, RPC, auth, parsing, storage, or execution
219
+ - generated interfaces, IDLs, schemas, plugins, or orchestration layers hide sources, summaries, or sinks from built-in tooling
220
+ - the highest-risk Phase 3 DFD/CFD slices do not map cleanly onto built-in sources, sinks, or enforcement checks
221
+
222
+ When custom modeling is required:
223
+ - store CodeQL artifacts under `archon/codeql-queries/`
224
+ - store Semgrep artifacts under `archon/semgrep-rules/`
225
+ - cite which DFD/CFD slices motivated each custom model or rule
226
+ - open the exact build references in [architecture-aware-sast.md](architecture-aware-sast.md) before writing custom queries or rules
227
+
228
+ See [architecture-aware-sast.md](architecture-aware-sast.md) for the modeling workflow.
229
+
230
+ ### Semgrep Execution Policy
231
+
232
+ Semgrep Pro is mandatory when available, but do not run all Pro-heavy rulesets simultaneously on large repos.
233
+
234
+ Use this execution policy:
235
+ 1. Run a whole-repo baseline pass for high-signal built-in rulesets.
236
+ 2. Separate Pro-heavy taint passes from lightweight structural passes.
237
+ 3. Batch Pro-heavy passes by high-risk subsystem or architecture slice from Phase 3.
238
+ 4. Use file, path, and language scoping aggressively for targeted passes.
239
+ 5. Record any batching, throttling, or narrowed scope in the `## Static Analysis Summary` section of
240
+ `archon/attack-surface/knowledge-base-report.md`.
241
+
242
+ The goal is bounded resource usage without losing baseline built-in coverage.
243
+
244
+ ### Cleanup Commands
245
+
246
+ Run after the report is written:
247
+
248
+ ```bash
249
+ # Remove CodeQL databases (can be very large)
250
+ rm -rf archon/codeql-db/ archon/codeql-db-*/
251
+
252
+ # Remove Semgrep cache
253
+ rm -rf ~/.semgrep/cache/
254
+
255
+ # Remove CodeQL package cache (optional — speeds up future runs if kept)
256
+ # rm -rf ~/.codeql/packages/
257
+
258
+ # Verify cleanup
259
+ du -sh archon/
260
+ ```
261
+
262
+ ### SARIF Merging
263
+
264
+ When multiple SARIF files exist (multi-language CodeQL + Semgrep), use the `sarif-parsing` skill to merge and deduplicate:
265
+
266
+ ```bash
267
+ # Quick merge with jq
268
+ jq -s '{ version: "2.1.0", runs: [ .[].runs[] ] }' \
269
+ archon/codeql-res/*.sarif \
270
+ archon/semgrep-res/*.sarif \
271
+ > archon/merged-results.sarif
272
+ ```
273
+
274
+ **Output**: `## Static Analysis Summary` and `## GitHub Actions Audit` sections of
275
+ `archon/attack-surface/knowledge-base-report.md`. The Static Analysis Summary must record:
276
+ - built-in CodeQL suites and rulesets run
277
+ - built-in Semgrep rulesets run
278
+ - custom CodeQL artifacts run
279
+ - custom Semgrep artifacts run
280
+ - which DFD/CFD slices drove targeted custom analysis
281
+ - any batching, throttling, or coverage tradeoffs with justification
282
+
283
+ ---
284
+
285
+ ## Phase 4.3 — Inline SAST Enrichment
286
+
287
+ Runs as part of Phase 4 (SAST) — not a separate phase.
288
+
289
+ **Goal**: Make the SAST findings more accurate by cross-referencing them against the threat model before chambers see them.
290
+
291
+ ### SAST → Threat Model Enrichment
292
+
293
+ After reading the `## Static Analysis Summary` section of `knowledge-base-report.md`, update the KB if SAST found:
294
+ - New entry points not identified in Phase 3
295
+ - New vulnerability classes relevant to the project type
296
+ - New high-risk functionality not in the attack surface
297
+ - New boundary crossings or decision points missing from the DFD/CFD slices
298
+
299
+ ### Threat Model → SAST FP Filtering
300
+
301
+ Re-evaluate each SAST finding against the threat model:
302
+
303
+ | Project Type | Common FP Patterns |
304
+ |-------------|-------------------|
305
+ | CLI tool | Command execution with user-supplied args is often intentional |
306
+ | Library | Dangerous APIs are often intentional — the caller is responsible |
307
+ | Internal service | Network-only attacks may not apply if not internet-facing |
308
+ | Admin-only feature | Requires admin access — often out of scope for bug bounty |
309
+
310
+ Mark findings as FALSE POSITIVE or OUT OF SCOPE with explicit reasoning tied to the threat model.
311
+ Use the DFD/CFD slices to check whether the finding crosses a real trust boundary or reaches a security-critical decision point.
312
+
313
+ Write enrichment verdicts to the `## SAST Enrichment` section of `archon/attack-surface/knowledge-base-report.md`.
314
+
315
+ ---
316
+
317
+ ## Phase 9: Spec Gap Analysis
318
+
319
+ **Skill**: `spec-to-code-compliance`
320
+
321
+ **Goal**: Find implementation gaps between the project's spec/RFC implementations and the actual standards, focusing on gaps that are concretely exploitable.
322
+
323
+ ### Pre-Work: Read Domain Attack Research
324
+
325
+ Before fetching any spec documents, read the `## Domain Attack Research` section of
326
+ `archon/attack-surface/knowledge-base-report.md`. Use the Mode C attack taxonomy and manual review checklist
327
+ as the primary list of patterns to test during spec gap analysis. This avoids re-researching
328
+ attacks that Phase 3 already catalogued and ensures spec gap analysis focuses on the highest-risk
329
+ protocol-specific patterns.
330
+
331
+ ### Fetching Spec Documents
332
+
333
+ Use web search, fetch tools, or MCP to retrieve official spec documents:
334
+
335
+ ```
336
+ # Examples of spec URLs to fetch
337
+ https://www.rfc-editor.org/rfc/rfc6749 # OAuth 2.0
338
+ https://www.rfc-editor.org/rfc/rfc7519 # JWT
339
+ https://www.rfc-editor.org/rfc/rfc9110 # HTTP Semantics
340
+ https://openid.net/specs/openid-connect-core-1_0.html
341
+ ```
342
+
343
+ ### High-Priority Gap Categories
344
+
345
+ Focus on these categories first — they have the highest historical yield:
346
+
347
+ 1. **Authentication protocol gaps**: OAuth state/nonce, JWT algorithm confusion, SAML assertion validation
348
+ 2. **Parsing discrepancies**: URL parsing, header parsing, multipart parsing (see deep-analysis.md §6)
349
+ 3. **Canonicalization**: case normalization, Unicode normalization, path normalization
350
+ 4. **Replay and freshness**: nonce validation, timestamp checking, token invalidation after use
351
+ 5. **Downgrade attacks**: forced use of weaker algorithm or protocol version
352
+
353
+ ### Exploitability Filter
354
+
355
+ Only include gaps where:
356
+ - An attacker can trigger the gap without requiring physical access or pre-existing full compromise
357
+ - The gap leads to a concrete security impact (auth bypass, data exfiltration, privilege escalation)
358
+ - The gap is not already mitigated by another control in the system
359
+
360
+ **Output**: `## Spec Gap Analysis` section of `archon/attack-surface/knowledge-base-report.md`. If no specs were identified in Phase 3, mark "None identified" and skip.
361
+
362
+ ---
363
+
364
+ ## Phase 10: Review Chamber Deep Bug Hunting
365
+
366
+ **Agents**: `review-adjudicator`, `attack-designer`, `flow-tracer`, `red-challenger`, `variant-spotter` (optional)
367
+
368
+ **Goal**: Find vulnerabilities through structured multi-agent debate. Four specialized roles
369
+ collaborate on each threat cluster to produce findings with higher creativity and lower
370
+ false-positive rates than a single auditor.
371
+
372
+ **Input**: `archon/attack-surface/knowledge-base-report.md` (all sections from phases 1-6),
373
+ `archon/codeql-artifacts/` (structural artifacts from Phase 4)
374
+
375
+ ### Chamber Formation
376
+
377
+ 1. Read `## High-Risk DFD Slices` and `## High-Risk CFD Slices` from the KB
378
+ 2. Group slices by shared trust boundary or component affinity into threat clusters
379
+ 3. Each cluster becomes one Review Chamber (typical: 3-8 chambers)
380
+ 4. Priority order: authentication/authorization first, then data ingestion, then API surface
381
+ 5. Create `archon/chamber-workspace/` and `archon/attack-pattern-registry.json`
382
+
383
+ ### NNN Range Assignment
384
+
385
+ Assign non-overlapping finding ID ranges to prevent collisions across parallel chambers:
386
+ ```
387
+ Chamber 1: p7-001 through p7-019
388
+ Chamber 2: p7-020 through p7-039
389
+ Chamber 3: p7-040 through p7-059
390
+ ...
391
+ ```
392
+
393
+ ### Chamber Spawn (up to 3 concurrent)
394
+
395
+ For each chamber, create the workspace and spawn 4 agents:
396
+ ```bash
397
+ mkdir -p archon/chamber-workspace/<chamber-id>/{evidence,variant-candidates}
398
+ ```
399
+
400
+ - **Chamber Synthesizer**: orchestrates debate, issues verdicts, writes finding drafts
401
+ - **Attack Ideator**: generates 3-7 hypotheses using 8 creative attack modes
402
+ (see `references/creative-attack-modes.md`)
403
+ - **Code Tracer**: traces each hypothesis through code using Method 2.6
404
+ (see `references/deep-analysis.md`)
405
+ - **Devil's Advocate**: challenges every finding at 5 protection layers,
406
+ checks 8 Claude-Specific FP patterns
407
+ - **Variant Scout** (optional, for 3+ DFD slices): monitors debate for confirmed patterns,
408
+ searches for variants concurrently
409
+
410
+ ### Debate Protocol
411
+
412
+ Each chamber proceeds through structured rounds via an append-only transcript at
413
+ `archon/chamber-workspace/<chamber-id>/debate.md`:
414
+
415
+ ```
416
+ Round 1 (Ideation): Ideator generates 3-7 hypotheses
417
+ Round 2 (Tracing): Tracer traces each hypothesis through code
418
+ Round 3 (Challenge): Advocate writes defense brief per hypothesis
419
+ Round 4 (Synthesis): Synthesizer evaluates arguments, issues verdicts
420
+ Round 5-6 (Optional): Focused re-investigation (max 2 per hypothesis)
421
+ ```
422
+
423
+ **Limits**: max 7 hypotheses per batch, max 3 rounds per hypothesis, max 3 concurrent chambers.
424
+
425
+ **Convergence criteria**:
426
+ - Tracer: UNREACHABLE + Advocate confirms → DROP
427
+ - Tracer: REACHABLE + Advocate cannot disprove (2 attempts) → VALID
428
+ - Tracer: REACHABLE + Advocate finds blocking protection → FALSE POSITIVE
429
+ - 3 rounds without resolution → Synthesizer judgment call
430
+ - Low severity → DROP immediately
431
+
432
+ See `references/chamber-protocol.md` for complete format and transcript template.
433
+
434
+ ### Pre-Finding Quality Gate
435
+
436
+ Before the Synthesizer writes any draft, apply 5-point check:
437
+ 1. Attacker control verified by Tracer (not just inferred)?
438
+ 2. Framework protection searched by Advocate (all 5 layers)?
439
+ 3. Trust boundary crossing confirmed (not same-origin)?
440
+ 4. Exploitation requires normal attacker position (not admin)?
441
+ 5. Vulnerable code ships to production (not test/example)?
442
+
443
+ ### Cross-Chamber Intelligence
444
+
445
+ `archon/attack-pattern-registry.json` stores confirmed patterns with detection signatures
446
+ (CodeQL, grep, Semgrep). Other chambers read the registry before new ideation rounds.
447
+
448
+ ### Specialized Delegations
449
+
450
+ Chambers may delegate to specialized skills for scope NOT covered by Phase 3 domain attack
451
+ research: `insecure-defaults`, `sharp-edges`, `wooyun-legacy`, `zeroize-audit`.
452
+
453
+ See [Architecture and Project Attack Pattern Catalog](#architecture-and-project-attack-pattern-catalog) for specific attack patterns.
454
+
455
+ ### Knowledge Base Feedback Loop
456
+
457
+ After all chambers close:
458
+ 1. Collect all finding drafts and variant candidates
459
+ 2. Append `## Phase 10 Addendum` to KB (newly discovered attack surfaces, revised trust
460
+ boundaries, additional DFD/CFD paths). Forward-append only — preserve Phase 3 content.
461
+ 3. Phase 12 must read the updated KB including the addendum.
462
+
463
+ **Output**: `archon/findings-draft/p7-<NNN>-<slug>.md` (Medium+ only),
464
+ `archon/chamber-workspace/<chamber-id>/debate.md` (audit artifacts),
465
+ `archon/attack-pattern-registry.json`,
466
+ `## Phase 10 Addendum` appended to KB
467
+
468
+ ---
469
+
470
+ ## Phase 11: P11-LITE FP Elimination
471
+
472
+ **Goal**: Eliminate false positives. Reduced from full adversarial review because the Devil's
473
+ Advocate already challenged every finding during the Phase 10 chamber debate.
474
+
475
+ ### Stage 1: Analytical FP Check
476
+
477
+ **Skill**: `fp-check`
478
+
479
+ **Retain**: medium-to-critical findings exploitable in a bug bounty context.
480
+
481
+ **Exclude**:
482
+ - By-design behavior (document as such with reasoning)
483
+ - Informational findings (verbose errors, version disclosure without exploit chain)
484
+ - Defense-in-depth gaps with no direct exploit path
485
+ - Issues requiring full system compromise as a prerequisite
486
+ - Admin-only abuse (unless threat model explicitly includes admin-level attackers)
487
+
488
+ **Prioritize**: findings with `Pre-FP-Flag` annotations from the chamber debate.
489
+
490
+ **Incremental verdict persistence**: Write each verdict back into the corresponding
491
+ `archon/findings-draft/p7-*.md` file immediately. Add:
492
+
493
+ ```
494
+ Verdict: VALID | FALSE POSITIVE | BY DESIGN | OUT OF SCOPE | DROP (low severity)
495
+ Rationale: <one-sentence explanation tied to the threat model>
496
+ ```
497
+
498
+ Findings with `FALSE POSITIVE`, `BY DESIGN`, `OUT OF SCOPE`, or `DROP (low severity)` do not
499
+ proceed to Stage 2.
500
+
501
+ ### Stage 2: Cold Verification (CRITICAL and HIGH only)
502
+
503
+ **Medium findings skip Stage 2** — already challenged by the Devil's Advocate during the
504
+ chamber debate. This reduces Phase 11 cost by ~60%.
505
+
506
+ **Applies to**: CRITICAL and HIGH findings with `Verdict: VALID` after Stage 1.
507
+
508
+ **Agent isolation**: Spawn a fresh agent per VALID CRITICAL/HIGH finding. The task description
509
+ contains only the finding draft file path. Do not include the debate transcript, Phase 10 reasoning,
510
+ or any other context. The fresh agent reads methodology from `references/adversarial-review.md`.
511
+
512
+ **Execution**: Cold verification reviews run in parallel across findings.
513
+
514
+ **Steps performed by each cold verifier** (detailed in `adversarial-review.md`):
515
+ 1. Restate and decompose into testable sub-claims
516
+ 2. Independent code path trace from entry point to sink
517
+ 3. Attempt real-environment reproduction (follow `real-env-validation.md`)
518
+ 4. Prosecution + defense briefs
519
+ 5. Severity challenge (start at MEDIUM, require evidence to upgrade)
520
+ 6. Verdict: CONFIRMED or DISPROVED
521
+
522
+ **Verdict integration**: Write results back into the finding draft:
523
+ ```
524
+ Adversarial-Verdict: CONFIRMED | DISPROVED
525
+ Adversarial-Rationale: <one sentence citing the decisive evidence>
526
+ Severity-Final: <challenged severity>
527
+ PoC-Status: executed | theoretical | blocked
528
+ ```
529
+ If `DISPROVED`, also update `Verdict:` to `FALSE POSITIVE (adversarial)`.
530
+
531
+ **Severity reconciliation**: lower severity always wins.
532
+
533
+ **Full review output**: `archon/adversarial-reviews/<slug>-review.md` using the template
534
+ from `report-templates.md`.
535
+
536
+ **Output**: updated `archon/findings-draft/` files (CRITICAL/HIGH with cold verification
537
+ verdicts), `archon/adversarial-reviews/<slug>-review.md` per CRITICAL/HIGH VALID finding
538
+
539
+ ---
540
+
541
+ ## Phase 12: Variant Analysis
542
+
543
+ **Skill**: `variant-analysis`
544
+
545
+ **Goal**: Find similar bugs to each confirmed finding elsewhere in the codebase.
546
+
547
+ **Primary input**: `archon/attack-pattern-registry.json` — the structured registry of confirmed
548
+ patterns from Phase 10 Review Chambers. Each pattern includes `detection_signature` fields with
549
+ ready-made CodeQL, grep, and Semgrep queries for automated variant hunting.
550
+
551
+ For each confirmed finding:
552
+ 1. Read the matching pattern from `archon/attack-pattern-registry.json`
553
+ 2. Run the pattern's `detection_signature` queries (CodeQL, grep, Semgrep) across the codebase
554
+ 3. Check `untested_candidates` from the registry for specific locations to investigate
555
+ 4. Read `archon/chamber-workspace/*/variant-candidates/` for pre-identified candidates from
556
+ Variant Scouts
557
+ 5. Use DFD/CFD slices — including `## Phase 10 Addendum` additions — to search for the same
558
+ flow shape in sibling components, alternate transports, and adjacent enforcement paths
559
+
560
+ **Incremental variant persistence**: Write each confirmed variant immediately to
561
+ `archon/findings-draft/p9-<NNN>-<slug>.md` using the finding draft template. Update the
562
+ attack pattern registry with each confirmed variant.
563
+
564
+ **Output**: `archon/findings-draft/p9-<NNN>-<slug>.md` (one file per variant, Medium or higher only)
565
+
566
+ ---
567
+
568
+ ## Phase 15: Exploitation & Final Reporting
569
+
570
+ **Goal**: Prove the impact of confirmed vulnerabilities through realistic Proof-of-Concepts (PoCs) and generate a professional, executive-ready final report.
571
+
572
+ ### Task A: Draft Promotion
573
+
574
+ Before generating individual reports, promote confirmed findings from the draft staging area:
575
+
576
+ 1. List all files in `archon/findings-draft/` with `Verdict: VALID`.
577
+ 2. Assign severity IDs (`C1`, `H1`, `M1`) in priority order across all confirmed Critical/High/Medium drafts. Discard any `F-NNN` or other sequential IDs used during Phase 10-9 drafting. Low severity findings are dropped entirely — no ID, no report, no summary table entry.
578
+ 3. For each confirmed draft, create `archon/findings/<ID>-<slug>/` and copy the draft as the basis for the `vuln-report` output.
579
+ 4. Leave non-VALID drafts in place for the audit record.
580
+
581
+ ### Task B: Realistic PoCs
582
+
583
+ For each critical, high, and medium bug:
584
+ 1. **Environment Setup**: Identify the minimum setup required for a valid reproduction.
585
+ 2. **PoC Construction**: Use the shortest, most reliable path. Ensure the PoC is representative of a real-world attack (e.g., do not bypass a security boundary that would be present in production).
586
+ 3. **Refinement**: Minimize the PoC code. Style it as a clean, effective exploit script.
587
+
588
+ **Real-environment execution mandate for CRITICAL/HIGH findings**: For every CRITICAL or HIGH finding promoted to `archon/findings/`, PoC execution in a real environment is required before the final report is generated. Reuse the Stage 2 adversarial environment if it was successfully provisioned; otherwise provision a new environment following `real-env-validation.md`.
589
+
590
+ Capture evidence in `archon/findings/<ID>-<slug>/evidence/`:
591
+ ```
592
+ archon/findings/<ID>-<slug>/evidence/
593
+ setup.sh # provisioning commands
594
+ exploit.sh # PoC exploit script
595
+ exploit.log # full output of PoC execution
596
+ impact.log # impact evidence
597
+ ```
598
+
599
+ Annotate each CRITICAL/HIGH finding with:
600
+ ```
601
+ PoC-Status: executed | theoretical | blocked
602
+ ```
603
+
604
+ If execution is blocked, document the specific reason. Do not report a CRITICAL/HIGH finding without this annotation. A `PoC-Status: theoretical` finding must include a `PoC-Block-Reason:` line explaining why execution was not possible.
605
+
606
+ ### Task C: Individual Vulnerability Reports
607
+
608
+ Invoke the `vuln-report` skill for each valid finding:
609
+ - **ID Mapping**: Use severity prefixes `C1`, `H1`, `M1` (Critical/High/Medium). Do not invoke `vuln-report` for Low severity findings.
610
+ - **Naming Convention**: Save each report to `archon/findings/<ID>-<slug>/report.md`.
611
+ - **Structure**: Follow the required sections (Summary, Details, Root Cause, PoC, Impact) exactly as defined in `vuln-report/SKILL.md`.
612
+
613
+ ### Task D: Consolidated Pentest-Style Report
614
+
615
+ This is the mandatory final step to synthesize the entire audit. Generate `archon/final-audit-report.md` using the template in `audit/references/report-templates.md`.
616
+
617
+ **Required Content**:
618
+ - **Executive Summary**: High-level risk assessment for non-technical stakeholders.
619
+ - **Methodology Summary**: Overview of Phases 1-9 to establish technical depth.
620
+ - **Summary Table**: A prioritized list of all **VALID** findings with IDs and severity.
621
+ - **Technical Detail Links**: Technical summaries for each valid finding, linking to the detailed `vuln-report` and PoC.
622
+ - **Conclusion**: Final professional assessment of the project's security posture.
623
+
624
+ ### Task E: Post-Audit Cleanup
625
+
626
+ After the consolidated report is written, delete all working artifacts. Only the knowledge base, final report, and individual findings are retained.
627
+
628
+ ```bash
629
+ rm -rf archon/findings-draft/
630
+ rm -rf archon/adversarial-reviews/
631
+ rm -rf archon/real-env-evidence/
632
+ rm -rf archon/codeql-artifacts/
633
+ rm -rf archon/codeql-queries/
634
+ rm -rf archon/semgrep-rules/
635
+ rm -f archon/audit-state.json
636
+ rm -f archon/merged-results.sarif
637
+ rm -f archon/bounty-scope.md
638
+ ```
639
+
640
+ Verify retained output:
641
+ ```bash
642
+ ls archon/attack-surface/knowledge-base-report.md archon/final-audit-report.md archon/findings/
643
+ ```
644
+
645
+ ---
646
+
647
+ ## Architecture and Project Attack Pattern Catalog
648
+
649
+ These are generic patterns that apply based on project type. For technology-domain-specific attack
650
+ patterns (SAML, OAuth, JWT, HTTP smuggling, gRPC, GraphQL, WebSocket, XML/SOAP, TLS, DNS, SMTP,
651
+ LDAP, SSH, serialization, compression, crypto), see `references/domain-attack-playbooks.md`.
652
+ Domain patterns from Phase 3 Mode C are always higher-priority targets than the generic patterns
653
+ below because they are tailored to the project's specific implementation.
654
+
655
+ ### Cross-Cutting Architecture Patterns
656
+
657
+ Apply these regardless of product type:
658
+
659
+ | Pattern | Where to Look | Key Question |
660
+ |--------|--------------|--------------|
661
+ | Trust-boundary handoff | gateways, workers, handlers, adapters, clients | Does security context change or get widened when crossing the boundary? |
662
+ | Wrapper blindness | custom middleware, helper layers, generated SDKs | Do built-in SAST rules miss the real source, summary, or sink? |
663
+ | Control-plane vs data-plane confusion | admin APIs, job runners, orchestrators, schedulers | Can low-trust input trigger higher-privilege control actions? |
664
+ | Identity propagation drift | session, token, metadata, headers, claims | Is caller identity preserved, narrowed, and re-verified on each hop? |
665
+ | Async guarantee mismatch | queues, events, retries, delayed jobs | Does the consumer assume validation or auth happened earlier when it did not? |
666
+ | Schema or parser differential | serializers, IDLs, schemas, validators | Do two layers parse or normalize the same input differently? |
667
+
668
+ ### Web Application
669
+
670
+ **Primary concerns**: SSRF, XSS, SQLi, auth bypass, IDOR, mass assignment
671
+
672
+ | Attack | Where to Look | Key Question |
673
+ |--------|--------------|--------------|
674
+ | SSRF | URL fetching, webhooks, import features, PDF generation | Can the server be made to fetch internal URLs? |
675
+ | Stored XSS | User-generated content, profile fields, comments | Is output HTML-encoded in all rendering contexts? |
676
+ | SQLi | Search, filter, sort parameters | Is user input concatenated into queries? |
677
+ | IDOR | Resource access by ID | Is ownership verified, not just existence? |
678
+ | Mass assignment | JSON/form body to model | Are protected fields excluded from bulk assignment? |
679
+ | Open redirect | `next`, `return_to`, `redirect` parameters | Is the destination validated against an allowlist? |
680
+ | CSRF | State-changing POST/PUT/DELETE | Is the CSRF token bound to the session? |
681
+ | Path traversal | File download, template rendering | Is the path normalized before the access check? |
682
+
683
+ ### Library
684
+
685
+ **Primary concerns**: unsafe deserialization, injection via API misuse, prototype pollution, ReDoS
686
+
687
+ | Attack | Where to Look | Key Question |
688
+ |--------|--------------|--------------|
689
+ | Unsafe deserialization | `deserialize()`, `parse()`, `fromJSON()` | Are type constraints enforced? |
690
+ | Prototype pollution (JS) | Object merge, deep clone, `set()` with dot-path | Can `__proto__` be set via user input? |
691
+ | ReDoS | Regex patterns applied to user input | Does the pattern have catastrophic backtracking? |
692
+ | Path traversal via API | File path parameters | Is the path sanitized before use? |
693
+ | Command injection | Shell command construction from caller input | Is caller input shell-escaped? |
694
+
695
+ ### CLI Tool
696
+
697
+ **Primary concerns**: argument injection, path traversal, symlink attacks, env var injection
698
+
699
+ | Attack | Where to Look | Key Question |
700
+ |--------|--------------|--------------|
701
+ | Argument injection | Values passed to `exec()`, `spawn()` | Are user-supplied values shell-escaped? |
702
+ | Path traversal | File arguments, config file paths | Are paths normalized and confined to expected dirs? |
703
+ | Symlink attack | Temp file creation, file operations | Does the tool follow symlinks it should not? |
704
+ | Env var injection | Reading sensitive config from environment | Can a lower-privileged process influence the env? |
705
+
706
+ ### Plugin / Extension
707
+
708
+ **Primary concerns**: sandbox escape, privilege escalation, supply chain, cross-plugin leakage
709
+
710
+ | Attack | Where to Look | Key Question |
711
+ |--------|--------------|--------------|
712
+ | Sandbox escape | Host API access, native module loading | Can the plugin access APIs beyond its permissions? |
713
+ | Privilege escalation | Host operations triggered by plugin | Does the host re-verify permissions before acting? |
714
+ | Supply chain | Remote code fetching, auto-update | Is fetched code integrity-verified? |
715
+ | Cross-plugin leakage | Shared storage, event bus | Can one plugin read another's data? |
716
+
717
+ ### Protocol Implementation
718
+
719
+ **Primary concerns**: spec non-compliance, token forgery, replay, downgrade
720
+
721
+ | Attack | Where to Look | Key Question |
722
+ |--------|--------------|--------------|
723
+ | Token forgery | Signature verification, algorithm selection | Is the algorithm verified before the signature? |
724
+ | Replay attack | Nonce/timestamp validation | Are nonces stored and checked for reuse? |
725
+ | Downgrade | Algorithm negotiation | Can the attacker force a weaker algorithm? |
726
+ | State machine bypass | Multi-step flows | Can steps be skipped or reordered? |
727
+
728
+ ### Infrastructure / Agent
729
+
730
+ **Primary concerns**: SSRF, secret exfiltration, command injection, lateral movement
731
+
732
+ | Attack | Where to Look | Key Question |
733
+ |--------|--------------|--------------|
734
+ | SSRF | Job parameters, webhook URLs, artifact fetching | Can job input reach internal metadata endpoints? |
735
+ | Secret exfiltration | Log output, error messages, debug endpoints | Are secrets masked in all output paths? |
736
+ | Command injection | Job parameters passed to shell | Are parameters shell-escaped? |
737
+ | Lateral movement | Credentials scope, IAM roles | Are credentials scoped to minimum required permissions? |