Skip to content
PluginImportedContains scriptsAdds an MCP serverShare-alike license

zeroize-audit

Detects missing or compiler-optimized zeroization of sensitive data with assembly and control-flow analysis

Imported description, not reviewed yet

This item came from its original repository and was only scanned automatically; no editor has written an Arabic description for it yet. Read its content yourself before you rely on it. This page is not indexed by search engines until it is reviewed.

Download

Read this before you download

Talqeen never runs anything from this item. But what you download runs on your machine if you run it or let Claude Code run it, so read the files first.

  • The item has script files.
  • The item adds an MCP server that Claude Code connects to.

Files: 85 · Size: 605 KB

Download the ZIP

The file carries the license of the original source.

Install

Plugins are installed from a plugin marketplace in Claude Code, not by copying files. Download the package to read its content and its license.

Instructions

zeroize-audit

Audits C/C++/Rust code for missing zeroization and compiler-removed wipes. Pipeline: source scan → MCP/LSP semantic context → IR diff → assembly/MIR checks.

Agent Environment Support

The execution contract describes how to run the skill in other agent environments using their available tools.

Findings

  • MISSING_SOURCE_ZEROIZE, PARTIAL_WIPE, NOT_ON_ALL_PATHS
  • OPTIMIZED_AWAY_ZEROIZE (IR evidence required)
  • REGISTER_SPILL, STACK_RETENTION (assembly evidence required for C/C++; LLVM IR evidence for Rust + optional assembly corroboration)
  • SECRET_COPY, INSECURE_HEAP_ALLOC
  • MISSING_ON_ERROR_PATH, NOT_DOMINATING_EXITS, LOOP_UNROLLED_INCOMPLETE

Prerequisites

C/C++

  • compile_commands.json is required (compile_db input field).
  • Codebase must be buildable with commands from the compile DB.
  • Required tools: clang, uvx (for Serena MCP server), python3.
which clang uvx python3

Rust

  • Cargo.toml path is required (cargo_manifest input field).
  • Crate must be buildable (cargo check passes).
  • Required tools: cargo +nightly toolchain, uv.
# Quick check
cargo +nightly --version
uv --version

# Full preflight validation (checks all tools, scripts, and optionally crate build)
tools/validate_rust_toolchain.sh --manifest path/to/Cargo.toml
tools/validate_rust_toolchain.sh --manifest path/to/Cargo.toml --json  # machine-readable

Generate compile_commands.json (C/C++)

CMake

cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

Make/Bear

bear -- make -j$(nproc)

Usage

C/C++ only:

{ "path": ".", "compile_db": "compile_commands.json" }

Rust only:

{ "path": ".", "cargo_manifest": "Cargo.toml" }

Mixed C/C++ + Rust:

{
  "path": ".",
  "compile_db": "compile_commands.json",
  "cargo_manifest": "Cargo.toml",
  "opt_levels": ["O0", "O1", "O2"],
  "mcp_mode": "prefer"
}

Full C/C++ input:

{
  "path": ".",
  "compile_db": "compile_commands.json",
  "opt_levels": ["O0", "O1", "O2"],
  "languages": ["c", "cpp"],
  "config": "skills/zeroize-audit/configs/default.yaml",
  "max_tus": 50,
  "mcp_mode": "prefer",
  "mcp_required_for_advanced": true,
  "mcp_timeout_ms": 10000
}

Agent Architecture

The analysis pipeline uses 11 agents across 9 phases (0-8), enabling parallel source analysis (C/C++ and Rust simultaneously), per-TU compiler analysis, mandatory PoC validation with verification, and protection against context pressure:

Phase 0: 0-preflight agent — Preflight + config + create workdir + enumerate TUs
Phase 1: Wave 1:  1-mcp-resolver              (skip if mcp_mode=off OR language_mode=rust)
         Wave 2a: 2-source-analyzer           (C/C++ only; skip if no compile_db)  ─┐ parallel
         Wave 2b: 2b-rust-source-analyzer     (Rust only; skip if no cargo_manifest) ─┘
Phase 2: Wave 3:  3-tu-compiler-analyzer x N  (C/C++ only; parallel, one per TU)
         Wave 3R: 3b-rust-compiler-analyzer   (Rust only; single agent, crate-level)
Phase 3: Wave 4:  4-report-assembler          (mode=interim → findings.json only)
Phase 4: Wave 5:  5-poc-generator             (mandatory; Rust findings marked poc_supported=false)
Phase 5: PoC Validation & Verification
         5a: 5b-poc-validator                 (compile and run all PoCs)
         5b: 5c-poc-verifier                  (verify each PoC proves its claimed finding)
         5c: Orchestrator presents verification failures to user
         5d: Orchestrator merges all results into poc_final_results.json
Phase 6: Wave 6:  4-report-assembler          (mode=final → merge PoC results, report)
Phase 7: Wave 7:  6-test-generator            (optional)
Phase 8: Orchestrator — Return final-report.md
AgentPhasePurposeOutput Directory
0-preflight0Validate prerequisites, merge config, enumerate TUs, create the run directory. Gates everything after it — if a critical check fails, the run stops hererun root
1-mcp-resolver1, Wave 1Resolve symbols/types via Serena MCP (C/C++ only)mcp-evidence/
2-source-analyzer1, Wave 2aSensitive objects, wipes, data-flow/heap (C/C++)source-analysis/
2b-rust-source-analyzer1, Wave 2bRustdoc JSON trait analysis + dangerous API grepsource-analysis/
3-tu-compiler-analyzer2, Wave 3Per-TU IR diff, assembly, semantic IR, CFG (C/C++)compiler-analysis/{tu_hash}/
3b-rust-compiler-analyzer2, Wave 3RCrate-level MIR + LLVM IR analysis (Rust)rust-compiler-analysis/
4-report-assembler3+6, Wave 4+6Collect findings, confidence gating; merge PoC results (invoked twice: interim + final)report/
5-poc-generator4, Wave 5Generate proof-of-concept programs (C/C++ findings only)poc/
5b-poc-validator5, Step 5aCompile and run every PoCpoc/
5c-poc-verifier5, Step 5bCheck each PoC actually proves the finding it claims, by reading the PoC, the finding, and the original sourcepoc/
6-test-generator7, Wave 7Generate runtime validation test harnesses (optional)tests/

Agents write persistent finding files to a shared working directory (/tmp/zeroize-audit-{run_id}/) with namespaced IDs to prevent collisions during parallel execution.

ID Namespaces

EntityPatternAssigned By
Sensitive object (C/C++)SO-NNNN2-source-analyzer
Sensitive object (Rust)SO-5000+2b-rust-source-analyzer
Source finding (C/C++)F-SRC-NNNN2-source-analyzer
Source finding (Rust)F-RUST-SRC-NNNN2b-rust-source-analyzer
IR/assembly finding (C/C++)F-IR-{hash}-NNNN3-tu-compiler-analyzer
MIR finding (Rust)F-RUST-MIR-NNNN3b-rust-compiler-analyzer
LLVM IR finding (Rust)F-RUST-IR-NNNN3b-rust-compiler-analyzer
Assembly finding (Rust)F-RUST-ASM-NNNN3b-rust-compiler-analyzer
Final report findingZA-NNNN4-report-assembler

Rust Analysis

Rust analysis runs in three layers — source, MIR, and LLVM IR — without requiring a language server (Rustdoc JSON replaces MCP for trait-aware semantics).

Source Layer (2b-rust-source-analyzer)

tools/scripts/semantic_audit.py — Rustdoc JSON trait-aware analysis:

PatternCategorySeverity
#[derive(Copy)] on sensitive typeSECRET_COPYcritical
No Zeroize, ZeroizeOnDrop, or Drop implMISSING_SOURCE_ZEROIZEhigh
Has Zeroize but no auto-triggerMISSING_SOURCE_ZEROIZEhigh
Partial Drop (not all secret fields zeroed)PARTIAL_WIPEhigh
ZeroizeOnDrop + Vec/Box heap fieldsPARTIAL_WIPEmedium
Clone on zeroizing typeSECRET_COPYmedium
From/Into returning non-zeroizing typeSECRET_COPYmedium
ptr::write_bytes without compiler_fenceOPTIMIZED_AWAY_ZEROIZEmedium
#[cfg(feature=...)] wrapping Drop/ZeroizeNOT_ON_ALL_PATHSmedium
#[derive(Debug)] on sensitive typeSECRET_COPYlow
#[derive(Serialize)] on sensitive typeSECRET_COPYlow
No zeroize crate in Cargo.tomlMISSING_SOURCE_ZEROIZElow

tools/scripts/find_dangerous_apis.py — Token/grep scanner:

APICategorySeverity
mem::forgetMISSING_SOURCE_ZEROIZEcritical
ManuallyDrop::newMISSING_SOURCE_ZEROIZEcritical
Box::leakMISSING_SOURCE_ZEROIZEcritical
Box::into_rawMISSING_SOURCE_ZEROIZEhigh
ptr::write_bytesOPTIMIZED_AWAY_ZEROIZEhigh
mem::transmuteSECRET_COPYhigh
slice::from_raw_partsSECRET_COPYmedium
async fn + secret local + .awaitNOT_ON_ALL_PATHShigh

MIR Layer (3b-rust-compiler-analyzer)

tools/scripts/check_mir_patterns.py — Mid-level IR pattern analysis:

PatternCategorySeverity
Drop glue without call zeroize::MISSING_SOURCE_ZEROIZEhigh
call extern "C" with secret localSECRET_COPYhigh
Yield terminator with live sensitive localNOT_ON_ALL_PATHShigh
drop(_X) without StorageDead(_X) on any pathMISSING_SOURCE_ZEROIZEmedium
resume terminator with live secret locals (unwind)MISSING_SOURCE_ZEROIZEmedium
Secret moved into non-Zeroizing aggregateSECRET_COPYmedium

LLVM IR Layer (3b-rust-compiler-analyzer)

tools/scripts/check_llvm_patterns.py — O0 vs O2 comparison (optional O1/O3 inputs supported):

PatternCategorySeverity
store volatile count drops O0 → O2 (global + per-symbol)OPTIMIZED_AWAY_ZEROIZEhigh
@llvm.memset without volatile flagOPTIMIZED_AWAY_ZEROIZEhigh
alloca [N x i8] present at O0, absent at O2 (SROA)OPTIMIZED_AWAY_ZEROIZEhigh
alloca [N x i8] with @llvm.lifetime.end, no store volatileSTACK_RETENTIONhigh
Secret SSA value loaded and passed to non-zeroize callREGISTER_SPILLmedium

Assembly Layer (3b-rust-compiler-analyzer)

tools/scripts/check_rust_asm.py — x86-64 AT&T assembly analysis (runs when enable_asm=true). Corroborates LLVM IR findings; confidence upgrades to confirmed are applied by 3b-rust-compiler-analyzer during cross-correlation when symbols match.

PatternCategorySeverity
subq $N, %rsp with no zero-store before retqSTACK_RETENTIONhigh
movq/movdqa %reg, -N(%rsp) (caller-saved register spill)REGISTER_SPILLmedium
drop_in_place::<T> with no call zeroizeMISSING_SOURCE_ZEROIZEmedium

Rust-specific handling: symbols are demangled via rustfilt; monomorphized instances of the same generic function are deduplicated (one finding emitted with instance count in evidence). If non-x86-64 assembly is detected, the script writes empty findings and logs a warning (guardrail mode).

Direct Tool Usage (Rust)

# Emit MIR
tools/emit_rust_mir.sh --manifest path/to/Cargo.toml --out /tmp/crate.mir

# Emit MIR for a specific crate in a workspace
tools/emit_rust_mir.sh --manifest path/to/Cargo.toml --crate my-crate --out /tmp/crate.mir

# Emit LLVM IR at O0 and O2
tools/emit_rust_ir.sh --manifest path/to/Cargo.toml --opt O0 --out /tmp/crate.O0.ll
tools/emit_rust_ir.sh --manifest path/to/Cargo.toml --opt O2 --out /tmp/crate.O2.ll

# Analyse source
uv run tools/scripts/semantic_audit.py \
  --rustdoc target/doc/mycrate.json --cargo-toml Cargo.toml --out findings.json
uv run tools/scripts/find_dangerous_apis.py --src src/ --out dangerous.json

# Analyse MIR
uv run tools/scripts/check_mir_patterns.py \
  --mir /tmp/crate.mir --secrets sensitive-objects.json --out mir-findings.json

# Analyse LLVM IR
uv run tools/scripts/check_llvm_patterns.py \
  --o0 /tmp/crate.O0.ll --o2 /tmp/crate.O2.ll --out ir-findings.json

# Emit assembly at O2 (supports --crate, --bin/--lib, --target, --intel-syntax)
tools/emit_rust_asm.sh --manifest path/to/Cargo.toml --opt O2 --out /tmp/crate.O2.s
tools/emit_rust_asm.sh --manifest path/to/Cargo.toml --opt O2 --out /tmp/crate.O2.s --lib --intel-syntax

# Analyse assembly (STACK_RETENTION, REGISTER_SPILL; corroborates IR findings)
uv run tools/scripts/check_rust_asm.py \
  --asm /tmp/crate.O2.s --secrets sensitive-objects.json --out asm-findings.json

# Compare MIR across opt levels (detects zeroize/drop-glue disappearance)
tools/emit_rust_mir.sh --manifest path/to/Cargo.toml --opt O0 --out /tmp/crate.O0.mir
tools/emit_rust_mir.sh --manifest path/to/Cargo.toml --opt O2 --out /tmp/crate.O2.mir
tools/diff_rust_mir.sh /tmp/crate.O0.mir /tmp/crate.O2.mir

Tool flow (C/C++, direct)

FLAGS=()
while IFS= read -r flag; do FLAGS+=("$flag"); done < <(
  uv run --no-project tools/extract_compile_flags.py \
    --compile-db build/compile_commands.json --src src/crypto.c --format lines)
tools/emit_ir.sh --src src/crypto.c --out /tmp/crypto.O0.ll --opt O0 -- "${FLAGS[@]}"
tools/emit_ir.sh --src src/crypto.c --out /tmp/crypto.O2.ll --opt O2 -- "${FLAGS[@]}"
tools/diff_ir.sh /tmp/crypto.O0.ll /tmp/crypto.O2.ll
tools/emit_asm.sh --src src/crypto.c --out /tmp/crypto.O2.s --opt O2 -- "${FLAGS[@]}"
tools/analyze_asm.sh --asm /tmp/crypto.O2.s --out /tmp/asm.json

PoC generation (mandatory for C/C++)

Every C/C++ finding is validated against a bespoke proof-of-concept program crafted by the 5-poc-generator agent. PoC generation, validation, and verification run automatically during the pipeline (Phases 4–6). Rust findings are excluded (poc_supported: false) and appear in poc_manifest.json with "reason": "Rust finding — C PoC not applicable".

The PoC generator agent reads each finding and the corresponding source code, then crafts a tailored PoC program that exercises the specific vulnerable code path using real function signatures, variable names, and types. After compilation and execution, the PoC verifier agent checks that each PoC actually proves the vulnerability it claims to demonstrate.

Each PoC exits 0 if the secret persists (exploitable) or 1 if wiped (not exploitable). PoCs that fail verification are presented to the user for review.

Supported categories (C/C++ PoCs): MISSING_SOURCE_ZEROIZE, OPTIMIZED_AWAY_ZEROIZE, STACK_RETENTION, REGISTER_SPILL, SECRET_COPY, MISSING_ON_ERROR_PATH, PARTIAL_WIPE, NOT_ON_ALL_PATHS, INSECURE_HEAP_ALLOC, LOOP_UNROLLED_INCOMPLETE, NOT_DOMINATING_EXITS.

Confidence gates

C/C++

  • OPTIMIZED_AWAY_ZEROIZE: require IR diff evidence.
  • STACK_RETENTION and REGISTER_SPILL: require assembly evidence.
  • SECRET_COPY, MISSING_ON_ERROR_PATH, NOT_DOMINATING_EXITS: require MCP semantic evidence (or strong IR/CFG corroboration), otherwise downgrade to needs_review.
  • Missing compile DB or non-buildable codebase is a hard failure.

Rust

  • OPTIMIZED_AWAY_ZEROIZE: require IR diff evidence (per-symbol volatile-store drop, non-volatile @llvm.memset, or SROA alloca disappearance with prior O0 wipe evidence). Never valid from MIR or source evidence alone.
  • STACK_RETENTION: require alloca [N x i8] + @llvm.lifetime.end without store volatile in the same function. If check_rust_asm.py also flags the same symbol, confidence upgrades to confirmed.
  • REGISTER_SPILL: require load of secret SSA value followed by pass to a non-zeroize call site. If check_rust_asm.py also flags the same symbol, confidence upgrades to confirmed.

References

  • skills/zeroize-audit/references/compile-commands.md
  • skills/zeroize-audit/references/detection-strategy.md
  • skills/zeroize-audit/references/ir-analysis.md
  • skills/zeroize-audit/references/mcp-analysis.md
  • skills/zeroize-audit/references/poc-generation.md
  • skills/zeroize-audit/references/rust-zeroization-patterns.md

Files

  • folder.claude-plugin315 B
    • plugin.json315 B
  • folderagents99 KB
    • 0-preflight.md6.2 KB
    • 1-mcp-resolver.md4.1 KB
    • 2-source-analyzer.md6.4 KB
    • 2b-rust-source-analyzer.md9.8 KB
    • 3-tu-compiler-analyzer.md8.7 KB
    • 3b-rust-compiler-analyzer.md16 KB
    • 4-report-assembler.md14 KB
    • 5-poc-generator.md16 KB
    • 5b-poc-validator.md3.8 KB
    • 5c-poc-verifier.md11 KB
    • 6-test-generator.md2.9 KB
  • folderskills445 KBscript
    • folderzeroize-audit445 KBscript
      • folderagents235 B
        • openai.yaml235 B
      • folderassets3 KB
        • trail-of-bits-mark.svg3 KB
      • folderconfigs7.5 KB
        • c.yaml456 B
        • default.yaml3.9 KB
        • rust.yaml3.2 KB
      • folderprompts20 KB
        • report_template.md6.9 KB
        • system.md8.2 KB
        • task.md4.6 KB
      • folderreferences96 KB
        • compile-commands.md10 KB
        • detection-strategy.md10 KB
        • ir-analysis.md11 KB
        • mcp-analysis.md9.1 KB
        • poc-generation.md21 KB
        • rust-zeroization-patterns.md35 KB
      • folderschemas9 KB
        • input.json3.1 KB
        • output.json5.9 KB
      • foldertools257 KBscript
        • foldermcp8.3 KBscript
          • apply_confidence_gates.py3.3 KBscript
          • check_mcp.sh1.2 KBscript
          • normalize_mcp_evidence.py3.8 KBscript
        • folderscripts118 KBscript
          • check_llvm_patterns.py17 KBscript
          • check_mir_patterns.py19 KBscript
          • check_rust_asm.py16 KBscript
          • check_rust_asm_aarch64.py10 KBscript
          • check_rust_asm_x86.py9.4 KBscript
          • find_dangerous_apis.py14 KBscript
          • semantic_audit.py32 KBscript
        • analyze_asm.sh5.2 KBscript
        • analyze_cfg.py13 KBscript
        • analyze_heap.sh5.4 KBscript
        • analyze_ir_semantic.py15 KBscript
        • diff_ir.sh4 KBscript
        • diff_rust_mir.sh6.2 KBscript
        • emit_asm.sh1 KBscript
        • emit_ir.sh1.3 KBscript
        • emit_rust_asm.sh4.2 KBscript
        • emit_rust_ir.sh3.3 KBscript
        • emit_rust_mir.sh3.5 KBscript
        • extract_compile_flags.py8.6 KBscript
        • generate_poc.py47 KBscript
        • track_dataflow.sh5.1 KBscript
        • validate_rust_toolchain.sh8.2 KBscript
      • folderworkflows27 KB
        • phase-0-preflight.md7.4 KB
        • phase-1-source-analysis.md5 KB
        • phase-2-compiler-analysis.md6 KB
        • phase-3-interim-report.md1.1 KB
        • phase-4-poc-generation.md1.3 KB
        • phase-5-poc-validation.md4.2 KB
        • phase-6-final-report.md1.1 KB
        • phase-7-test-generation.md862 B
      • SKILL.md26 KB
  • foldertests26 KBscript
    • folderrust-regression23 KBscript
      • folderfixtures8.1 KB
        • folderdangerous_apis_src2 KB
          • positive.rs2 KB
        • foldersafe_src270 B
          • negative.rs270 B
        • sample.O0.ll340 B
        • sample.O1.ll250 B
        • sample.O2.ll625 B
        • sample.mir1,020 B
        • sample.s120 B
        • sample_aarch64.s145 B
        • sample_clean.mir227 B
        • sample_clean.s252 B
        • sample_leaf_x86.s294 B
        • secrets.json81 B
        • semantic_negative.rustdoc.json536 B
        • semantic_positive.rs87 B
        • semantic_positive.rustdoc.json1.9 KB
        • semantic_zeroize.Cargo.toml98 B
      • README.md883 B
      • run_mixed_language_smoke.sh1.2 KBscript
      • run_smoke.sh13 KBscript
    • test_poc_cpp.py1.7 KBscript
    • test_poc_source_inclusion.py1.5 KBscript
  • .mcp.json548 B
  • LICENSE20 KB
  • README.md15 KB

What the automatic scan found

We scanned the files automatically when they were imported. This is what the scan pointed at. It does not mean the item is harmful, and it does not mean it is safe: read it yourself.

  • Needs a lookStarts an MCP server

    In file plugins/zeroize-audit/.mcp.json

  • Needs a lookA script file

    In file plugins/zeroize-audit/skills/zeroize-audit/tools/analyze_asm.sh

  • Needs a lookDeletes files forcibly and recursively

    In file plugins/zeroize-audit/skills/zeroize-audit/references/compile-commands.md, line 143

  • Needs a lookDeletes files forcibly and recursively

    In file plugins/zeroize-audit/skills/zeroize-audit/tools/diff_ir.sh, line 70

  • Needs a lookDeletes files forcibly and recursively

    In file plugins/zeroize-audit/skills/zeroize-audit/tools/diff_rust_mir.sh, line 97

  • Needs a lookDeletes files forcibly and recursively

    In file plugins/zeroize-audit/skills/zeroize-audit/tools/emit_rust_asm.sh, line 146

  • Needs a lookDeletes files forcibly and recursively

    In file plugins/zeroize-audit/skills/zeroize-audit/tools/emit_rust_ir.sh, line 123

  • Needs a lookDeletes files forcibly and recursively

    In file plugins/zeroize-audit/skills/zeroize-audit/tools/emit_rust_mir.sh, line 128

  • Needs a lookDeletes files forcibly and recursively

    In file plugins/zeroize-audit/tests/rust-regression/run_smoke.sh, line 8

Comments (0)

No comments yet. Be the first.

Sign in to comment. Commenting comes at level 1 (Member).

Report

Similar items

  • PluginImported

    blockchain-web3

    Smart contract development with Solidity, DeFi protocol implementation, NFT platforms, and Web3 application architecture

    MITFiles: 11

  • PluginImported

    building-secure-contracts

    Comprehensive smart contract security toolkit based on Trail of Bits' Building Secure Contracts framework. Includes vulnerability scanners for 6 blockchains and 5 development guideline assistants.

    CC-BY-SA-4.0Files: 58

  • PluginImportedContains scripts

    burpsuite-project-parser

    Search and extract data from Burp Suite project files (.burp) for security analysis

    CC-BY-SA-4.0Files: 8

  • PluginImportedContains scripts

    c-review

    Comprehensive C/C++ security code review, with coverage verified against a parse of the source

    CC-BY-SA-4.0Files: 24

  • PluginImported

    claude-md-management

    Tools to maintain and improve CLAUDE.md files - audit quality, capture session learnings, and keep project memory current.

    Apache-2.0Files: 10

  • PluginImported

    comprehensive-review

    Multi-perspective code analysis covering architecture, security, and best practices

    MITFiles: 6