zeroize-audit

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

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/TECH-HY/SKILLS --skill zeroize-audit-tech-hy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: zeroize-audit
Source: https://github.com/TECH-HY/SKILLS/tree/main/skills/zeroize-audit
Command: npx skills add https://github.com/TECH-HY/SKILLS --skill zeroize-audit-tech-hy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Sensitive data such as keys, passwords, and tokens often remains in memory because developers forget to zeroize it, or because compilers silently remove wipe calls through dead-store elimination. This Skill audits source code and compiler output to find both missing zeroization and zeroization removed by optimizations, backed by LLVM IR and assembly evidence. ## Core Features & Use Cases - Source-level detection: Identifies sensitive objects by name, type, and annotation heuristics, then flags missing wipes, partial wipes, insecure heap allocators, and untracked secret copies. - Compiler-level verification: Diffs LLVM IR across O0/O1/O2 optimization levels and analyzes assembly to prove dead-store elimination, stack retention, and register spills with mandatory evidence. - PoC validation: Generates, compiles, and runs proof-of-concept programs for each finding, using results as a confidence signal in the final report. - Use Case: Before releasing a cryptographic library, run the audit against the repository with its compile_commands.json to confirm every key buffer is wiped with an approved API and that no wipe disappears at -O2. ## Quick Start Audit this repository for missing or optimized-away zeroization of secrets using its compile_commands.json and produce a findings report.

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 plain memset with explicit_bzero, memset_s, or a volatile wipe loop.

How to audit C code for missing zeroization of secrets?

Scan for variables matching sensitive name patterns like key, secret, or token, then verify an approved wipe API such as explicit_bzero or OPENSSL_cleanse runs on every exit path with the correct size. The audit also checks heap allocations and secret copies.

Does zeroize-audit support Rust code?

Yes, it analyzes Rust crates via Cargo.toml using nightly toolchain MIR, LLVM IR, and assembly emission. It recognizes the zeroize crate's Zeroize trait, Zeroizing wrapper, and ZeroizeOnDrop derive as approved wipe patterns.

What is required to run a zeroization audit on my project?

C/C++ projects need a compile_commands.json (generated via CMake or Bear) and clang on PATH. Rust projects need a buildable Cargo.toml, cargo nightly, and uv. Missing prerequisites cause a fail-fast stop rather than partial analysis.

Why does the audit require IR or assembly evidence for some findings?

Findings like OPTIMIZED_AWAY_ZEROIZE, STACK_RETENTION, and REGISTER_SPILL describe compiler behavior that cannot be proven from source alone. An IR diff or assembly excerpt is mandatory evidence, preventing false positives based on assumptions about compiler behavior.

When should I not use zeroize-audit?

Skip it for general code review without a security focus, performance optimization unrelated to secure wiping, or codebases with no identifiable secrets or sensitive values. It also requires a compilable codebase, so it cannot run on code that does not build.