Skip to content

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.

Back to the lesson 4,401 to 4,450 of 5,700
  1. The remaining borrowed tokens are calculated only from the amount received before the swap, ignoring leftovers when a minimum output is set.

    Seen in 1 report
  2. The removal approval check was only enforced while the page was published, so unpublishing bypassed the consent requirement.

    Seen in 1 report
  3. The removal check compares the lower bits to one value while the setter writes a different value, so the check never matches.

    Seen in 1 report
  4. The removal code confuses two separate index arrays and fails to update the voucher index when moving the last voucher.

    Seen in 1 report
  5. The removal function calls the vault's remove adapter directly without submitting the call to the timelock queue.

    Seen in 1 report
  6. The removal function does not verify that the supplied token is part of the user's position before deleting an entry.

    Seen in 1 report
  7. The removal function used the add-signer action key, so the pending action check always failed.

    Seen in 1 report
  8. The removal helper popped the last array element instead of swapping the target with the last element.

    Seen in 1 report
  9. The removal logic skipped deactivated accounts while the UI still reported success.

    Seen in 1 report
  10. The removal logic writes to the first vouchee entry without checking whether that entry belongs to the borrower being removed.

    Seen in 1 report
  11. The removal loop stops at length minus one, so the final element is never removed.

    Seen in 1 report
  12. The removal path never submitted the remove-adapter calldata to the vault, so the timelock was unset and the call reverted.

    Seen in 1 report
  13. The removal-on-error path used the original output filename instead of the numbered file actually created.

    Seen in 1 report
  14. The remove function omits clearing the by-type mapping, leaving a stale entry that blocks re-adding.

    Seen in 1 report
  15. The remove-liquidity function did not accept or enforce a minimum amount out.

    Seen in 1 report
  16. The removeCollateral function updates internal state but omits the external call to transfer the collateral out.

    Seen in 1 report
  17. The removeCollateralToken function does not check for pending withdrawals or include the withdraw queue balance in TVL for removed tokens.

    Seen in 1 report
  18. The renewal check uses a logical AND between two timestamp comparisons that can never both be true.

    Seen in 1 report
  19. The renewal flow reuses the same active-pool verification as new protection creation, which rejects pools in LateWithinGracePeriod or Late states, instead of using a renewal-specific check that permits those states.

    Seen in 1 report
  20. The renewal logic only verified the time, token and lending contract, but failed to validate that the renewed protection amount did not exceed the original amount.

    Seen in 1 report
  21. The renewal logic sets the new protection's start time to block.timestamp instead of the expired protection's end time, so the grace period is not charged.

    Seen in 1 report
  22. The rent collection function lacked access control and did not reject future collection times.

    Seen in 1 report
  23. The rental order hash omits filled amounts, so partial fills collide on one storage key.

    Seen in 1 report
  24. The rental type flag is not checked when processing cancellations, so one cancellation path can settle another rental type.

    Seen in 1 report
  25. The repay function allowed a zero-amount repayment, and the full-repayment check compared zero shares to zero debt, triggering cleanup.

    Seen in 1 report
  26. The repay function does not check the loan maturity timestamp.

    Seen in 1 report
  27. The repay function sent tokens to the token contract address rather than the liquidizer, so the balance was never credited while the burn counter rose.

    Seen in 1 report
  28. The repay function subtracts the full earmarked amount rather than a proportional share of the repaid debt, unlike the burn path.

    Seen in 1 report
  29. The repay function updates interest rates before reducing the debt balance.

    Seen in 1 report
  30. The repay limit calculation applied the unutilised leverage percentage incorrectly, causing an underflow when borrow balance exceeded a threshold.

    Seen in 1 report
  31. The repay logic reverted when the repayment amount exceeded the remaining debt instead of capping it, and the function did not restrict who may call it.

    Seen in 1 report
  32. The repay logic uses the user-specified amount instead of the amount actually received from the swap, unlike the deposit logic.

    Seen in 1 report
  33. The repay validation only checks that the on-behalf address is not zero and never verifies it owns the NFT being repaid.

    Seen in 1 report
  34. The repayment amount is calculated from user-supplied shares without checking the position's actual debt shares.

    Seen in 1 report
  35. The repayment check only verifies the aToken balance is at least its starting balance, which passes trivially when the same funds are returned.

    Seen in 1 report
  36. The repayment logic subtracted the repaid amount without checking it exceeded the remaining balance.

    Seen in 1 report
  37. The repayment path sends tokens directly to the vault owner using safeTransferFrom, triggering the ERC777 recipient hook where a revert blocks repayment.

    Seen in 1 report
  38. The repayment routine unconditionally updates same-chain borrow balances without checking whether the repayment was same-chain or cross-chain.

    Seen in 1 report
  39. The replace-owner function lacked a check that the new owner is not the zero address.

    Seen in 1 report
  40. The replacement function does not clear the old token's entry from the index mapping.

    Seen in 1 report
  41. The report endpoint accepted unlimited submissions from the same account, so one attacker could reach the configured threshold.

    Seen in 1 report
  42. The report submission endpoint enforced no rate limit or anti-automation control.

    Seen in 1 report
  43. The report transfer function does not check the reporter's 2FA status against the destination program's requirements.

    Seen in 1 report
  44. The reporting function did not claim and convert pending reward tokens first, so the reported balance excluded them.

    Seen in 1 report
  45. The request builder passes the route's address as the setAddr target instead of checking the connected wallet equals that address.

    Seen in 1 report
  46. The request function authorises the share owner but never checks that the named controller consented, so an owner can enqueue into an unrelated account's private queue.

    Seen in 1 report
  47. The request function never checked that the caller could act for the named controller, and the claim and view functions only inspected the head of the queue.

    Seen in 1 report
  48. The request functions do not verify that the caller is authorised to act as the specified controller, so anyone can create requests for any controller address.

    Seen in 1 report
  49. The request ID is derived only from request parameters with no nonce or sender address, making it deterministic and collidable.

    Seen in 1 report
  50. The request signing mechanism was implemented entirely client-side, so the algorithm could be reversed and reused.

    Seen in 1 report