zeroize-audit

Detects missing or compiler-eliminated zeroization of secrets in C, C++, and Rust code.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/mewishu/awesome-skills --skill zeroize-audit-mewishu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: zeroize-audit
Source: https://github.com/mewishu/awesome-skills/tree/main/skills/pattern/multi-phase-orchestration/zeroize-audit/skills/zeroize-audit
Command: npx skills add https://github.com/mewishu/awesome-skills --skill zeroize-audit-mewishu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Sensitive data like cryptographic keys, passwords, and tokens often remains in memory because developers forget to zeroize it or because compiler optimizations silently remove the wipe. This Skill audits source code, LLVM IR, and assembly to find these leaks with concrete evidence. ## Core Features & Use Cases - Multi-level analysis: Combines source scanning, LLVM IR diffing across optimization levels, assembly inspection for register spills and stack retention, and control-flow graph verification. - Evidence-backed findings: Emits 11 finding categories (e.g., OPTIMIZED_AWAY_ZEROIZE, STACK_RETENTION, SECRET_COPY) with confidence gating and mandatory compiler evidence for optimization-related claims. - PoC validation: Generates, compiles, and runs proof-of-concept programs to confirm each finding is actually exploitable. - Use Case: Ask it to audit a Rust crate handling API keys; it runs an 8-phase multi-agent pipeline and returns a report showing a memset wiped at O0 but eliminated at O2, plus a validated PoC. ## Quick Start Audit this repository for secrets left in memory and verify that all sensitive buffers are actually wiped at optimization level O2.

Frequently Asked Questions about zeroize-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if memset is optimized away by the compiler?

Compile the translation unit to LLVM IR at O0, O1, and O2 and diff the outputs. If the wipe store or memset call is present at O0 but absent at O1 or O2, dead-store elimination removed it; replace it with explicit_bzero, memset_s, or a volatile wipe loop.

How to audit Rust code for secrets left in memory?

Provide the path to the crate's Cargo.toml; the audit runs rustdoc JSON semantic analysis, dangerous API scans, and MIR/LLVM IR/assembly checks via cargo with the nightly toolchain. It verifies zeroize::Zeroize usage and detects 40 catalogued anti-patterns.

What tools are required to run a zeroization audit on C code?

You need clang on PATH, a compile_commands.json for the project (generated via CMake or Bear), and uv for the Python analysis scripts. Missing emit_ir.sh or extract_compile_flags.py causes a fail-fast stop; missing assembly tools only skip asm-level findings.

Does the audit work without Serena MCP semantic analysis?

Yes, in the default prefer mode it continues without MCP but downgrades SECRET_COPY, MISSING_ON_ERROR_PATH, and NOT_DOMINATING_EXITS findings to needs_review confidence. With mcp_mode=require, the run stops entirely if MCP is unreachable.

Why does the audit reject claims that the compiler will not optimize away a wipe?

Compiler behavior is verified empirically, never assumed. Findings like OPTIMIZED_AWAY_ZEROIZE, STACK_RETENTION, and REGISTER_SPILL are only valid with IR diff or assembly evidence, and source-level arguments cannot suppress them.

What are the limitations of zeroization auditing for Rust?

Rust proof-of-concept generation only supports MISSING_SOURCE_ZEROIZE, SECRET_COPY, and PARTIAL_WIPE; other categories are marked poc_supported=false. AArch64 assembly analysis is experimental and requires manual verification of findings.