@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.
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/agents/access-auditor.md +300 -0
- package/agents/assumption-breaker.md +154 -0
- package/agents/attack-designer.md +116 -0
- package/agents/code-scanner.md +139 -0
- package/agents/concurrency-auditor.md +238 -0
- package/agents/confirm-writer.md +257 -0
- package/agents/context-reviewer.md +274 -0
- package/agents/cross-verifier.md +165 -0
- package/agents/cve-scout.md +381 -0
- package/agents/env-builder.md +282 -0
- package/agents/env-profiler.md +205 -0
- package/agents/evidence-collector.md +140 -0
- package/agents/finding-grader.md +142 -0
- package/agents/finding-writer.md +148 -0
- package/agents/flow-tracer.md +106 -0
- package/agents/goal-backtracer.md +146 -0
- package/agents/history-miner.md +467 -0
- package/agents/independent-verifier.md +118 -0
- package/agents/intent-mapper.md +183 -0
- package/agents/longshot-collector.md +128 -0
- package/agents/longshot-prober.md +126 -0
- package/agents/patch-auditor.md +73 -0
- package/agents/poc-author.md +124 -0
- package/agents/poc-runner.md +194 -0
- package/agents/probe-lead.md +269 -0
- package/agents/red-challenger.md +101 -0
- package/agents/report-composer.md +208 -0
- package/agents/review-adjudicator.md +216 -0
- package/agents/spec-auditor.md +155 -0
- package/agents/taint-tracer.md +265 -0
- package/agents/test-locator.md +209 -0
- package/agents/threat-modeler.md +132 -0
- package/agents/variant-scanner.md +108 -0
- package/agents/variant-spotter.md +110 -0
- package/bin/piolium.mjs +376 -0
- package/extensions/piolium/_vendor/yaml.bundle.d.mts +6 -0
- package/extensions/piolium/_vendor/yaml.bundle.mjs +139 -0
- package/extensions/piolium/agent-runner.ts +322 -0
- package/extensions/piolium/agents.ts +266 -0
- package/extensions/piolium/audit-state.ts +522 -0
- package/extensions/piolium/bundled-resources.ts +97 -0
- package/extensions/piolium/candidate-scan.ts +966 -0
- package/extensions/piolium/command-target.ts +177 -0
- package/extensions/piolium/console-stream.ts +57 -0
- package/extensions/piolium/export-results.ts +380 -0
- package/extensions/piolium/findings.ts +448 -0
- package/extensions/piolium/heartbeat.ts +182 -0
- package/extensions/piolium/help.ts +234 -0
- package/extensions/piolium/index.ts +1865 -0
- package/extensions/piolium/longshot.ts +530 -0
- package/extensions/piolium/matcher-suggestions.ts +196 -0
- package/extensions/piolium/matcher-utils.ts +83 -0
- package/extensions/piolium/modes/balanced.ts +750 -0
- package/extensions/piolium/modes/confirm-bootstrap.ts +186 -0
- package/extensions/piolium/modes/confirm.ts +697 -0
- package/extensions/piolium/modes/deep.ts +917 -0
- package/extensions/piolium/modes/diff.ts +177 -0
- package/extensions/piolium/modes/lite.ts +540 -0
- package/extensions/piolium/modes/longshot.ts +595 -0
- package/extensions/piolium/modes/merge.ts +204 -0
- package/extensions/piolium/modes/phase-runner.ts +267 -0
- package/extensions/piolium/modes/reinvest.ts +546 -0
- package/extensions/piolium/modes/revisit.ts +279 -0
- package/extensions/piolium/modes.ts +48 -0
- package/extensions/piolium/phase-labels.ts +123 -0
- package/extensions/piolium/phase-status-strip.ts +92 -0
- package/extensions/piolium/prompt-prefix-editor.ts +39 -0
- package/extensions/piolium/providers/anthropic-vertex.ts +836 -0
- package/extensions/piolium/recon.ts +409 -0
- package/extensions/piolium/result-stats.ts +105 -0
- package/extensions/piolium/retry.ts +120 -0
- package/extensions/piolium/scheduler.ts +212 -0
- package/extensions/piolium/secrets.ts +368 -0
- package/extensions/piolium/tools/web-tools.ts +148 -0
- package/package.json +77 -0
- package/skills/agentic-actions-auditor/SKILL.md +327 -0
- package/skills/agentic-actions-auditor/references/action-profiles.md +186 -0
- package/skills/agentic-actions-auditor/references/cross-file-resolution.md +209 -0
- package/skills/agentic-actions-auditor/references/foundations.md +94 -0
- package/skills/agentic-actions-auditor/references/vector-a-env-var-intermediary.md +77 -0
- package/skills/agentic-actions-auditor/references/vector-b-direct-expression-injection.md +83 -0
- package/skills/agentic-actions-auditor/references/vector-c-cli-data-fetch.md +83 -0
- package/skills/agentic-actions-auditor/references/vector-d-pr-target-checkout.md +88 -0
- package/skills/agentic-actions-auditor/references/vector-e-error-log-injection.md +88 -0
- package/skills/agentic-actions-auditor/references/vector-f-subshell-expansion.md +82 -0
- package/skills/agentic-actions-auditor/references/vector-g-eval-of-ai-output.md +91 -0
- package/skills/agentic-actions-auditor/references/vector-h-dangerous-sandbox-configs.md +102 -0
- package/skills/agentic-actions-auditor/references/vector-i-wildcard-allowlists.md +88 -0
- package/skills/audit/SKILL.md +562 -0
- package/skills/audit/assets/icon.svg +7 -0
- package/skills/audit/hooks/scripts/validate_phase_output.py +550 -0
- package/skills/audit/references/adversarial-review.md +148 -0
- package/skills/audit/references/architecture-aware-sast.md +306 -0
- package/skills/audit/references/audit-workflow.md +737 -0
- package/skills/audit/references/chamber-protocol.md +384 -0
- package/skills/audit/references/creative-attack-modes.md +221 -0
- package/skills/audit/references/deep-analysis.md +273 -0
- package/skills/audit/references/domain-attack-playbooks.md +1129 -0
- package/skills/audit/references/knowledge-base-template.md +513 -0
- package/skills/audit/references/real-env-validation.md +191 -0
- package/skills/audit/references/report-templates.md +417 -0
- package/skills/audit/references/triage-and-prereqs.md +134 -0
- package/skills/audit/scripts/consolidate_drafts.py +554 -0
- package/skills/audit/scripts/partition_findings.py +152 -0
- package/skills/audit/scripts/rg-hotspots.sh +121 -0
- package/skills/audit/scripts/stamp_file_state.py +349 -0
- package/skills/code-reviewer/SKILL.md +65 -0
- package/skills/codeql/SKILL.md +281 -0
- package/skills/codeql/references/build-fixes.md +90 -0
- package/skills/codeql/references/diagnostic-query-templates.md +339 -0
- package/skills/codeql/references/extension-yaml-format.md +209 -0
- package/skills/codeql/references/important-only-suite.md +153 -0
- package/skills/codeql/references/language-details.md +207 -0
- package/skills/codeql/references/macos-arm64e-workaround.md +179 -0
- package/skills/codeql/references/performance-tuning.md +111 -0
- package/skills/codeql/references/quality-assessment.md +172 -0
- package/skills/codeql/references/ruleset-catalog.md +63 -0
- package/skills/codeql/references/run-all-suite.md +92 -0
- package/skills/codeql/references/sarif-processing.md +79 -0
- package/skills/codeql/references/threat-models.md +51 -0
- package/skills/codeql/workflows/build-database.md +280 -0
- package/skills/codeql/workflows/create-data-extensions.md +261 -0
- package/skills/codeql/workflows/run-analysis.md +301 -0
- package/skills/differential-review/SKILL.md +220 -0
- package/skills/differential-review/adversarial.md +203 -0
- package/skills/differential-review/methodology.md +234 -0
- package/skills/differential-review/patterns.md +300 -0
- package/skills/differential-review/reporting.md +369 -0
- package/skills/fp-check/SKILL.md +125 -0
- package/skills/fp-check/references/bug-class-verification.md +114 -0
- package/skills/fp-check/references/deep-verification.md +143 -0
- package/skills/fp-check/references/evidence-templates.md +91 -0
- package/skills/fp-check/references/false-positive-patterns.md +115 -0
- package/skills/fp-check/references/gate-reviews.md +27 -0
- package/skills/fp-check/references/standard-verification.md +78 -0
- package/skills/insecure-defaults/SKILL.md +117 -0
- package/skills/insecure-defaults/references/examples.md +409 -0
- package/skills/last30days/SKILL.md +444 -0
- package/skills/sarif-parsing/SKILL.md +483 -0
- package/skills/sarif-parsing/resources/jq-queries.md +162 -0
- package/skills/sarif-parsing/resources/sarif_helpers.py +331 -0
- package/skills/security-threat-model/LICENSE.txt +201 -0
- package/skills/security-threat-model/SKILL.md +81 -0
- package/skills/security-threat-model/agents/openai.yaml +4 -0
- package/skills/security-threat-model/references/prompt-template.md +255 -0
- package/skills/security-threat-model/references/security-controls-and-assets.md +32 -0
- package/skills/semgrep/SKILL.md +212 -0
- package/skills/semgrep/references/rulesets.md +162 -0
- package/skills/semgrep/references/scan-modes.md +110 -0
- package/skills/semgrep/references/scanner-task-prompt.md +140 -0
- package/skills/semgrep/scripts/merge_sarif.py +203 -0
- package/skills/semgrep/workflows/scan-workflow.md +311 -0
- package/skills/semgrep-rule-creator/SKILL.md +168 -0
- package/skills/semgrep-rule-creator/references/quick-reference.md +202 -0
- package/skills/semgrep-rule-creator/references/workflow.md +240 -0
- package/skills/semgrep-rule-variant-creator/SKILL.md +205 -0
- package/skills/semgrep-rule-variant-creator/references/applicability-analysis.md +250 -0
- package/skills/semgrep-rule-variant-creator/references/language-syntax-guide.md +324 -0
- package/skills/semgrep-rule-variant-creator/references/workflow.md +518 -0
- package/skills/sharp-edges/SKILL.md +292 -0
- package/skills/sharp-edges/references/auth-patterns.md +252 -0
- package/skills/sharp-edges/references/case-studies.md +274 -0
- package/skills/sharp-edges/references/config-patterns.md +333 -0
- package/skills/sharp-edges/references/crypto-apis.md +190 -0
- package/skills/sharp-edges/references/lang-c.md +205 -0
- package/skills/sharp-edges/references/lang-csharp.md +285 -0
- package/skills/sharp-edges/references/lang-go.md +270 -0
- package/skills/sharp-edges/references/lang-java.md +263 -0
- package/skills/sharp-edges/references/lang-javascript.md +269 -0
- package/skills/sharp-edges/references/lang-kotlin.md +265 -0
- package/skills/sharp-edges/references/lang-php.md +245 -0
- package/skills/sharp-edges/references/lang-python.md +274 -0
- package/skills/sharp-edges/references/lang-ruby.md +273 -0
- package/skills/sharp-edges/references/lang-rust.md +272 -0
- package/skills/sharp-edges/references/lang-swift.md +287 -0
- package/skills/sharp-edges/references/language-specific.md +588 -0
- package/skills/spec-to-code-compliance/SKILL.md +357 -0
- package/skills/spec-to-code-compliance/resources/COMPLETENESS_CHECKLIST.md +69 -0
- package/skills/spec-to-code-compliance/resources/IR_EXAMPLES.md +417 -0
- package/skills/spec-to-code-compliance/resources/OUTPUT_REQUIREMENTS.md +105 -0
- package/skills/supply-chain-risk-auditor/SKILL.md +67 -0
- package/skills/supply-chain-risk-auditor/resources/results-template.md +41 -0
- package/skills/variant-analysis/METHODOLOGY.md +327 -0
- package/skills/variant-analysis/SKILL.md +142 -0
- package/skills/variant-analysis/resources/codeql/cpp.ql +119 -0
- package/skills/variant-analysis/resources/codeql/go.ql +69 -0
- package/skills/variant-analysis/resources/codeql/java.ql +71 -0
- package/skills/variant-analysis/resources/codeql/javascript.ql +63 -0
- package/skills/variant-analysis/resources/codeql/python.ql +80 -0
- package/skills/variant-analysis/resources/semgrep/cpp.yaml +98 -0
- package/skills/variant-analysis/resources/semgrep/go.yaml +63 -0
- package/skills/variant-analysis/resources/semgrep/java.yaml +61 -0
- package/skills/variant-analysis/resources/semgrep/javascript.yaml +60 -0
- package/skills/variant-analysis/resources/semgrep/python.yaml +72 -0
- package/skills/variant-analysis/resources/variant-report-template.md +75 -0
- package/skills/vuln-report/SKILL.md +137 -0
- package/skills/vuln-report/agents/openai.yaml +4 -0
- package/skills/vuln-report/references/report-template.md +135 -0
- package/skills/wooyun-legacy/SKILL.md +367 -0
- package/skills/wooyun-legacy/references/bank-penetration.md +222 -0
- package/skills/wooyun-legacy/references/checklists/command-execution-checklist.md +119 -0
- package/skills/wooyun-legacy/references/checklists/csrf-checklist.md +74 -0
- package/skills/wooyun-legacy/references/checklists/file-upload-checklist.md +108 -0
- package/skills/wooyun-legacy/references/checklists/info-disclosure-checklist.md +114 -0
- package/skills/wooyun-legacy/references/checklists/logic-flaws-checklist.md +95 -0
- package/skills/wooyun-legacy/references/checklists/misconfig-checklist.md +124 -0
- package/skills/wooyun-legacy/references/checklists/path-traversal-checklist.md +87 -0
- package/skills/wooyun-legacy/references/checklists/rce-checklist.md +93 -0
- package/skills/wooyun-legacy/references/checklists/sql-injection-checklist.md +97 -0
- package/skills/wooyun-legacy/references/checklists/ssrf-checklist.md +99 -0
- package/skills/wooyun-legacy/references/checklists/unauthorized-access-checklist.md +89 -0
- package/skills/wooyun-legacy/references/checklists/weak-password-checklist.md +115 -0
- package/skills/wooyun-legacy/references/checklists/xss-checklist.md +103 -0
- package/skills/wooyun-legacy/references/checklists/xxe-checklist.md +130 -0
- package/skills/wooyun-legacy/references/info-disclosure.md +975 -0
- package/skills/wooyun-legacy/references/logic-flaws.md +721 -0
- package/skills/wooyun-legacy/references/path-traversal.md +1191 -0
- package/skills/wooyun-legacy/references/telecom-penetration.md +156 -0
- package/skills/wooyun-legacy/references/unauthorized-access.md +980 -0
- package/skills/wooyun-legacy/references/xss.md +746 -0
- package/skills/zeroize-audit/SKILL.md +371 -0
- package/skills/zeroize-audit/configs/c.yaml +21 -0
- package/skills/zeroize-audit/configs/default.yaml +128 -0
- package/skills/zeroize-audit/configs/rust.yaml +83 -0
- package/skills/zeroize-audit/prompts/report_template.md +238 -0
- package/skills/zeroize-audit/prompts/system.md +163 -0
- package/skills/zeroize-audit/prompts/task.md +97 -0
- package/skills/zeroize-audit/references/compile-commands.md +231 -0
- package/skills/zeroize-audit/references/detection-strategy.md +191 -0
- package/skills/zeroize-audit/references/ir-analysis.md +252 -0
- package/skills/zeroize-audit/references/mcp-analysis.md +221 -0
- package/skills/zeroize-audit/references/poc-generation.md +470 -0
- package/skills/zeroize-audit/references/rust-zeroization-patterns.md +867 -0
- package/skills/zeroize-audit/schemas/input.json +83 -0
- package/skills/zeroize-audit/schemas/output.json +140 -0
- package/skills/zeroize-audit/tools/analyze_asm.sh +202 -0
- package/skills/zeroize-audit/tools/analyze_cfg.py +381 -0
- package/skills/zeroize-audit/tools/analyze_heap.sh +211 -0
- package/skills/zeroize-audit/tools/analyze_ir_semantic.py +429 -0
- package/skills/zeroize-audit/tools/diff_ir.sh +135 -0
- package/skills/zeroize-audit/tools/diff_rust_mir.sh +189 -0
- package/skills/zeroize-audit/tools/emit_asm.sh +67 -0
- package/skills/zeroize-audit/tools/emit_ir.sh +77 -0
- package/skills/zeroize-audit/tools/emit_rust_asm.sh +178 -0
- package/skills/zeroize-audit/tools/emit_rust_ir.sh +150 -0
- package/skills/zeroize-audit/tools/emit_rust_mir.sh +158 -0
- package/skills/zeroize-audit/tools/extract_compile_flags.py +284 -0
- package/skills/zeroize-audit/tools/generate_poc.py +1329 -0
- package/skills/zeroize-audit/tools/mcp/apply_confidence_gates.py +113 -0
- package/skills/zeroize-audit/tools/mcp/check_mcp.sh +68 -0
- package/skills/zeroize-audit/tools/mcp/normalize_mcp_evidence.py +125 -0
- package/skills/zeroize-audit/tools/scripts/check_llvm_patterns.py +481 -0
- package/skills/zeroize-audit/tools/scripts/check_mir_patterns.py +554 -0
- package/skills/zeroize-audit/tools/scripts/check_rust_asm.py +424 -0
- package/skills/zeroize-audit/tools/scripts/check_rust_asm_aarch64.py +300 -0
- package/skills/zeroize-audit/tools/scripts/check_rust_asm_x86.py +283 -0
- package/skills/zeroize-audit/tools/scripts/find_dangerous_apis.py +375 -0
- package/skills/zeroize-audit/tools/scripts/semantic_audit.py +923 -0
- package/skills/zeroize-audit/tools/track_dataflow.sh +196 -0
- package/skills/zeroize-audit/tools/validate_rust_toolchain.sh +298 -0
- package/skills/zeroize-audit/workflows/phase-0-preflight.md +150 -0
- package/skills/zeroize-audit/workflows/phase-1-source-analysis.md +144 -0
- package/skills/zeroize-audit/workflows/phase-2-compiler-analysis.md +139 -0
- package/skills/zeroize-audit/workflows/phase-3-interim-report.md +46 -0
- package/skills/zeroize-audit/workflows/phase-4-poc-generation.md +46 -0
- package/skills/zeroize-audit/workflows/phase-5-poc-validation.md +136 -0
- package/skills/zeroize-audit/workflows/phase-6-final-report.md +44 -0
- package/skills/zeroize-audit/workflows/phase-7-test-generation.md +42 -0
- package/themes/piolium-srcery.json +94 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Deep Analysis Methods
|
|
2
|
+
|
|
3
|
+
Purpose: define **how** to investigate security controls deeply.
|
|
4
|
+
Out of scope: severity scoring, prerequisite thresholds, and report formatting.
|
|
5
|
+
|
|
6
|
+
## 1) Build a System Model
|
|
7
|
+
|
|
8
|
+
Capture the project model before testing hypotheses:
|
|
9
|
+
|
|
10
|
+
- Components and trust boundaries
|
|
11
|
+
- Exposed interfaces (HTTP, CLI, files, IPC, queues, plugins, tool invocation, control planes)
|
|
12
|
+
- Security-critical assets and operations
|
|
13
|
+
- Deployment assumptions (internet-facing, internal, desktop, CI)
|
|
14
|
+
- Compact DFD slices for high-risk attacker-controlled flows
|
|
15
|
+
- Compact CFD slices for high-risk authn/authz, policy, orchestration, and privilege-transition paths
|
|
16
|
+
|
|
17
|
+
## 2) Trace Trust-Boundary Data Flows
|
|
18
|
+
|
|
19
|
+
For each entry point, map:
|
|
20
|
+
|
|
21
|
+
- Input source
|
|
22
|
+
- Transformations (parse/validate/normalize/encode)
|
|
23
|
+
- Security decision points
|
|
24
|
+
- Sensitive sinks (authz, DB, file, exec, SSRF, crypto, deserialization)
|
|
25
|
+
|
|
26
|
+
Record full path segments so each hypothesis maps to concrete code.
|
|
27
|
+
Use the DFD slices to choose the most security-relevant paths first rather than sampling code uniformly.
|
|
28
|
+
|
|
29
|
+
## 2.5) Trace Control and Decision Flows
|
|
30
|
+
|
|
31
|
+
For each high-risk CFD slice, map:
|
|
32
|
+
|
|
33
|
+
- Entry condition
|
|
34
|
+
- Security gate or policy check
|
|
35
|
+
- Alternate path, fallback, or retry path
|
|
36
|
+
- Privileged action
|
|
37
|
+
- Evidence that the gate applies to every reachable path
|
|
38
|
+
|
|
39
|
+
This catches bugs where data flow looks benign in isolation but control flow enables a bypass.
|
|
40
|
+
|
|
41
|
+
## 2.6) Query CodeQL Structural Artifacts
|
|
42
|
+
|
|
43
|
+
Before manual code tracing for a DFD slice, check what CodeQL already computed. This does not
|
|
44
|
+
replace manual tracing — CodeQL's models are incomplete for custom wrappers and non-standard
|
|
45
|
+
frameworks. But it eliminates redundant work on paths where machine analysis is conclusive,
|
|
46
|
+
and flags exactly where CodeQL stopped tracking (the most interesting spots for manual review).
|
|
47
|
+
|
|
48
|
+
### A. Load the call graph slice
|
|
49
|
+
|
|
50
|
+
Open `archon/codeql-artifacts/call-graph-slices.json` and find the entry for the slice.
|
|
51
|
+
|
|
52
|
+
- **`reachable: true`**: CodeQL found a path. Read the shortest path array to get the concrete
|
|
53
|
+
file:line chain. Start the manual trace at the first hop rather than re-deriving the entry point.
|
|
54
|
+
Manually verify each intermediate node is correctly modeled.
|
|
55
|
+
|
|
56
|
+
- **`reachable: false`**: Not a guarantee of safety. Check: (a) is the source in `entry-points.json`?
|
|
57
|
+
If absent, the built-in model lacks coverage — custom modeling required before the machine result
|
|
58
|
+
is meaningful. (b) Is the sink in `sinks.json`? Same logic. If both are present and still no path,
|
|
59
|
+
CodeQL found no connecting path — investigate whether this reflects genuine architectural isolation,
|
|
60
|
+
or an unmodeled wrapper, type conversion, or async hop.
|
|
61
|
+
|
|
62
|
+
### B. Read informational nodes on the path
|
|
63
|
+
|
|
64
|
+
Open `archon/codeql-artifacts/flow-paths-all-severities.md`. Filter to rules and file paths
|
|
65
|
+
relevant to the slice. Informational results on a flow path mark nodes where CodeQL applied a
|
|
66
|
+
sanitizer model, type narrowing, or path termination. These are the exact locations to scrutinize:
|
|
67
|
+
|
|
68
|
+
- Sanitizer call site is conditional — only runs for certain input shapes
|
|
69
|
+
- Validation function appears once but the validated value is later unwrapped or re-encoded
|
|
70
|
+
- Flow path terminates at an async boundary or serialization hop that built-in models do not cross
|
|
71
|
+
|
|
72
|
+
### C. Consult the machine-generated DFD/CFD diagrams
|
|
73
|
+
|
|
74
|
+
The `## CodeQL Structural Analysis` section of `archon/attack-surface/knowledge-base-report.md` contains
|
|
75
|
+
machine-generated Mermaid DFD and CFD diagrams derived from the extracted artifacts. Use them as
|
|
76
|
+
a navigation aid: identify which path in the DFD matches the slice being reviewed, trace the
|
|
77
|
+
intermediate nodes, and check whether the CFD diagram models the security gates relevant to that
|
|
78
|
+
path. Annotate discrepancies between the machine-generated diagram and the actual code directly
|
|
79
|
+
in the KB as manual corrections.
|
|
80
|
+
|
|
81
|
+
### D. Use the live database for on-demand queries
|
|
82
|
+
|
|
83
|
+
The database at `archon/codeql-artifacts/db/` is live until Phase 12 completes. When a manual
|
|
84
|
+
trace raises a structural question answerable faster by machine — "are there other callers?",
|
|
85
|
+
"what paths reach this sink?", "which functions read this field?" — write and run a narrow QL query:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
codeql query run \
|
|
89
|
+
--database=archon/codeql-artifacts/db/ \
|
|
90
|
+
--output=/tmp/on-demand.bqrs \
|
|
91
|
+
-- archon/codeql-queries/on-demand-<slug>.ql
|
|
92
|
+
|
|
93
|
+
codeql bqrs decode --format=json /tmp/on-demand.bqrs
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Store reusable on-demand queries at `archon/codeql-queries/on-demand-<slug>.ql`. These become
|
|
97
|
+
Phase 12 variant analysis inputs.
|
|
98
|
+
|
|
99
|
+
### E. Cross-reference entry-points with the KB attack surface
|
|
100
|
+
|
|
101
|
+
Compare `entry-points.json` against `## Attack Surface Summary` in `knowledge-base-report.md`.
|
|
102
|
+
Discrepancies where CodeQL found a recognized source absent from the manual KB indicate:
|
|
103
|
+
- An entry point missed by Phase 3 manual review
|
|
104
|
+
- A dynamically registered route, plugin hook, or generated endpoint invisible to static inspection
|
|
105
|
+
|
|
106
|
+
These discrepancies are high-priority Phase 10 targets.
|
|
107
|
+
|
|
108
|
+
### F. Scope and limitations
|
|
109
|
+
|
|
110
|
+
This method requires a working database with meaningful extraction coverage. If
|
|
111
|
+
the `## Static Analysis Summary` section of `archon/attack-surface/knowledge-base-report.md` documents `--build-mode=none` or low extraction quality,
|
|
112
|
+
do not treat `reachable: false` as meaningful — false negatives from poor extraction are likely.
|
|
113
|
+
Document the extraction quality limitation in the Phase 10 Addendum.
|
|
114
|
+
|
|
115
|
+
## 3) Analyze Control Internals
|
|
116
|
+
|
|
117
|
+
Read implementation code (not marketing docs) and extract:
|
|
118
|
+
|
|
119
|
+
- Exact mechanism (allowlist, parser, policy engine, sanitizer, verifier)
|
|
120
|
+
- Assumptions (type, encoding, order of operations, caller privilege)
|
|
121
|
+
- Preconditions required for the control to work
|
|
122
|
+
- Failure modes when assumptions are violated
|
|
123
|
+
|
|
124
|
+
## 4) Generate Attack Hypotheses
|
|
125
|
+
|
|
126
|
+
Derive hypotheses from observed assumptions:
|
|
127
|
+
|
|
128
|
+
- Encoding/normalization mismatches
|
|
129
|
+
- Alternative syntax paths
|
|
130
|
+
- Parser differential behavior
|
|
131
|
+
- Policy bypass via composition or ordering
|
|
132
|
+
- TOCTOU and async race windows
|
|
133
|
+
- Cross-boundary trust confusion
|
|
134
|
+
- Identity propagation drift across hops
|
|
135
|
+
- Schema or IDL drift between producers and consumers
|
|
136
|
+
- Control-plane action triggered from lower-trust surfaces
|
|
137
|
+
- Plugin, tool, or extension capability exposure beyond intended scope
|
|
138
|
+
|
|
139
|
+
Each hypothesis should name attacker capability and target asset.
|
|
140
|
+
|
|
141
|
+
## 5) RFC Gap Analysis Workflow
|
|
142
|
+
|
|
143
|
+
Use this when code appears to implement an RFC-based protocol or format.
|
|
144
|
+
|
|
145
|
+
### A. Identify RFC Scope in Code
|
|
146
|
+
|
|
147
|
+
- Locate parser/serializer/state-machine modules
|
|
148
|
+
- Map implemented sections to RFC requirements (MUST/SHOULD/MAY)
|
|
149
|
+
- Note unsupported sections and declared deviations
|
|
150
|
+
|
|
151
|
+
### B. Research Security-Relevant RFC Clauses
|
|
152
|
+
|
|
153
|
+
- Extract normative constraints affecting validation, canonicalization, auth, replay, downgrade, and interoperability
|
|
154
|
+
- Mark "MUST" clauses as required checks during review
|
|
155
|
+
|
|
156
|
+
### C. Map Historical Attack Patterns
|
|
157
|
+
|
|
158
|
+
- First, read the `## Domain Attack Research` section of `archon/attack-surface/knowledge-base-report.md`.
|
|
159
|
+
Phase 3 Mode C already catalogued known attacks for the identified technology domains. Use the
|
|
160
|
+
domain attack taxonomy and manual review checklist as the starting list — avoid re-researching
|
|
161
|
+
what was already discovered.
|
|
162
|
+
- For any identified domain not covered by Phase 3 Mode C, research known attacks/CVEs against the
|
|
163
|
+
protocol family using web search or MCP tools. See `references/domain-attack-playbooks.md` for
|
|
164
|
+
per-domain templates.
|
|
165
|
+
- Translate patterns into test hypotheses for this implementation.
|
|
166
|
+
- Focus on parser confusion, downgrade, ambiguous canonical form, and state desync.
|
|
167
|
+
|
|
168
|
+
### D. Detect Implementation Gaps
|
|
169
|
+
|
|
170
|
+
For each clause/pattern, classify:
|
|
171
|
+
|
|
172
|
+
- Implemented correctly
|
|
173
|
+
- Partially implemented
|
|
174
|
+
- Missing
|
|
175
|
+
- Implemented but bypassable under composition
|
|
176
|
+
|
|
177
|
+
### E. Report RFC Gaps
|
|
178
|
+
|
|
179
|
+
Write findings to `rfc-gaps-report.md` with:
|
|
180
|
+
|
|
181
|
+
- RFC clause reference
|
|
182
|
+
- Relevant code path
|
|
183
|
+
- Gap classification
|
|
184
|
+
- Exploitability condition
|
|
185
|
+
- Security impact if abused
|
|
186
|
+
|
|
187
|
+
## 6) Parsing, Normalization, and Sanitization Discrepancies
|
|
188
|
+
|
|
189
|
+
Many historical vulnerabilities stem not from missing security controls but from the security control and the dangerous operation using different interpretations of the same input. These are often high-severity because they bypass controls that appear correct in isolation.
|
|
190
|
+
|
|
191
|
+
### URL and Path Parsing Discrepancies
|
|
192
|
+
|
|
193
|
+
The security check and the router/file handler may parse the same URL differently:
|
|
194
|
+
|
|
195
|
+
- **Percent-encoding**: a check that decodes `%2F` → `/` may be bypassed with double encoding `%252F` if the check only decodes once but the handler decodes twice.
|
|
196
|
+
- **Unicode normalization**: `%EF%BC%8F` (fullwidth solidus) may normalize to `/` after the security check runs.
|
|
197
|
+
- **Null bytes**: `path\x00.jpg` may pass an extension check but be truncated by the OS to `path`.
|
|
198
|
+
- **Trailing slashes and dots**: `/admin` vs `/admin/` vs `/admin.` may be treated differently by the router vs the auth check.
|
|
199
|
+
- **Backslash normalization**: `path\..\..\etc\passwd` on Windows may not be caught by a Unix-style path traversal check.
|
|
200
|
+
|
|
201
|
+
### Header Injection via Spec-Non-Compliant Parsing
|
|
202
|
+
|
|
203
|
+
- **CRLF injection**: if a header value is not stripped of `\r\n`, an attacker can inject additional headers.
|
|
204
|
+
- **Header folding**: obsolete HTTP/1.1 header folding (continuation lines starting with whitespace) may be parsed differently by proxies and backends.
|
|
205
|
+
- **Multiple header values**: `Authorization: Bearer token1\r\nAuthorization: Bearer token2` — which value does each layer use?
|
|
206
|
+
- **`X-Forwarded-For` and IP spoofing**: rate limiting or access control keyed on the client IP from `X-Forwarded-For` can be bypassed by adding the header.
|
|
207
|
+
|
|
208
|
+
### Content-Type and Format Confusion
|
|
209
|
+
|
|
210
|
+
- **ZIP/Office confusion**: `.docx`, `.xlsx`, `.jar` are ZIP files. A content-type check that allows `application/zip` may allow Office files, and vice versa.
|
|
211
|
+
- **Polyglot files**: a file that is simultaneously valid in two formats (e.g., a JPEG that is also a valid ZIP) can bypass format-specific checks.
|
|
212
|
+
- **Multipart boundary tricks**: a multipart body with a crafted boundary may be parsed differently by the framework vs the application code.
|
|
213
|
+
- **JSON/XML type confusion**: a field expected to be a string that accepts an object or array may bypass string-specific sanitization.
|
|
214
|
+
|
|
215
|
+
### Sanitization Applied at the Wrong Stage
|
|
216
|
+
|
|
217
|
+
- **Sanitize-then-parse**: sanitizing HTML before parsing means the parser may reconstruct dangerous markup from sanitized fragments (mutation XSS).
|
|
218
|
+
- **Parse-then-sanitize**: parsing before sanitizing means the sanitizer operates on the parsed DOM, which may differ from what the browser re-parses.
|
|
219
|
+
- **Double sanitization**: applying HTML encoding twice can produce encoded entities that are decoded by the browser into dangerous content.
|
|
220
|
+
- **Context mismatch**: sanitizing for HTML context but inserting into a JavaScript or CSS context.
|
|
221
|
+
|
|
222
|
+
### Spec-Non-Compliant Behavior as a Vulnerability Source
|
|
223
|
+
|
|
224
|
+
When a project implements a standard protocol or format, deviations from the spec are a primary source of exploitable bugs:
|
|
225
|
+
|
|
226
|
+
- **JWT algorithm confusion**: accepting `alg: none` or allowing RS256 tokens to be verified as HS256 (using the public key as the HMAC secret).
|
|
227
|
+
- **OAuth `redirect_uri` validation**: accepting prefix matches, allowing subdomains, or not validating the scheme allows open redirect and code theft.
|
|
228
|
+
- **OAuth `state` parameter omission**: missing or non-validated `state` enables CSRF on the OAuth callback.
|
|
229
|
+
- **XML namespace handling**: namespace-aware parsers and namespace-unaware parsers may interpret the same document differently, enabling signature wrapping attacks.
|
|
230
|
+
- **SAML assertion validation**: checking the wrong element, accepting unsigned assertions, or not validating the `InResponseTo` field.
|
|
231
|
+
- **HTTP request smuggling**: discrepancies between `Content-Length` and `Transfer-Encoding` handling between a proxy and a backend.
|
|
232
|
+
- **Cookie attribute parsing**: browsers and servers may parse `SameSite`, `Secure`, and `HttpOnly` attributes differently for malformed cookie headers.
|
|
233
|
+
|
|
234
|
+
### Canonicalization Attacks
|
|
235
|
+
|
|
236
|
+
- **Case normalization**: a check for `script` may miss `SCRIPT` or `Script` if case normalization happens after the check.
|
|
237
|
+
- **Unicode case folding**: `ı` (Turkish dotless i) uppercases to `I` in some locales, which can bypass case-insensitive checks.
|
|
238
|
+
- **Homoglyph substitution**: visually similar Unicode characters (e.g., Cyrillic `а` vs Latin `a`) may bypass string equality checks.
|
|
239
|
+
- **IDN homograph**: internationalized domain names can be used to bypass domain allowlists.
|
|
240
|
+
|
|
241
|
+
## 7) Validate in Context
|
|
242
|
+
|
|
243
|
+
When runtime checks are authorized:
|
|
244
|
+
|
|
245
|
+
- Use deterministic, minimal tests
|
|
246
|
+
- Verify both isolated and composed paths
|
|
247
|
+
- Re-check under realistic deployment assumptions
|
|
248
|
+
|
|
249
|
+
## 8) Evidence Quality Bar
|
|
250
|
+
|
|
251
|
+
High-quality deep-analysis evidence includes:
|
|
252
|
+
|
|
253
|
+
- Explicit trust-boundary crossing
|
|
254
|
+
- Concrete attacker-controlled input path
|
|
255
|
+
- Demonstrated or strongly justified control failure
|
|
256
|
+
- Concrete attacker gain tied to protected assets
|
|
257
|
+
|
|
258
|
+
## 9) How Later Phases Reuse the Model
|
|
259
|
+
|
|
260
|
+
Phase 3 DFD/CFD slices are not optional notes. Use them directly in later phases:
|
|
261
|
+
|
|
262
|
+
- **Phase 4**: generate custom CodeQL models, custom QL queries, and custom Semgrep rules for blind
|
|
263
|
+
spots; also run structural extraction (method 2.6 inputs: entry-points.json, sinks.json,
|
|
264
|
+
call-graph-slices.json, flow-paths-all-severities.md, machine-generated DFD/CFD diagrams)
|
|
265
|
+
- **Phase 5**: decide whether a SAST finding crosses a real trust boundary or reaches a real policy
|
|
266
|
+
gate; use call-graph-slices.json for machine-assisted reachability before manual assessment
|
|
267
|
+
- **Phase 9**: map specs, IDLs, and contracts to the exact implementation points in the flow
|
|
268
|
+
- **Phase 10**: apply method 2.6 to front-load machine-computed path information before manual
|
|
269
|
+
tracing; use informational nodes from flow-paths-all-severities.md to locate sanitizer/validation
|
|
270
|
+
sites that warrant close scrutiny
|
|
271
|
+
- **Phase 11**: judge exploitability from actual flow reachability, not isolated code smell
|
|
272
|
+
- **Phase 12**: search for the same flow shape in sibling components using on-demand QL queries
|
|
273
|
+
and AST-level structural matches against the live database
|