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.
- disclosed reports
- 1,035
- median public bounty
- –
How it works
Full lessonThe 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 433Each 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 pathClear reports in order, easiest first.
-
1
Super pool uses `ERC20.approve` instead of safe approvals, causing it to always revert on some ERC20sBeginner
The code calls IERC20.approve directly, which assumes the token returns a boolean, but some tokens (e.g., USDT) do not return a value, causing a revert.
-
2
_onTransferReceived() does not work as intendedBeginner
The require statement uses '!=' instead of '==' when comparing the returned selector to the expected ERC-721 receiver selector.
-
3
Tokens can be stuck forever in UniswapLiquidator because function retrieveTokens always reverts for USDT and all tokens that have transfer function that do not return booleanBeginner
The contract uses the standard IERC20 interface, which requires transfer to return a boolean, but some tokens (e.g., USDT) do not return a value, causing the call to revert.
-
4
Anyone can reset fees to 0 value when Vault is deployedBeginner
The changeFees function lacks a check that proposedFeeTime is non-zero, allowing it to be called before any fee change is proposed.
-
5
Calling swapAVAXForExactTokens function while sending excess amount cannot refund such excess amountBeginner
The swapAVAXForExactTokens function is supposed to refund any excess AVAX sent, but the refund calculation subtracts the sent amount from the required amount, causing an underflow revert whenever more than the required amount is sent. An attacker could not exploit this for gain, but ordinary users sending extra AVAX would have their transactions fail.
-
6
Incorrect emit due to wrong ordering of wethbalancebefore calculationBeginner
The balance snapshot intended to represent the pre-withdrawal state is taken after the withdrawal, so the before and after values are identical.
-
7
Gettotaldeposited doesn t reflect the correct total depositedBeginner
Likely the function reads the contract's token balance instead of the internal accounting variable that tracks deposits.
-
8
decrPosition09293696 will not work due to incorrect function signatureBeginner
The Solidity function signature is missing the pool address parameter that the Rust function expects, causing a mismatch.
Guides and techniques
View allThe best explainers, cheat sheets and technique posts on Smart contracts, from around the web.
-
Classic Vulnerabilities Part 2: Oracle Manipulation, Flash Loans & Price AttacksExplains oracle manipulation, flash loans and price attacks in smart contracts with examples for auditors.
Explainer medium.com
-
Mutation testing comes to DAMLTrail of Bits brings mutation testing to DAML smart contracts to surface gaps in test suites.
blog.trailofbits.com
-
The Potential Impact Of Erc 777 Tokens On Defi ProtocolsExplains how ERC-777 token hooks can enable reentrancy and other risks in DeFi protocols, helping auditors spot integration flaws.
Explainer immunefi.com
-
Classic Vulnerabilities Part 1: Reentrancy, Access Control & Integer BugsReviews classic smart contract flaws including reentrancy, access control mistakes and integer bugs.
Explainer medium.com
-
Advanced Vulnerabilities Part 2: Cross-Chain, Signatures & Upgradeable PitfallsCovers cross chain replay, signature malleability and upgradeable contract storage pitfalls with Foundry proof of concept examples.
Technique medium.com
Newest reports
All 1,035Most recently disclosed.
-
Oracle rotation resets accepted feed timestamps and permits a forced liquidationCritical Plether Audit finding
-
-
IPletherOracle.PriceSnapshot.publishTime is documented as the earliest component publish time, but the implementation returns the newestInformational Plether Audit finding
-
-
-
-
Unbounded Junior share amplification reaches terminal supply and permanently freezes LP fundsCritical Plether Audit finding
-
PletherOracle._invertPythPrice rounds half-up at 1e-26 and then floors to 1e-8, so inverted basket components are always truncatedInformational Plether Audit finding
-
-
Rounding inconsistent maxdeposit and maxmint values can advertise vault entry that necessarily reverts
Low Firelight Audit finding
New Smart contracts reports by email
Follow Smart contracts and get each week's new disclosures in one short email.