Przejdź do treści
Biblioteka skilli
Bezpieczeństwo · Przegląd i audyt

zeroize-audit

/zeroize-audit

Audytuje kod C, C++ i Rust obsługujący sekrety, aby sprawdzić, czy zerowanie pamięci przetrwa optymalizacje kompilatora.

Licencja
Apache-2.0
Ostatnia zmiana repozytorium
28.09.2026

Ocena i bezpieczeństwo

90/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 28.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Audytuje kod C, C++ i Rust obsługujący sekrety, aby sprawdzić, czy zerowanie pamięci przetrwa optymalizacje kompilatora.

Oryginalny opis (EN)

Use when auditing C, C++, or Rust secret-handling code to verify zeroization survives compiler optimization. Not for test vectors: use wycheproof.

Jak działa

  1. Contract
  2. Inputs
  3. Procedure
  4. Failure and recovery
  5. Output
Sekcje z nagłówków SKILL.md, w oryginale · 52 linii, 1 003 słów
Podgląd SKILL.md
---
name: zeroize-audit
description: 'Use when auditing C, C++, or Rust secret-handling code to verify zeroization survives compiler optimization. Not for test vectors: use wycheproof.'
---

# Zeroize audit

## Contract

| Field | Bound contract |
|---|---|
| Trigger | The user asks to audit C, C++, or Rust code that handles keys, passwords, tokens, PII, or other secrets for missing, partial, path-dependent, copied, retained, register-spilled, or compiler-eliminated zeroization, and a compile_commands.json or Cargo.toml build context is available. |
| Authority | Reversible local: writes only audit artifacts and reports to a temporary directory; rollback is deleting the temporary directory. No remote mutation. The target repository is read-only. |
| Side effect | Reads the target repository without modifying it. Executes captured compilation, cargo, and LLVM/MIR/assembly emission commands. Writes intermediate evidence, generated PoCs, findings.json, and final-report.md under a dedicated temporary audit directory. |
| Done | findings.json and final-report.md exist in the temporary directory, every finding carries its source and compiler-artifact evidence with a confidence level, and all source/compiler phases and known coverage gaps are accounted for. |

## Inputs

- Target repository path (required): root of the codebase to audit.
- Build context (required): path to `compile_commands.json` for C/C++ or `Cargo.toml` for Rust.
- Scope (optional): specific files or directories to limit the audit; defaults to the full repository.

## Procedure

1. **Discover candidate secret-handling code paths via source heuristics.** Create a dedicated temporary audit directory. Validate that the build context exists and is parseable. If missing or unparseable, halt with failure state `missing-build-context`. Search the target repository for secret-handling identifiers: key, password, token, secret, PII; cryptographic operations (encrypt, decrypt, sign, derive); and explicit zeroization calls (memset, explicit_bzero, SecureZeroMemory, zeroize, Zeroize). Record every candidate with its file path and line range. Done when: every candidate secret-handling file is recorded with its path and line range.

2. **Intercept the build to emit optimized compiler artifacts for candidate units.** For C/C++, use the compile_commands.json entries for candidate translation units and emit LLVM IR with `-emit-llvm -S` at the optimization level the project uses (typically `-O2` or `-O3`). For Rust, emit MIR with `--emit=mir` and assembly with `--emit=asm` for candidate crates. Record the exact compiler invocation, flags, and optimization level. If compilation fails for a specific unit, record the compiler error as a coverage gap and continue with the units that compiled. Done when: compiler artifacts are captured for every compilable candidate unit with the exact invocation and flags recorded.

3. **Analyze the emitted artifacts to trace sensitive values and prove whether zeroization instructions persist.** For each candidate unit, inspect the emitted IR, MIR, or assembly:
   - Verify that zeroization calls (memset, explicit_bzero, zeroize) emit the corresponding store instructions in the optimized output.
   - Check for dead-store elimination: the compiler may remove a store to a stack variable that is never read again. Compare the optimized output against `-O0` output to detect eliminated stores.
   - Examine register spills: determine whether sensitive values are spilled to the stack and whether the spill location is zeroed before the function returns.
   - Inspect heap deallocation paths: check whether memory is zeroed before free, or whether the deallocator itself zeroizes.
   - Detect path-dependent zeroization: zeroing that occurs only on some branches, leaving sensitive data unzeroed on other paths.
   - Flag copies or moves of sensitive data that may retain the original in a location that is not zeroed.
   Done when: every compiler artifact is analyzed for elimination, spills, heap deallocation, path-dependence, and copies.

4. **Attempt to generate a safe PoC that dumps residual memory prior to deallocation or flags absent instructions.** For each finding, write a minimal C/C++/Rust program that demonstrates the missing or eliminated zeroization without invoking undefined behavior. The PoC must read residual memory from a stack or heap location after the function returns but before the memory is reused or deallocated, using only well-defined operations such as reading through a pointer to memory the program still owns. Compile the PoC with the same toolchain and flags as the target. Run it and capture the output. If the PoC cannot be constructed without undefined behavior, or if compilation or execution fails, downgrade the finding's confidence and record the PoC status as `unsupported` or `failure`. Done when: every finding has a PoC with source, compilation command, runtime output, and verification verdict, or an explicit unsupported/failure status.

5. **Assemble a structured JSON dataset and Markdown report correlating source lines with optimization-level evidence.** Write `findings.json`: each finding contains id, severity, file, line range, description, evidence class (source, IR, MIR, assembly), confidence level (high/medium/low), PoC status (pass/fail/unsupported/failure), coverage gap flag, and recommendation. Write `final-report.md`: executive summary, per-finding detail with all evidence and the optimization level at which the zeroization was eliminated or retained, coverage gaps (files or translation units that could not be compiled or analyzed), compiler version and flags, and prioritized remediation recommendations. Done when: `findings.json` and `final-report.md` exist in the temporary directory with all required fields per finding.

## Failure and recovery

- Missing build context: halt immediately. Report the missing prerequisite (`compile_commands.json` or `Cargo.toml`) and do not proceed.
- Compilation failure for specific translation units: record the compiler error as a coverage gap. Continue with compilable units. Do not modify the target repository to fix compilation.
- PoC compilation failure: mark the finding's PoC status as `unsupported` with the compiler error. The finding retains source and IR evidence but confidence is downgraded.
- PoC runtime failure: mark PoC status as `failure` with the runtime error. Confidence is downgraded.
- PoC requires undefined behavior to demonstrate the issue: do not construct the PoC. Mark PoC status as `unsupported` with reason `requires-undefined-behavior`. Rely on compiler-artifact evidence instead.
- Ambiguous zeroization presence: report as uncertain with the specific evidence that is ambiguous. Do not assert presence or absence.

Partial results are valid when each finding carries its evidence class and confidence gate. The target repository is never modified; rollback is deletion of the temporary audit directory.

## Output

`findings.json` (schema-valid array with evidence, confidence, and PoC status per finding) and `final-report.md` (executive summary, per-finding detail with optimization-level evidence, coverage gaps, compiler info, and remediation), both under the temporary audit directory with intermediate evidence and PoC sources.
Pliki w paczce (2)
  • SKILL.md 7 KB
  • agents/openai.yaml 1 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · OutlineDriven/outline-driven-development90Apache-2.0
trailofbits/skills100CC-BY-SA-4.0
sickn33/agentic-awesome-skills100MIT
26zl/cybersec-toolkit100MIT
LiHongwei-cn/lihongwei-cn100MIT
redhatproductsecurity/prodsec-skills100Apache-2.0
gosuda/dalcom-skills90Apache-2.0

Migawka bazy z 13.11.2026 · wersja paczki 7ca4161647a2 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90wycheproof
    Waliduje implementacje kryptograficzne względem wektorów testowych Project Wycheproof i wyjaśnia rozbieżności z wektorem.
  • 95wycheproof
    Dostarcza wektory testowe do weryfikacji poprawności implementacji kryptograficznych, w tym przypadków brzegowych.
  • 90compiler-verify
    Uruchamia wszystkie kontrole kompilatora, czyli testy, lint i format, przed commitem, wykrywając, czy zmienił się kod TypeScript czy Rust.
  • 95wycheproof
    Waliduje implementacje kryptograficzne wektorami testowymi Project Wycheproof dla AES, RSA, ECDSA i ECDH i czyta wyniki błędów.
  • 100compiler-commit
    Weryfikuje zmiany kompilatora testami, lintem i formatowaniem, a następnie tworzy commit z odpowiednim prefiksem [compiler] lub [rust-compiler].
  • 100rust-web-security
    Modeluje zagrożenia i sprawdza bezpieczeństwo usług webowych w Rust: uwierzytelnianie, autoryzację najemców, sesje, JWT, CSRF, CORS i sekrety.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.