Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 1.97 KB

083.md

File metadata and controls

41 lines (26 loc) · 1.97 KB

Obedient Lava Monkey

Medium

Excessive Repayment Amount Not Checked in validateRepay, Leading to Potential User Fund Loss

Summary:

In validateRepay, the lack of a check to ensure that amountSent does not exceed debt will cause a loss of funds for users as excess repayments may be locked or mismanaged.


Root Cause:

In ValidationLogic.sol:469, the validateRepay function checks that amountSent is non-zero and that the user has an outstanding debt. However, it does not verify if amountSent exceeds the debt. Without this check, any excess amount sent beyond the user's debt is accepted without proper handling, leading to potential loss or locking of funds. This omission can cause discrepancies in fund management and result in users losing their excess repayments.


Internal Pre-conditions:

  1. A user must call repay() to send a repayment amount (amountSent).
  2. The user must have a debt (debt) greater than zero.

External Pre-conditions:

  1. No external conditions are required as this is an internal logic issue.

Attack Path:

  1. The user calls repay() with an amountSent greater than the actual debt.
  2. The validateRepay function processes the repayment without checking if amountSent exceeds the debt.
  3. The excess funds are not properly handled, leading to potential loss or mismanagement.

Impact:

The user suffers an approximate loss equal to the excess amount sent over the actual debt. The protocol locks or mismanages these excess funds.


Mitigation:

Add a check in validateRepay to ensure that amountSent does not exceed the user's debt.