Skip to content

Bug class · Advanced

Smart contract vulnerabilities

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

median public bounty
–

How it works

Full lesson

The pattern behind every report in this class.

Smart contract vulnerabilities are flaws in on-chain code that let someone act outside the rules the contract was meant to enforce. For bug bounty hunters they are a broad and rewarding class of target, because the code is public, the state is observable and the impact is usually measurable in tokens or in broken protocol behaviour. Programs care because a single flaw can drain a pool, freeze deposits or let an attacker take control of a freshly deployed contract, and because these bugs often survive audits when they sit in edge cases such as unusual tokens, callbacks or initialisation order.

The evidence behind this lesson clusters around a few recurring outcomes: funds lost through missing slippage bounds, funds locked through token handling assumptions, state corrupted through reentrancy, and control taken through unprotected initialisation. Many reports are not exotic logic errors but ordinary mistakes repeated across many codebases, which is why a beginner can find them by working through a checklist rather than by reverse engineering novel cryptography.

This class turns up most often in the places where value moves and where external code is called: swap, deposit, mint, redeem and withdrawal functions in AMMs, vaults and lending protocols; strategy allocation and deallocation in yield vaults; liquidation and force repay paths; cross chain routers and bridges; price feeds and pool oracles; and initialise functions on newly deployed contracts. It also appears in narrower systems such as challenger game scanners, proof executors and withdrawals root validation, where the impact is on consensus or dispute correctness rather than on a token balance.

The most common pattern is a missing or ineffective bound on an operation that trades value at a market price. A swap, deposit, mint, redeem or liquidity function executes without a caller-supplied minimum output or maximum input, or declares such a parameter but never reads it, or applies it to the wrong asset or side of the trade. An attacker who can see the pending transaction can move the price first and let the victim execute at a worse rate. The same gap appears in strategy allocation, where a vault moves funds into a strategy with no slippage control, and in redemption execution, where the exit price is left to whatever the market gives.

Things to try

All 433

Each line worked in a disclosed report. Test only what a program's scope allows.

Minimum output and slippage bounds 83

  • Check whether every swap, deposit or mint path enforces a user-supplied minimum output amount, and whether the parameter is actually read rather than left unused.
  • Compare the protocol's computed slippage bound against the true expected output and check whether it is inaccurate.
  • Swap with an incorrect slippage value and check whether the swap can be manipulated.
  • Set a user-supplied slippage value and check whether it allows a frontrunner to profit.

Other 72

  • Call the unstick minting path when the vault has insufficient funds and check whether the token transfer reverts.
  • Call burn-from and check whether total supply is reduced.
  • Withdraw unsold tokens and check whether the remaining-for-sale counter is updated, so later buys revert.
  • Compare a total supply function against actual circulating supply and check whether it overstates.

Reward and harvest distribution 27

  • Set rewards in a different ERC20 token and test whether an attacker can squat the reward slot or manipulate the reward economics.
  • Re-enter the reward claim function and check whether the claimed amount is zeroed before the transfer.
  • Check whether the owner can recover all reward tokens through a recover function.
  • Re-enter a reward execution function and check whether funds can be temporarily frozen.

Reentrancy in withdrawals and redemptions 26

  • Re-enter a redemption or swap function through a callback and check whether state is updated before the external call.
  • Re-enter the ETH withdrawal functions in the liquid staking manager and pools and check whether balances are updated first.
  • Check withdrawal functions for a missing non-reentrancy modifier and re-enter through the recipient.
  • Re-enter the release function through a token callback and check whether the released amount is recorded before the transfer.

Cross-chain bridges and messaging 22

  • Trigger a token send through a bridge implementation and check whether the recipient address is derived correctly.
  • Make a self-directed reversible transfer and check whether ZK tree leaves are recorded for credits that never happen.
  • Send a fungible transfer with a mismatched destination can-deposit check and check whether it is accepted but credits nothing.
  • Deploy a token with very large names, symbols or denoms and check whether it freezes a bridge.

Bypasses and variations

All 16
  • Re-enter through a token callback or a read-only call rather than the main function.
  • Set the slippage parameter to a value that passes the check but still allows a large loss, or use a path that skips the check.
  • Front-run the initialise call before the legitimate deployer can call it.
  • Make the oracle revert so the code falls back to a path with no slippage check.
  • Use a token that returns false instead of reverting so the contract credits a balance without funds moving.
  • Re-enter through a token or receiver callback to get past a guard that only covers the direct entry point.

Typical fixes

All 26
  • Require a caller-supplied minimum output, maximum input and deadline on every swap, mint, redeem and liquidity operation.
  • Add a non-reentrancy modifier and update state before external calls.
  • Update state before external calls and apply a reentrancy guard across all entry points including callbacks.
  • Use a safe transfer helper that checks the return value and reverts on failure.
  • Enforce a minimum output or slippage bound on every strategy allocation and redemption.
  • Require a caller-supplied minimum output amount on every swap, deposit, mint and withdrawal path, applied to the correct asset.

Tips for beginners

All 13
  • Start with the functions that move value and the functions that call out. List every swap, deposit, mint, redeem, withdraw, allocate and liquidate entry point, then for each one ask what bound the caller supplies and whether the code actually reads it. This single pass finds a large share of the reports in this evidence.
  • Check the order of operations in every function that makes an external call. If state is written after the call, or if a callback path exists without the guard used on the main path, you have a candidate. Confirm it by tracing what the recipient can do before the write lands.
  • Test with unusual tokens rather than the standard one. A token that returns false or no value, one with decimals other than eighteen, one that charges a fee on transfer, and one that rejects non-zero-to-non-zero approvals will each expose a different assumption. Report the specific token behaviour that breaks the contract, not a generic complaint about token support.
  • Look at initialise and setup functions on newly deployed contracts. Ask who can call them, whether the deployer is restricted, and whether the call can be front-run in the deployment block. A permissionless initialiser that lets an attacker set themselves as owner is a clear impact.
  • For price dependent code, identify the exact source and ask whether it can be moved inside one transaction. Spot pool prices, pool share weights and pool oracles are the usual suspects. Also check what happens on timeout: a stale or huge but valid price is often worse than a revert.
  • When you find a missing slippage bound, show the loss with a concrete before and after. Demonstrate the difference between the amount the user should receive and the amount they get when the price is moved, and state the bound that should have been enforced. A report that only says a parameter is unused is weaker than one that shows the resulting loss.

Start here: a reading path

Open the path

Clear reports in order, easiest first.

Guides and techniques

View all

The best explainers, cheat sheets and technique posts on Smart contracts, from around the web.

Newest reports

All 1,035

Most recently disclosed.

New Smart contracts reports by email

Follow Smart contracts and get each week's new disclosures in one short email.

Free. New reports for what you follow, weekly by default. One-click unsubscribe. Privacy