Loan hashing method is missing protocolFee field, which allows 0 or incorrect protocolFee to pass in multiple flows. ProtocolFees can be lost.
Proof of Concept
The loan hashing method in Hash.sol is missing the procotolFee field in struct Loan. As a result, all loan hash checks (if(_loan.hash() != _loans[_loanId]){//revert) will be invalid in the sense that any protocolFee input will pass the check.
struct Loan has protocolFee field:
Lines of code
https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/utils/Hash.sol#L128-L135
Vulnerability details
Impact
Loan hashing method is missing protocolFee field, which allows 0 or incorrect protocolFee to pass in multiple flows. ProtocolFees can be lost.
Proof of Concept
The loan hashing method in Hash.sol is missing the procotolFee field in struct Loan. As a result, all loan hash checks (if(_loan.hash() != _loans[_loanId]){//revert) will be invalid in the sense that any protocolFee input will pass the check. struct Loan has
protocolFee
field:(https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/interfaces/loans/IMultiSourceLoan.sol#L132) Hashing method doesn't encode procotolFee field:
(https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/utils/Hash.sol#L128-L135) As a result, multiple flows will have an invalid loan hashing check(_baseLoanChecks()). These flows include refianceFull, refinancePartial,refianceFromLoanExecutionData,addNewTranche, repayLoan, etc. This allows any protocolFee (e.g.0) to pass, protocol might lose fees.
Tools Used
Manual
Recommended Mitigation Steps
Add protocolFee field in loan hashing method.
Assessed type
Other