Trust-surface dependency walk (FULL-AUDIT Step 1.5 P8)
When: the program trusts the return value of sign, verify, prove, commit, recover_pubkey, verify_proof or aggregate from a small or niche crate, or uses a niche zero-copy collection for fund-moving state. Exempt: solana-program and split crates, spl-*, anchor-lang, pinocchio. ZK proof systems, Groth16 VKs and Merkle/cNFT are in references/vuln-classes/zk-and-compression.md.
Steps: (1) state the one-line security property relied on; (2) list the primitive's standard failure modes (below); (3) read the dependency's implementation (not its tests) against the textbook construction; (4) if it cannot be verified, record it under "Trust surface: unverified" — never drop it.
- Hash-based one-time signatures (Lamport / WOTS / WOTS+): missing checksum chain (digit-domination forgery: after one signature an attacker grinds a message whose digest digits all lie on the forward side of the observed ones, then walks each hash chain forward — no hash is broken; the grinding cost depends on the observed digits and
wand is often practical for smallwor truncated digests); key reuse beyond one signature (enforce one-shot consumption); hash truncated below 128-bit security; signer/verifierwor digest-length mismatch; stored public-key commitment not bound to a PDA/field. Grep: a signing loop over digest digits with no second loop over checksum digits. - Schnorr / EdDSA variants: nonce reuse; non-canonical
s(malleability); no domain-separation tag (cross-protocol replay); low-order or small-subgroupRaccepted; batch verification with predictable scalars. Grepnonce|rng|RngCore|scalar_mul|prehash|dom_sep. - BLS / pairings: rogue-key attack without proof of possession; non-RFC 9380 hash-to-curve; G1/G2 confusion; identity or non-canonical points accepted.
- Hand-rolled hashes/commitments: Pedersen
h = g^cwith knownc(binding broken);H(v‖r)with < 256-bit hash; non-CSPRNG randomness; a hand-rolled hash is a finding by default. - Niche zero-copy collections (five axes): iteration soundness (
DoubleEndedIteratorcursors crossing → two&mutto one slot); ordering preserved afterget_mutchanges a sort key; rebalancing cases (missing red-black delete-fixup case, stale order-statistic size/rank); capacity edge (silent eviction at full capacity, generation-counter wrap into the "empty" sentinel); interior mutability (&selfreturning&mutvia raw cast;RefCelldouble borrow → panic DoS). Check whether the crate's own tests run under Miri.
Sources: qedgen/solana-skills skills/qedgen-auditor/references/trust_surface_primitives.md and skills/qedgen-auditor/references/data_structure_dep_invariants.md (MIT, Copyright (c) 2025 QEDGen), rewritten.