Reentrancy
An external call hands control to another contract, which calls back in before your state is updated.
Prevention: Update state before making external calls, and add a reentrancy guard to functions that move funds.
Learn
Short guides to the smart contract risks we see most often, and how to prevent them.
An external call hands control to another contract, which calls back in before your state is updated.
Prevention: Update state before making external calls, and add a reentrancy guard to functions that move funds.
A privileged function, such as minting, upgrading or withdrawing, can be called by someone who shouldn't be able to.
Prevention: Restrict every privileged function explicitly, keep roles narrow, and put admin rights behind a multisig.
Rounding, precision loss, unchecked arithmetic and missed edge cases make the contract behave differently from its intent.
Prevention: Write the rules down as invariants, then fuzz them. Multiply before dividing and test the boundary values.
Pending transactions are public, so anyone can see yours and get their own ordered ahead of it.
Prevention: Enforce slippage limits and deadlines, and use commit-reveal where the order of actions decides the outcome.