The LendingPool's repayment mechanism can silently accept and lock user funds when they attempt to repay more than their outstanding debt. While there is a view function to check debt amounts, the contract fails to properly handle overpayments, leading to permanent loss of user funds.
The vulnerability exists in the _repay function:
While there is a getUserDebt() view function available:
The issues are:
The contract accepts the full payment amount even when it exceeds the debt
No refund mechanism for excess payments
No events emitted to notify users of overpayment
The debt query function returns a ray-scaled value that requires additional calculation to determine the actual token amount needed
Direct Financial Loss: Users who accidentally overpay permanently lose their excess funds
Silent Failures: No feedback when overpayment occurs
Trapped Funds: Excess payments become permanently locked in the contract
Manual code review
Immediate Fixes:
Additional Improvements:
Add a helper function that returns the exact token amount needed for repayment:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.