/auditsentry:zk-verifier-bugsfrom auditsentry
Detects ZK proof-verifier contract bugs: missing public-input binding, BN254 range checks, unchecked precompile returns, nullifier reuse, and upgradeable verification keys.
Ships in auditsentry. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Trigger on any of:
verifyProof, verify)0x06 (ecAdd), 0x07 (ecMul), 0x08 (pairing) over BN254/alt_bn128function withdraw(uint256[8] proof, uint256 root, uint256 nullifier, address recipient) external {
require(verifier.verifyProof(proof, [root, nullifier])); // ← recipient NOT in inputs
payable(recipient).transfer(amount);
}
Signal: a value the contract acts on (recipient, amount, chainId) is not among the proof's public inputs. The proof says nothing about it, so an attacker reuses a valid proof with a different recipient — front-runnable theft. Every value the proof is supposed to authorize must be a bound public input.
// public input passed straight to the verifier without bounds
require(input < SNARK_SCALAR_FIELD); // ← if MISSING:
Signal: public inputs (and proof point coordinates) must be < r (the BN254 scalar/base field modulus, 21888242871839275222246405745257275088548364400416034343698204186575808495617). An out-of-range input wraps mod r, letting a different field element pass as a valid input — input forgery. Verifiers must require(x < FIELD_MODULUS) for every input.
assembly { let ok := staticcall(gas(), 0x08, ...) } // 'ok' / returndata ignored
Signal: the pairing precompile (0x08) returns success flag + a 32-byte result that must equal 1; ecAdd/ecMul return whether the input points were valid. Ignoring the success bool or the pairing result accepts invalid proofs (precompile reverts on malformed points only sometimes). Always check success AND the returned value.
require(verifier.verifyProof(...));
// ← no check that nullifier was unused; no marking after
payout(recipient);
Signal: nullifier not checked against spent[nullifier] before payout, or not marked spent after (or marked after an external call → reentrant double-spend). Same note must not redeem twice.
Groth16 proofs are malleable — a valid (A,B,C) can be transformed to another valid proof for the same inputs. If proof bytes are used as a dedup/replay key, the twin bypasses it. Dedup on public inputs / nullifiers, never on proof bytes.
An upgradeable or owner-settable verification key lets an admin swap in a vk that validates forged proofs — a centralization backdoor over the entire system's soundness.
| Pattern | Severity | Notes |
|---|---|---|
| Action value not a bound public input | Critical | Proof reuse → theft |
| Nullifier not checked / marked late | Critical | Double-spend |
| Missing BN254 field range check | High | Input forgery via wraparound |
| Unchecked pairing/ecMul return | High | Invalid proofs accepted |
| Mutable vk without timelock/governance | High | Soundness backdoor |
| Proof bytes used as replay key (malleable) | Medium | Twin-proof bypass |
recipient, amount, chainId, contractAddress); verify the input vector matches what the contract acts on.< FIELD_MODULUS (BN254 r) before verification — use the snarkjs/circomlib generated verifier's checks; don't strip them.require(success) and require(out == 1) for pairing; validate ecAdd/ecMul success.require(!spent[n]); spent[n] = true; before any external call (CEI).< r range checks and full pairing-result check is sound for those concerns — don't re-flag the precompile calls.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
zk-proofs, verifier-bugs, smart-contract-security, groth16, bn254
npx claudepluginhub iktok90-design/ai-smart-contract-auditor --plugin auditsentry45 skills in this plugin
/access-controlDetect missing or incorrect access control — missing modifiers, wrong role checks, privileged function exposure, public initializers, and role-escalation paths. Activate on any function that mutates state, transfers funds, mints tokens, sets admin parameters, upgrades implementations, or pauses/unpauses./approval-issuesDetect ERC-20 approval pitfalls — approve race (front-run), missing safeApprove, infinite approvals, approval-without-revoke, Permit2 misuse, max-approval to untrusted contracts. Activate on `approve`, `safeApprove`, `permit`, `forceApprove`, `Permit2`, `IERC20.allowance`./caching-and-incrementalAlways-on meta-skill — cache audit results per file by content hash so unchanged files aren't re-analyzed on subsequent runs. Activate on every /audit, /quick-scan, /audit-changes invocation./centralization-riskDetect centralization and trust-assumption risks — admin powers, single-key risk, missing timelocks, upgrade authority, treasury keys, pause permanence, blacklisting authority, oracle authority. Activate on `onlyOwner`, `onlyRole`, `AccessControl`, upgrade authorizations, pause/unpause functions, mint/burn caps, treasury/fee setters./confidence-scoringAlways-on meta-skill — for every finding produced, attach a confidence level (HIGH/MEDIUM/LOW) and a reasoning trace. Activate on every /audit, /audit-deep, /audit-changes, /audit-live, /quick-scan invocation./cosmwasmDetect bug classes specific to CosmWasm (Rust) contracts — missing info.sender authorization in execute handlers, unbounded map iteration → gas/DoS, reply/submessage reply_id confusion, migrate admin backdoors, addr_validate vs raw string addresses, unchecked info.funds, Uint128 overflow, query reentrancy, and migration/version state. Activate on any `.rs` file with `use cosmwasm_std`, `#[entry_point]`, `ExecuteMsg`, `InstantiateMsg`, `QueryMsg`, `cw_storage_plus`, or `DepsMut`.Other plugins' skills for the same job