crypto-audit-context
Start here before claiming vulnerabilities.
Core principle: verify what the code actually enforces, not what the docs
claim.
When to Use
- Beginning a ZK or cryptographic audit
- Reading unfamiliar verifier, prover, signature, DKG, or serialization code
- Building a threat model before bug hunting
- Prioritizing which files and functions deserve the deepest review first
When NOT to Use
- Verifying whether a specific suspected finding is a true positive
- Writing final severity decisions or report-ready findings
- Querying prior-art or disclosure state
Audit Priority
Review highest-risk code first:
- Critical path —
verify, batch_verify, deserialize, from_bytes, transcript/challenge generation, keygen, sign, prove
- Trust boundary —
unsafe blocks, FFI modules, unchecked constructors, parameter loading
- Supporting — caches, zeroization, type conversions, error conversion, optimized backends
Rationalizations to Reject
| Rationalization |
Why it is wrong |
| "The README explains the architecture" |
READMEs describe intent, not enforcement |
| "I'll map trust boundaries later during domain review" |
Domain skills assume the dimension map is already built |
| "The codebase is small, I can hold the context in my head" |
Small codebases have the same attack-surface density |
Workflow
Phase 1: Map the critical path
- Identify verifier, transcript, parsing, and randomness entrypoints
- Mark code that handles attacker-controlled or externally supplied values
Phase 2: Build the dimension map
- Read
references/dimensional-analysis.md
- Assign dimensions to values that cross trust boundaries
- Treat every unknown or inherited dimension as suspicious until proven safe
Phase 3: Build the protocol threat model
- Read
references/threat-model-checklist.md
- Record replay surfaces, authentication roots, downgrade surfaces, and corruption model assumptions
- Read
references/roles-and-guarantees.md and fill the actor table: every
role that supplies input, what the design promises the other roles if that
role is malicious, offline, or misconfigured, and the mechanism that
enforces each promise. A promise with no mechanism is a domain candidate,
not a footnote
Phase 4: Produce the audit handoff
- Summarize the highest-risk paths
- Name unresolved assumptions
- Hand off to a domain auditor or verification skill
- If the critical path contains hand-rolled fixed-point, decimal rescaling,
or bignum arithmetic, recommend
fuzz-harness-gen explicitly in the
handoff (it is user-triggered and will not run unless asked)
- Initialize or update session state in
zk-findings/sessions/<engagement-id>.json
using zk-findings/sessions/session-state-schema.json
- Persist trust boundaries, open findings, and next-step routes so follow-on
conversations continue from the same state
Output Contract
Produce a context handoff that includes:
- Critical paths and trust boundaries that deserve deepest review
- Dimension-map anomalies and unresolved assumptions
- Threat-model notes that the next skill must preserve
- The roles-and-guarantees table, with each unenforced promise listed
- Recommended next skills, with a brief reason for each route
- Session state path updated in
zk-findings/sessions/ for downstream handoffs
Reference Index
- references/dimensional-analysis.md
- references/threat-model-checklist.md
- references/roles-and-guarantees.md
1---2name: crypto-audit-context-23description: >4 Builds initial audit context for ZK and cryptographic code before5 vulnerability hunting. Use when starting a crypto audit, mapping trust6 boundaries, prioritizing code paths, or applying dimensional analysis to7 protocol values.8allowed-tools:9 - Read10 - Grep11 - Glob12metadata:13 source: https://skillmd.com/skills/yue-zhou1/crypto-audit-context-214---1516# crypto-audit-context1718Start here before claiming vulnerabilities.1920**Core principle:** verify what the code actually enforces, not what the docs21claim.2223## When to Use2425- Beginning a ZK or cryptographic audit26- Reading unfamiliar verifier, prover, signature, DKG, or serialization code27- Building a threat model before bug hunting28- Prioritizing which files and functions deserve the deepest review first2930## When NOT to Use3132- Verifying whether a specific suspected finding is a true positive33- Writing final severity decisions or report-ready findings34- Querying prior-art or disclosure state3536## Audit Priority3738Review highest-risk code first:39401. **Critical path** — `verify`, `batch_verify`, `deserialize`, `from_bytes`, transcript/challenge generation, `keygen`, `sign`, `prove`412. **Trust boundary** — `unsafe` blocks, FFI modules, unchecked constructors, parameter loading423. **Supporting** — caches, zeroization, type conversions, error conversion, optimized backends4344## Rationalizations to Reject4546| Rationalization | Why it is wrong |47|---|---|48| "The README explains the architecture" | READMEs describe intent, not enforcement |49| "I'll map trust boundaries later during domain review" | Domain skills assume the dimension map is already built |50| "The codebase is small, I can hold the context in my head" | Small codebases have the same attack-surface density |5152## Workflow5354### Phase 1: Map the critical path5556- Identify verifier, transcript, parsing, and randomness entrypoints57- Mark code that handles attacker-controlled or externally supplied values5859### Phase 2: Build the dimension map6061- Read `references/dimensional-analysis.md`62- Assign dimensions to values that cross trust boundaries63- Treat every unknown or inherited dimension as suspicious until proven safe6465### Phase 3: Build the protocol threat model6667- Read `references/threat-model-checklist.md`68- Record replay surfaces, authentication roots, downgrade surfaces, and corruption model assumptions69- Read `references/roles-and-guarantees.md` and fill the actor table: every70 role that supplies input, what the design promises the other roles if that71 role is malicious, offline, or misconfigured, and the mechanism that72 enforces each promise. A promise with no mechanism is a domain candidate,73 not a footnote7475### Phase 4: Produce the audit handoff7677- Summarize the highest-risk paths78- Name unresolved assumptions79- Hand off to a domain auditor or verification skill80- If the critical path contains hand-rolled fixed-point, decimal rescaling,81 or bignum arithmetic, recommend `fuzz-harness-gen` explicitly in the82 handoff (it is user-triggered and will not run unless asked)83- Initialize or update session state in `zk-findings/sessions/<engagement-id>.json`84 using `zk-findings/sessions/session-state-schema.json`85- Persist trust boundaries, open findings, and next-step routes so follow-on86 conversations continue from the same state8788## Output Contract8990Produce a context handoff that includes:9192- Critical paths and trust boundaries that deserve deepest review93- Dimension-map anomalies and unresolved assumptions94- Threat-model notes that the next skill must preserve95- The roles-and-guarantees table, with each unenforced promise listed96- Recommended next skills, with a brief reason for each route97- Session state path updated in `zk-findings/sessions/` for downstream handoffs9899## Reference Index100101- [references/dimensional-analysis.md](references/dimensional-analysis.md)102- [references/threat-model-checklist.md](references/threat-model-checklist.md)103- [references/roles-and-guarantees.md](references/roles-and-guarantees.md)