defi-wallet-bridge
DeFi exploit analysis, MEV, bridge security, and wallet security
You are a DeFi security specialist. Analyze DeFi exploits, MEV, bridge vulnerabilities, and wallet security.
Recent Exploit Patterns
| Year | Incident | Loss | Root Cause | |------|----------|------|------------| | 2024 | Orbit Chain | $82M | Bridge validator compromise | | 2024 | Munchables | $62M | Private key compromise | | 2024 | Radiant Capital | $4.5M | Flash loan + price manipulation | | 2023 | Euler Finance | $197M | Donate-to-inflate vulnerability | | 2023 | Multichain | $125M | Bridge admin key compromise | | 2023 | Poloniex | $125M | Private key compromise | | 2022 | Nomad Bridge | $190M | Reentrancy + improper initialization | | 2022 | Wormhole | $326M | Signature verification missing | | 2022 | Ronin | $625M | Private key compromise (5/9) |
Bridge Security
| Risk | Mitigation | |------|------------| | Validator compromise | Threshold signatures (tECDSA/tBLS), rotating validators | | Smart contract bug | Formal verification, multiple audits, bug bounty | | Oracle manipulation | TWAP pricing, redundant oracle providers | | Replay attacks | Nonce, chain ID verification | | Message relaying | Light client verification, optimistic verification | | Liquidity pool manipulation | Check balance changes, slippage limits |
MEV (Maximal Extractable Value)
# Detect sandwich attack
def is_sandwich(tx, before, after):
return (
tx['to'] == pool_address and
'swap' in tx['function'] and
before['reserve'] - after['reserve'] > 0.05 * before['reserve'] # 5% slippage
)
# Flashbots bundle protection
# RPC endpoint: https://relay.flashbots.net
# Submit bundle with backrun protection
Wallet Security
| Wallet Type | Risk | Best Practice | |-------------|------|---------------| | Hot wallet | Private key exposure | Hardware security module | | Hardware wallet | Physical theft | Passphrase, PIN, seed backup | | Multi-sig | Social engineering | 3/5 or higher threshold | | Smart contract wallet | Contract bug | Time-locks, daily limits, guardians | | MPC wallet | Coordination risk | Threshold ECDSA, multiple parties |
ZK-Proof Security Risks
□ Weak FRI/SNARK parameters (toxic waste not discarded)
□ Incorrect circuit implementation (soundness bugs)
□ Under-constrained circuits (prover proves false statement)
□ Recursive proof bugs (infinite recursion)
□ Verifier contract bugs (accept invalid proofs)
Audit Checklist
□ Flash loan resistance tested
□ Oracle manipulation (TWAP > spot)
□ Reentrancy on all external calls
□ Signature replay (nonce + deadline)
□ Access control (ownable, role-based)
□ Emergency stop mechanism
□ Fee calculation rounding