# MorphoRepayHook reverts for partial repay and outstanding interest

MorphoRepayHook's _verifyAmount compares amount against amount+fee+interest, so any partial repayment with pending interest reverts, breaking core hook functionality.

- Payout: Contest reward
- Severity: high
- Program: Superform
- Credited: Christoph Michel
- Disclosed: 2025-07-17
- Write-up quality: 6/10
- Original: https://cdn.cantina.xyz/reports/cantina_competition_superform_may2025.pdf#3.1.3
- Library page: https://bugbountylibrary.com/r/cantina%3Asuperform_may2025%3A3.1.3
- Tags: domain:web3 impact:dos kind:contest platform:cantina sev:high tech:evm tech:solidity technique:source-review vuln:business-logic

**Target:** MorphoRepayHook.build / _verifyAmount in Superform hooks
**Root cause:** The check `if (amount < totalAmount) revert` compares amount to totalAmount which itself includes amount, so any nonzero fee+interest makes the condition always true.
**Steps:**
1. Fork eth at block 22580376-1
2. Deploy MorphoRepayHook with MORPHO_BLUE
3. Encode hookData: loanToken, collateralToken, oracle, irm, amount=236583678277241913868, lltv=0.77e18, usePrevHookAmount=false, isFullRepayment=false
4. Call hook.build via _processHook; observe revert AMOUNT_NOT_VALID because market has accrued interest
5. Fix check and rerun test_execute_partialRepayment to see it pass
**How found:** Code review of _verifyAmount in MorphoRepayHook.build; noticed totalAmount = amount + fee + interest and that comparing amount < totalAmount is tautologically true whenever fee+interest > 0.
**Insight:** When auditing amount-validation checks, verify the compared variable isn't included in the sum it's compared against; here totalAmount re-includes amount, making the guard always trip on any accrued interest.
