Open c4-bot-7 opened 7 months ago
0xA5DF marked the issue as primary issue
TODO: severity
Not sure if it's high - tend to think as high as those that would compromise user's assets. Definitely an issue though.
0xA5DF changed the severity to 2 (Med Risk)
Marking as med as fees falls under the definition 'leak of value'
0xA5DF marked the issue as selected for report
0xA5DF marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/pools/Pool.sol#L444
Vulnerability details
Impact
Lenders in the Gondi protocol could be EOA or Gondi Pool. The Gondi Pool, an ERC4626, allows anyone to deposit funds and earn yield from lending on Gondi. When a loan is repaid or liquidated, the pool deducts a fee from the received amount before adding the rest to the pool balance. As shown in the
loanRepayment()
function, the fees are calculated by callingprocessFees()
and then added togetCollectedFees
. After that, the accounting function_loanTermination()
is called with the amount beingreceived - fees
.However, this fee is credited to
getCollectedFees
but never transferred out of the pool. As a result, these funds remain locked in the contract indefinitely.Proof of Concept
The
processFees()
function only calculates the fee but doesn't transfer anything.Then after
getCollectedFees
is credited forfees
, we can see thisgetCollectedFees
is never transferred out of the pool.Tools Used
Manual Review
Recommended Mitigation Steps
Add a function to collect the credited fees
getCollectedFees
from the pool in the FeeManager contract.Assessed type
Other