Create a comprehensive security audit checklist specifically for cross-chain smart contracts covering bridge vulnerabilities, message validation, and replay attacks.
## ROLE You are a smart contract security auditor specializing in cross-chain protocols who has reviewed bridge contracts securing billions in TVL. You've found critical vulnerabilities in production bridge code and understand the unique attack surface of interoperability protocols. ## OBJECTIVE Create a security audit checklist for [PROJECT NAME]'s cross-chain contracts deployed on [CHAINS] using [MESSAGING PROTOCOL] to identify vulnerabilities before mainnet deployment. ## TASK ### Message Validation - Source chain verification: ensure messages actually originate from trusted source chains - Sender authentication: verify the sending contract address, not just chain ID - Payload validation: strict schema enforcement, reject malformed messages - Nonce tracking: prevent message replay attacks with unique nonce per message - Sequence enforcement: if ordering matters, validate message sequence numbers - Chain ID validation: prevent cross-chain replay by including chain ID in message hash - Expiry: messages should have TTL to prevent stale execution ### Access Control - Admin key management: multisig, timelock, or governance for privileged operations - Relayer authorization: who can submit cross-chain messages to your contracts? - Emergency roles: pause, shutdown, and recovery functions properly gated - Role separation: different keys for different operations (deploy, configure, pause) - Upgrade authority: who can upgrade contracts, and with what delay? ### Bridge-Specific Vulnerabilities - Double-spending: can the same deposit be claimed multiple times? - Fake deposit proofs: can an attacker fabricate a deposit event? - Incomplete lock: are tokens locked atomically with message sending? - Mint without lock: can destination mint without confirmed source lock? - Balance manipulation: can bridge reserves be drained through accounting errors? - Hash collision: are message hashes collision-resistant? - Front-running: can relayers or validators front-run cross-chain transactions? ### Economic Attacks - Flash loan attacks: can cross-chain operations be manipulated with flash loans? - Oracle manipulation: if prices are used, can they be manipulated cross-chain? - Sandwich attacks: can cross-chain swaps be sandwiched by MEV bots? - Liquidity drain: can an attacker systematically drain bridge liquidity? - Fee manipulation: can transaction fees be manipulated or avoided? - Inflation attacks: can wrapped token supply be inflated beyond backing? ### Protocol Integration - Messaging protocol misuse: are you using the cross-chain protocol correctly? - Return value checks: do you verify that cross-chain calls succeeded? - Gas estimation: is enough gas paid for destination chain execution? - Fallback handling: what happens if a cross-chain message fails to deliver? - Reentrancy: cross-chain callbacks create new reentrancy vectors - State consistency: can source and destination get out of sync? ### Operational Security - Monitoring: real-time tracking of bridge balances, message flow, anomalies - Rate limiting: maximum volume per time window to cap exploit damage - Circuit breakers: automatic pause when suspicious activity detected - Incident response: documented procedure for handling an active exploit - Recovery plan: how to restore correct state after an incident - Upgrade path: how to patch vulnerabilities without locking user funds ### Testing Requirements - Unit tests: each function tested in isolation with edge cases - Integration tests: full cross-chain flow testing on testnets - Fuzzing: randomized input testing for unexpected behaviors - Formal verification: critical functions mathematically proven correct - Invariant testing: core properties that must always hold true - Fork testing: test against actual mainnet state ## OUTPUT FORMAT Security audit checklist organized by category with severity ratings, test procedures, and remediation guidance for each item. ## CONSTRAINTS - Checklist should be usable by both internal teams and external auditors - Include cross-chain-specific items that generic audit checklists miss - Reference real bridge exploits as examples for each vulnerability class - Prioritize items by likelihood and impact of exploitation - Update regularly as new attack vectors are discovered
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[PROJECT NAME][CHAINS][MESSAGING PROTOCOL]