In-depth lesson · Business logic
Root causes
Every point the Business logic reports back under this heading, best-backed first, each with the reports it is seen in.
-
The supply exchange price was multiplied by an amplified rate that was only correct at the initial price, so the price compounded on an already-grown value.
-
The supply function did not add the market to the user's account, so the collateral was ignored during borrow checks.
Seen in 1 report
-
The supply function read the exchange rate before accruing interest, so it used a stale value.
Seen in 1 report
-
The support form accepted an email address from the client without verifying the requester owned that account, and deletion requests were processed without an ownership check.
Seen in 1 report
-
The support reference ID was predictable, based on organisation and case ID, and not sufficiently random.
Seen in 1 report
-
The support workflow for username changes did not verify the request came from the account's registered email and did not notify the original address.
Seen in 1 report
-
The support workflow trusted an email address supplied in an unauthenticated chat without verifying ownership before deleting the account.
Seen in 1 report
-
The survival ratio divided two exponentials of the weight instead of exponentiating the weight delta, so it could underflow to zero.
Seen in 1 report
-
The swap call used the original transfer amount instead of the amount actually received after the fee.
-
The swap calls during position decrease passed a minimum output amount of zero and the final output was not checked against the user's requested minimum.
Seen in 1 report
-
The swap compared the actual balance including accrued fees against a reserve that excluded them.
Seen in 1 report
-
The swap computed adjusted balances with a fee formula but never transferred or deducted the fee.
Seen in 1 report
-
The swap deadline was hardcoded to the current block timestamp instead of being supplied by the user.
Seen in 1 report
-
The swap denominator grew faster than the numerator once the input exceeded the reserve.
Seen in 1 report
-
The swap fee was calculated on the cash amount out rather than on the amount out divided by one minus the fee.
-
The swap fee was not charged to the depositor but spread across all vault users.
-
The swap function did not check that the two base tokens differed, and the price update used cached state, causing drift on a self-swap.
Seen in 1 report
-
The swap function hardcoded the minimum output amount to zero, removing slippage protection.
Seen in 1 report
-
The swap function performed an arbitrary call to a router address supplied by the executor without validating it.
-
The swap function required the new token not to already exist, but anyone could add a whitelisted token to the rewards array via notifyRewardAmount.
Seen in 1 report
-
The swap helper derived its minimum output from a single contract-wide slippage setting rather than a per-call user-supplied limit.
-
The swap maths returned the selected target bin position even when output rounded to zero, so the cursor advanced while balances, fees and deltas stayed at zero.
Seen in 1 report
-
The swap output amount was used as the loan amount without subtracting the flash loan fee, so the loan plus fee exceeded what was available to repay.
-
The swap path always included WETH as an intermediate hop even when the input or output was already WETH.
-
The swap path minted and marked collateral without calling the reserve-count and minimum-first-deposit checks that supply and borrow perform.
-
The swap price limit was set to the absolute extreme, so the swap could consume all liquidity and leave unused ETH with no refund path.
Seen in 1 report
-
The swap priced one token as fixed at one dollar while using the other token's oracle price.
Seen in 1 report
-
The swap used the maximum price limit and enforced no minimum output amount.
-
The swap validation was called unconditionally even when the input amount was zero and no swap would occur.
Seen in 1 report
-
The swap was called without a minimum output amount, so the contract accepted any exchange rate.
-
The sync function recomputed an account's locked collateral but failed to update the global total-locked variable.
Seen in 1 report
-
The sync function updated reserves without minting or burning LP tokens, breaking the invariant between reserves and total supply.
Seen in 1 report
-
The sync functions never wrote the newly calculated price back to the stored previous price array.
Seen in 1 report
-
The synth mint and burn exchange rate was read straight from pool reserves, which a single transaction could move.
-
The synthetic cross price used floor division of two 8-decimal oracle prices, truncating a small true ratio to a tiny integer.
-
The system aborted the cross-chain transaction when the revert transaction failed, with no fallback to return funds.
Seen in 1 report
-
The system allowed removal of all emails from an account without preventing the last email from being deleted, while registration checks still saw the email as taken.
Seen in 1 report
-
The system contracts did not increment the deployment nonce of a newly created contract before its constructor ran, as required by EIP-161.
Seen in 1 report
-
The system did not block usernames that correspond to reserved RFC2142 email addresses, allowing users to claim them.
-
The system did not check for username conflicts when generating usernames from email addresses during OAuth sign-up.
-
The system did not handle the case where a user is blocked by an event admin after being invited, leaving the RSVP stuck.
Seen in 1 report
-
The system only supported username-based login and the password reset email did not remind the user of their username, leaving no recovery path.
Seen in 1 report
-
The system retried failed webhook deliveries and sent a notification for each failure without rate-limiting or deduplicating the alerts.
Seen in 1 report
-
The tag removal logic for page reviews errored when the tagged user tried to remove themselves.
Seen in 1 report
-
The take and bucketTake result structures never assigned the borrower's remaining collateral before returning.
-
The take function truncated fractional collateral without adjusting the debt paid.
-
The takeover function validated only the token amount and not the virtual or reserved Ether, so the cost of takeover could be bypassed.
Seen in 1 report
-
The tally read live token balances at processing time rather than a snapshot taken when the epoch ended.
-
The target raise did not reset the auction start time, so price curves continued from where they left off.
Seen in 1 report
-
The target utilisation was an unweighted average collateralisation ratio, so one borrower with negligible debt could skew the rate.
Seen in 1 report