DEFI SECURITY
16 articles tagged "defi security"
Why Invariant Testing Matters for DeFi Security
Unit tests check what you think of. Invariant tests check what you don't. Here's why every DeFi protocol needs invariant testing and how it has saved millions in real engagements.
Do you need a smart contract audit?
If your contract holds user funds, controls access to funds, or governs protocol parameters that affect funds, you need an audit. Here's how to decide what type fits your situation.
How much does a smart contract audit cost in 2025?
A smart contract audit costs between $15,000 and $120,000 for most DeFi protocols. Here's a full breakdown of pricing by audit type, what drives cost, and how to get the most value from your budget.
Flash loan exploits: how they work and how invariant testing catches them
Flash loans let anyone borrow millions for a single transaction. When combined with reentrancy or oracle manipulation, they drain protocols in one block. Here's how invariant testing catches what unit tests can't.
Access control bugs in Solidity: real hacks and property-based defense
A missing modifier. A delegatecall to an untrusted address. Access control bugs have caused some of the largest losses in DeFi history. Here's how to find them with property-based testing.
ZK circuit security: constraint bugs, witness leaks, and audit patterns
ZK circuits aren't programs — they're constraint systems. The bugs look different: under-constrained signals, witness malleability, missing range checks. Here's how to audit them.
Advanced invariant testing techniques for DeFi protocols
Beyond basic property writing. Ghost variables, temporal properties, conditional invariants, bounding inputs, handling oracles, and debugging failing invariants.
AMM and DEX invariant testing: properties every swap protocol needs
Every AMM needs these properties: constant product conservation, fee accounting, LP share math, and sandwich resistance. Here's the complete invariant suite.
Staking and rewards distribution: fuzzing the accounting protocols get wrong
Staking reward math is deceptively tricky. Division-before-multiplication, rounding dust, flash-stake exploits — here are the properties that catch them all.
Governance and timelock security: properties for proposal lifecycle
Governance bugs have led to catastrophic exploits. Here are the properties that protect proposal lifecycles, voting power, timelocks, and execution flow.
Oracle integration testing: fuzzing price feeds and manipulation resistance
Your protocol trusts an oracle. But does it handle stale prices, sudden deviations, and manipulation attempts correctly? Here's how to fuzz your oracle integration.
Top 10 DeFi exploits of 2025: the invariants that would have stopped them
Ten exploits, billions lost. For each one, we break down the root cause and write the exact invariant property that would have stopped it.
Price manipulation attacks: spot prices, TWAPs, and how to fuzz your defenses
Flash loan price manipulation, TWAP gaming, oracle sandwiches — here's how each attack works and the properties that prove your defenses hold.
The ERC-4626 donation attack: first depositor exploit explained and tested
The donation attack lets an attacker steal funds from vault depositors through share inflation. Here's exactly how it works, how to prevent it, and how to test for it.
Postmortem: The Lending Protocol Reentrancy That Fuzzing Missed — And Invariants Didn't
The dev team ran Echidna for 24 hours: zero findings. The same vulnerability was found by invariant testing in 90 seconds. Here's the exact reentrancy path, why mock ERC20s hide it, and the accounting properties that catch it.
5 Properties Every Smart Contract Auditor Forgets to Test
After 40+ DeFi audits, the same five invariant gaps come up every time. Not the obvious ones — accountants check totalSupply. The ones that require stateful sequences, adversarial tokens, and cross-function composition.