@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,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "zeroize-audit input",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"path": { "type": "string", "description": "Repository root path" },
|
|
7
|
+
"compile_db": { "type": ["string", "null"], "default": null, "description": "Path to compile_commands.json for C/C++ analysis. Required if cargo_manifest is not set." },
|
|
8
|
+
"cargo_manifest": { "type": ["string", "null"], "default": null, "description": "Path to Cargo.toml for Rust crate analysis. Required if compile_db is not set." },
|
|
9
|
+
"config": { "type": ["string", "null"], "description": "Path to config YAML" },
|
|
10
|
+
"opt_levels": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": { "type": "string", "enum": ["O0", "O1", "O2", "O3", "Os", "Oz"] },
|
|
13
|
+
"default": ["O0", "O1", "O2"]
|
|
14
|
+
},
|
|
15
|
+
"languages": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": { "type": "string", "enum": ["c", "cpp", "rust"] },
|
|
18
|
+
"default": ["c", "cpp", "rust"]
|
|
19
|
+
},
|
|
20
|
+
"max_tus": { "type": "integer", "minimum": 1, "default": 50 },
|
|
21
|
+
"enable_semantic_ir": { "type": "boolean", "default": false, "description": "Enable semantic LLVM IR analysis" },
|
|
22
|
+
"enable_cfg": { "type": "boolean", "default": false, "description": "Enable control-flow graph analysis" },
|
|
23
|
+
"enable_runtime_tests": { "type": "boolean", "default": false, "description": "Enable runtime PoC test generation and execution" },
|
|
24
|
+
"enable_asm": { "type": "boolean", "default": true, "description": "Enable assembly emission and analysis" },
|
|
25
|
+
"mcp_mode": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": ["off", "prefer", "require"],
|
|
28
|
+
"default": "prefer",
|
|
29
|
+
"description": "Control MCP semantic analysis usage"
|
|
30
|
+
},
|
|
31
|
+
"mcp_required_for_advanced": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"default": true,
|
|
34
|
+
"description": "Downgrade advanced findings when MCP semantic evidence is unavailable"
|
|
35
|
+
},
|
|
36
|
+
"mcp_timeout_ms": {
|
|
37
|
+
"type": "integer",
|
|
38
|
+
"minimum": 100,
|
|
39
|
+
"default": 10000,
|
|
40
|
+
"description": "Timeout budget for MCP semantic queries"
|
|
41
|
+
},
|
|
42
|
+
"poc_categories": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"enum": [
|
|
47
|
+
"MISSING_SOURCE_ZEROIZE",
|
|
48
|
+
"PARTIAL_WIPE",
|
|
49
|
+
"NOT_ON_ALL_PATHS",
|
|
50
|
+
"OPTIMIZED_AWAY_ZEROIZE",
|
|
51
|
+
"STACK_RETENTION",
|
|
52
|
+
"REGISTER_SPILL",
|
|
53
|
+
"SECRET_COPY",
|
|
54
|
+
"INSECURE_HEAP_ALLOC",
|
|
55
|
+
"MISSING_ON_ERROR_PATH",
|
|
56
|
+
"NOT_DOMINATING_EXITS",
|
|
57
|
+
"LOOP_UNROLLED_INCOMPLETE"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"default": [
|
|
61
|
+
"MISSING_SOURCE_ZEROIZE",
|
|
62
|
+
"PARTIAL_WIPE",
|
|
63
|
+
"NOT_ON_ALL_PATHS",
|
|
64
|
+
"OPTIMIZED_AWAY_ZEROIZE",
|
|
65
|
+
"STACK_RETENTION",
|
|
66
|
+
"REGISTER_SPILL",
|
|
67
|
+
"SECRET_COPY",
|
|
68
|
+
"INSECURE_HEAP_ALLOC",
|
|
69
|
+
"MISSING_ON_ERROR_PATH",
|
|
70
|
+
"NOT_DOMINATING_EXITS",
|
|
71
|
+
"LOOP_UNROLLED_INCOMPLETE"
|
|
72
|
+
],
|
|
73
|
+
"description": "Finding categories for which to generate PoCs"
|
|
74
|
+
},
|
|
75
|
+
"poc_output_dir": {
|
|
76
|
+
"type": ["string", "null"],
|
|
77
|
+
"default": null,
|
|
78
|
+
"description": "Output directory for generated PoCs (default: generated_pocs/)"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": ["path"],
|
|
82
|
+
"additionalProperties": false
|
|
83
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "zeroize-audit output",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"tool": { "type": "string", "const": "zeroize-audit" },
|
|
7
|
+
"version": { "type": "string" },
|
|
8
|
+
"summary": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"path": { "type": "string" },
|
|
12
|
+
"files_scanned": { "type": "integer", "minimum": 0 },
|
|
13
|
+
"translation_units_analyzed": { "type": "integer", "minimum": 0 },
|
|
14
|
+
"issues_found": { "type": "integer", "minimum": 0 },
|
|
15
|
+
"by_category": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"MISSING_SOURCE_ZEROIZE": { "type": "integer", "minimum": 0 },
|
|
19
|
+
"OPTIMIZED_AWAY_ZEROIZE": { "type": "integer", "minimum": 0 },
|
|
20
|
+
"PARTIAL_WIPE": { "type": "integer", "minimum": 0 },
|
|
21
|
+
"NOT_ON_ALL_PATHS": { "type": "integer", "minimum": 0 },
|
|
22
|
+
"STACK_RETENTION": { "type": "integer", "minimum": 0 },
|
|
23
|
+
"REGISTER_SPILL": { "type": "integer", "minimum": 0 },
|
|
24
|
+
"SECRET_COPY": { "type": "integer", "minimum": 0 },
|
|
25
|
+
"INSECURE_HEAP_ALLOC": { "type": "integer", "minimum": 0 },
|
|
26
|
+
"MISSING_ON_ERROR_PATH": { "type": "integer", "minimum": 0 },
|
|
27
|
+
"LOOP_UNROLLED_INCOMPLETE": { "type": "integer", "minimum": 0 },
|
|
28
|
+
"NOT_DOMINATING_EXITS": { "type": "integer", "minimum": 0 }
|
|
29
|
+
},
|
|
30
|
+
"required": [
|
|
31
|
+
"MISSING_SOURCE_ZEROIZE",
|
|
32
|
+
"OPTIMIZED_AWAY_ZEROIZE",
|
|
33
|
+
"PARTIAL_WIPE",
|
|
34
|
+
"NOT_ON_ALL_PATHS",
|
|
35
|
+
"STACK_RETENTION",
|
|
36
|
+
"REGISTER_SPILL",
|
|
37
|
+
"SECRET_COPY",
|
|
38
|
+
"INSECURE_HEAP_ALLOC",
|
|
39
|
+
"MISSING_ON_ERROR_PATH",
|
|
40
|
+
"LOOP_UNROLLED_INCOMPLETE",
|
|
41
|
+
"NOT_DOMINATING_EXITS"
|
|
42
|
+
],
|
|
43
|
+
"additionalProperties": false
|
|
44
|
+
},
|
|
45
|
+
"poc_generation": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"properties": {
|
|
48
|
+
"pocs_generated": { "type": "integer", "minimum": 0 },
|
|
49
|
+
"pocs_requiring_adjustment": { "type": "integer", "minimum": 0 },
|
|
50
|
+
"output_dir": { "type": "string" },
|
|
51
|
+
"categories_covered": { "type": "array", "items": { "type": "string" } }
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"poc_validation_summary": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"total_findings": { "type": "integer", "minimum": 0 },
|
|
58
|
+
"pocs_generated": { "type": "integer", "minimum": 0 },
|
|
59
|
+
"pocs_validated": { "type": "integer", "minimum": 0 },
|
|
60
|
+
"exploitable_confirmed": { "type": "integer", "minimum": 0 },
|
|
61
|
+
"not_exploitable": { "type": "integer", "minimum": 0 },
|
|
62
|
+
"compile_failures": { "type": "integer", "minimum": 0 },
|
|
63
|
+
"no_poc_generated": { "type": "integer", "minimum": 0 }
|
|
64
|
+
},
|
|
65
|
+
"required": ["total_findings", "pocs_generated", "pocs_validated", "exploitable_confirmed", "not_exploitable", "compile_failures", "no_poc_generated"],
|
|
66
|
+
"additionalProperties": false
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": ["path", "files_scanned", "translation_units_analyzed", "issues_found", "by_category", "poc_validation_summary"],
|
|
70
|
+
"additionalProperties": false
|
|
71
|
+
},
|
|
72
|
+
"findings": {
|
|
73
|
+
"type": "array",
|
|
74
|
+
"items": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"properties": {
|
|
77
|
+
"id": { "type": "string" },
|
|
78
|
+
"category": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"enum": [
|
|
81
|
+
"MISSING_SOURCE_ZEROIZE",
|
|
82
|
+
"OPTIMIZED_AWAY_ZEROIZE",
|
|
83
|
+
"PARTIAL_WIPE",
|
|
84
|
+
"NOT_ON_ALL_PATHS",
|
|
85
|
+
"STACK_RETENTION",
|
|
86
|
+
"REGISTER_SPILL",
|
|
87
|
+
"SECRET_COPY",
|
|
88
|
+
"INSECURE_HEAP_ALLOC",
|
|
89
|
+
"MISSING_ON_ERROR_PATH",
|
|
90
|
+
"LOOP_UNROLLED_INCOMPLETE",
|
|
91
|
+
"NOT_DOMINATING_EXITS"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"severity": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
|
|
95
|
+
"confidence": { "type": "string", "enum": ["confirmed", "likely", "needs_review"] },
|
|
96
|
+
"language": { "type": "string", "enum": ["c", "cpp", "rust", "unknown"] },
|
|
97
|
+
"file": { "type": "string" },
|
|
98
|
+
"line": { "type": "integer", "minimum": 1 },
|
|
99
|
+
"symbol": { "type": ["string", "null"] },
|
|
100
|
+
"evidence": { "type": "string" },
|
|
101
|
+
"compiler_evidence": {
|
|
102
|
+
"type": ["object", "null"],
|
|
103
|
+
"properties": {
|
|
104
|
+
"opt_levels": { "type": "array", "items": { "type": "string" } },
|
|
105
|
+
"o0": { "type": ["string", "null"] },
|
|
106
|
+
"o1": { "type": ["string", "null"] },
|
|
107
|
+
"o2": { "type": ["string", "null"] },
|
|
108
|
+
"o3": { "type": ["string", "null"] },
|
|
109
|
+
"diff_summary": { "type": ["string", "null"] }
|
|
110
|
+
},
|
|
111
|
+
"required": ["opt_levels"],
|
|
112
|
+
"additionalProperties": false
|
|
113
|
+
},
|
|
114
|
+
"suggested_fix": { "type": "string" },
|
|
115
|
+
"poc": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"properties": {
|
|
118
|
+
"file": { "type": "string" },
|
|
119
|
+
"makefile_target": { "type": "string" },
|
|
120
|
+
"compile_opt": { "type": "string" },
|
|
121
|
+
"requires_manual_adjustment": { "type": "boolean" },
|
|
122
|
+
"adjustment_notes": { "type": ["string", "null"] },
|
|
123
|
+
"exit_code": { "type": ["integer", "null"] },
|
|
124
|
+
"validated": { "type": "boolean" },
|
|
125
|
+
"validation_result": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"enum": ["exploitable", "not_exploitable", "compile_failure", "no_poc", "pending"]
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"required": ["file", "makefile_target", "compile_opt", "requires_manual_adjustment", "validated", "validation_result"]
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": ["id", "category", "severity", "confidence", "language", "file", "line", "evidence", "suggested_fix", "poc"],
|
|
134
|
+
"additionalProperties": false
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"required": ["tool", "version", "summary", "findings"],
|
|
139
|
+
"additionalProperties": false
|
|
140
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Analyze assembly for secret exposure patterns.
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# analyze_asm.sh --asm path/to/file.s --symbol secret_func --out /tmp/analysis.json
|
|
8
|
+
#
|
|
9
|
+
# Detects:
|
|
10
|
+
# - Register spills to stack (movq/movdqa %reg, -offset(%rbp/%rsp))
|
|
11
|
+
# - Stack allocations that may retain secrets
|
|
12
|
+
# - Missing red-zone clearing
|
|
13
|
+
# - Secrets in callee-saved registers pushed to stack
|
|
14
|
+
|
|
15
|
+
usage() {
|
|
16
|
+
echo "Usage: $0 --asm <file.s> --out <analysis.json> [--symbol <func_name>]" >&2
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
json_escape() {
|
|
20
|
+
local s="$1"
|
|
21
|
+
s="${s//\\/\\\\}"
|
|
22
|
+
s="${s//\"/\\\"}"
|
|
23
|
+
s="${s//$'\n'/\\n}"
|
|
24
|
+
s="${s//$'\t'/\\t}"
|
|
25
|
+
printf '%s' "$s"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ASM=""
|
|
29
|
+
SYMBOL=""
|
|
30
|
+
OUT=""
|
|
31
|
+
|
|
32
|
+
while [[ $# -gt 0 ]]; do
|
|
33
|
+
case "$1" in
|
|
34
|
+
--asm)
|
|
35
|
+
ASM="$2"
|
|
36
|
+
shift 2
|
|
37
|
+
;;
|
|
38
|
+
--symbol)
|
|
39
|
+
SYMBOL="$2"
|
|
40
|
+
shift 2
|
|
41
|
+
;;
|
|
42
|
+
--out)
|
|
43
|
+
OUT="$2"
|
|
44
|
+
shift 2
|
|
45
|
+
;;
|
|
46
|
+
*)
|
|
47
|
+
echo "Unknown arg: $1" >&2
|
|
48
|
+
usage
|
|
49
|
+
exit 2
|
|
50
|
+
;;
|
|
51
|
+
esac
|
|
52
|
+
done
|
|
53
|
+
|
|
54
|
+
if [[ -z "$ASM" || -z "$OUT" ]]; then
|
|
55
|
+
usage
|
|
56
|
+
exit 2
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
if [[ ! -f "$ASM" ]]; then
|
|
60
|
+
echo "Assembly file not found: $ASM" >&2
|
|
61
|
+
exit 2
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# Extract function boundaries if symbol specified
|
|
65
|
+
START_LINE=1
|
|
66
|
+
END_LINE=$(wc -l <"$ASM")
|
|
67
|
+
|
|
68
|
+
if [[ -n "$SYMBOL" ]]; then
|
|
69
|
+
# Find function start/end
|
|
70
|
+
START_LINE=$(grep -n "^${SYMBOL}:" "$ASM" | head -1 | cut -d: -f1 || echo "")
|
|
71
|
+
if [[ -z "$START_LINE" ]]; then
|
|
72
|
+
echo "WARNING: symbol '${SYMBOL}' not found in $ASM; analyzing full file" >&2
|
|
73
|
+
START_LINE=1
|
|
74
|
+
fi
|
|
75
|
+
# Find next function or end of file
|
|
76
|
+
END_LINE=$(tail -n +"$((START_LINE + 1))" "$ASM" | grep -n "^[a-zA-Z_][a-zA-Z0-9_]*:" | head -1 | cut -d: -f1 || echo "$(($(wc -l <"$ASM") - START_LINE + 1))")
|
|
77
|
+
END_LINE=$((START_LINE + END_LINE - 1))
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
# Extract function body
|
|
81
|
+
FUNC_ASM=$(sed -n "${START_LINE},${END_LINE}p" "$ASM")
|
|
82
|
+
|
|
83
|
+
# Detect patterns
|
|
84
|
+
REGISTER_SPILLS=()
|
|
85
|
+
STACK_STORES=()
|
|
86
|
+
CALLEE_SAVED_PUSHES=()
|
|
87
|
+
STACK_SIZE=0
|
|
88
|
+
RED_ZONE_CLEARED=false
|
|
89
|
+
|
|
90
|
+
# Parse assembly
|
|
91
|
+
while IFS= read -r line; do
|
|
92
|
+
# Skip comments and empty lines
|
|
93
|
+
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
|
94
|
+
[[ -z "${line// /}" ]] && continue
|
|
95
|
+
|
|
96
|
+
# Detect stack allocation (subq $size, %rsp)
|
|
97
|
+
if [[ "$line" =~ subq[[:space:]]+\$([0-9]+),[[:space:]]*%rsp ]]; then
|
|
98
|
+
STACK_SIZE="${BASH_REMATCH[1]}"
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# Detect register spills to stack (movq/movdqa/movaps %reg, -offset(%rsp/%rbp))
|
|
102
|
+
if [[ "$line" =~ (movq|movdqa|movaps|movups|vmovdqa|vmovaps)[[:space:]]+%([a-z0-9]+),[[:space:]]*-([0-9]+)\(%(rsp|rbp)\) ]]; then
|
|
103
|
+
REG="${BASH_REMATCH[2]}"
|
|
104
|
+
OFFSET="${BASH_REMATCH[3]}"
|
|
105
|
+
BASE="${BASH_REMATCH[4]}"
|
|
106
|
+
REGISTER_SPILLS+=("{\"register\": \"$REG\", \"offset\": -$OFFSET, \"base\": \"$BASE\", \"line\": \"$(json_escape "$line")\"}")
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
# Detect stores to stack (mov* reg/imm, -offset(%rsp/%rbp))
|
|
110
|
+
if [[ "$line" =~ mov[a-z]*[[:space:]]+[^,]+,[[:space:]]*-([0-9]+)\(%(rsp|rbp)\) ]]; then
|
|
111
|
+
OFFSET="${BASH_REMATCH[1]}"
|
|
112
|
+
BASE="${BASH_REMATCH[2]}"
|
|
113
|
+
STACK_STORES+=("{\"offset\": -$OFFSET, \"base\": \"$BASE\", \"line\": \"$(json_escape "$line")\"}")
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# Detect callee-saved register pushes (pushq %rbx/%r12/%r13/%r14/%r15/%rbp)
|
|
117
|
+
if [[ "$line" =~ pushq[[:space:]]+%(rbx|r12|r13|r14|r15|rbp) ]]; then
|
|
118
|
+
REG="${BASH_REMATCH[1]}"
|
|
119
|
+
CALLEE_SAVED_PUSHES+=("{\"register\": \"$REG\", \"line\": \"$(json_escape "$line")\"}")
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Detect red-zone clearing (movq $0, -offset(%rsp) for offset <= 128)
|
|
123
|
+
if [[ "$line" =~ movq[[:space:]]+\$0,[[:space:]]*-([0-9]+)\(%rsp\) ]]; then
|
|
124
|
+
OFFSET="${BASH_REMATCH[1]}"
|
|
125
|
+
if [[ "$OFFSET" -le 128 ]]; then
|
|
126
|
+
RED_ZONE_CLEARED=true
|
|
127
|
+
fi
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
done <<<"$FUNC_ASM"
|
|
131
|
+
|
|
132
|
+
# Generate JSON report
|
|
133
|
+
mkdir -p "$(dirname "$OUT")"
|
|
134
|
+
|
|
135
|
+
cat >"$OUT" <<EOF
|
|
136
|
+
{
|
|
137
|
+
"asm_file": "$ASM",
|
|
138
|
+
"symbol": "$SYMBOL",
|
|
139
|
+
"analysis": {
|
|
140
|
+
"stack_size": $STACK_SIZE,
|
|
141
|
+
"red_zone_cleared": $RED_ZONE_CLEARED,
|
|
142
|
+
"register_spills": [
|
|
143
|
+
$(
|
|
144
|
+
IFS=,
|
|
145
|
+
echo "${REGISTER_SPILLS[*]}"
|
|
146
|
+
)
|
|
147
|
+
],
|
|
148
|
+
"stack_stores": [
|
|
149
|
+
$(
|
|
150
|
+
IFS=,
|
|
151
|
+
echo "${STACK_STORES[*]}"
|
|
152
|
+
)
|
|
153
|
+
],
|
|
154
|
+
"callee_saved_pushes": [
|
|
155
|
+
$(
|
|
156
|
+
IFS=,
|
|
157
|
+
echo "${CALLEE_SAVED_PUSHES[*]}"
|
|
158
|
+
)
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"warnings": []
|
|
162
|
+
}
|
|
163
|
+
EOF
|
|
164
|
+
|
|
165
|
+
# Validate JSON output
|
|
166
|
+
if command -v jq &>/dev/null; then
|
|
167
|
+
if ! jq empty "$OUT" 2>/dev/null; then
|
|
168
|
+
echo "ERROR: generated JSON is malformed: $OUT" >&2
|
|
169
|
+
exit 1
|
|
170
|
+
fi
|
|
171
|
+
fi
|
|
172
|
+
|
|
173
|
+
# Add warnings based on findings
|
|
174
|
+
WARNINGS=()
|
|
175
|
+
|
|
176
|
+
if [[ ${#REGISTER_SPILLS[@]} -gt 0 ]]; then
|
|
177
|
+
WARNINGS+=("{\"type\": \"REGISTER_SPILL\", \"message\": \"Found ${#REGISTER_SPILLS[@]} register spill(s) to stack. Spilled values may contain secrets.\"}")
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
if [[ $STACK_SIZE -gt 0 ]] && [[ "$RED_ZONE_CLEARED" == "false" ]]; then
|
|
181
|
+
WARNINGS+=("{\"type\": \"STACK_RETENTION\", \"message\": \"Stack frame (${STACK_SIZE} bytes) may retain secrets after function return. Consider clearing red-zone.\"}")
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
if [[ ${#CALLEE_SAVED_PUSHES[@]} -gt 0 ]]; then
|
|
185
|
+
WARNINGS+=("{\"type\": \"CALLEE_SAVED_SPILL\", \"message\": \"Callee-saved registers pushed to stack. If they contain secrets, stack will retain them.\"}")
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
# Update JSON with warnings
|
|
189
|
+
if [[ ${#WARNINGS[@]} -gt 0 ]]; then
|
|
190
|
+
WARNINGS_JSON=$(
|
|
191
|
+
IFS=,
|
|
192
|
+
echo "${WARNINGS[*]}"
|
|
193
|
+
)
|
|
194
|
+
if command -v jq &>/dev/null; then
|
|
195
|
+
TMP=$(mktemp)
|
|
196
|
+
jq ".warnings = [$WARNINGS_JSON]" "$OUT" >"$TMP" && mv "$TMP" "$OUT"
|
|
197
|
+
else
|
|
198
|
+
echo "WARNING: jq not found; warnings could not be added to output" >&2
|
|
199
|
+
fi
|
|
200
|
+
fi
|
|
201
|
+
|
|
202
|
+
echo "OK: assembly analysis written to $OUT"
|