Closed c4-bot-4 closed 7 months ago
0xA5DF marked the issue as primary issue
Similar to #69, but here the warden claims that the issue occurs only under the condition that lender is LoanManager
Tbh, I didn't fully understand why is that, maybe the sponsor or other wardens can help me out with this one
@0xA5DF Yes, it should be dup of #69. LoanManager is an abstract contract that Pool implemented, they are the same thing
0xA5DF marked the issue as duplicate of #69
Got it, thanks
0xA5DF marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/loans/MultiSourceLoan.sol#L1133
Vulnerability details
Vulnerability details
Anyone can run
mergeTranches()
to merge similartranches
with the samelender
andstartTime
into a newtranche
.The newly merged
tranche
will have a newloanId
.But there is a problem if the
lender
is aLoanManager
, the newloanId
breaks thePool
's accounting system.Because when
Loan
repays,Pool
will locate the corresponding_queueAccounting[]
,_queueOutstandingValues
,getTotalReceived[]
based on the tranche'sloanId
.Pool.sol
The new
loanId
will result in incorrect localization, assigning the wrong asset to the wrongqueue
Impact.
mergeTranches()
mergedloanId
will breakPool
's accounting system, leading to incorrect asset assignmentRecommended Mitigation
Recommendation:
mergeTranches()
whenlender
can't be aLoanManager
Assessed type
Context