Submitted by oakcobalt, also found by minhquanym and bin2chen
In src/lib/loans/MultiSourceLoan.sol, theres max cap for the number of tranches in a loan as defined as getMaxTranches. This cap can be exceeded.
There are two main vulnerabilities:
https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/loans/MultiSourceLoan.sol#L359
Add missing checks on getMaxTranches for all flows that might add tranches. In addNewTranche, change into _loan.tranch.length >= getMaxTranches.
0xend (Gondi) confirmed
Gondi mitigated:
Status: Mitigation confirmed. Full details in reports from oakcobalt, minhquanym and bin2chen.
