Partial Repayment Could Still be Possible Even When the Term's maxDelayBetweenPartialRepay is Zero #321
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-1057
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOnboarding.sol#L105-L178
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/LendingTerm.sol#L524
Vulnerability details
Impact
From the comment at:
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/LendingTerm.sol#L130
From the comment, it's obvious that no periodic partial repayment is expected for a lending term when the
maxDelayBetweenPartialRepay
is Zero, butLendingTermOnboarding::createTerm
function still allows the creation of a Lending term withmaxDelayBetweenPartialRepay
as zero andminPartialRepayPercent
as non zero.When such terms are onboarded borrowers can still make a partial repayment.
When we look at
LendingTermOnboarding::createTerm
function:https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/governance/LendingTermOnboarding.sol#L132-L140
We can observe that these values are allowed to go from
[0, x]
so this case is indeed possible
I have added a coded POC below to better show this case:
Proof of Concept
Here are the logs:
Tools Used
Manual Review
Recommended Mitigation Steps
As discussed with a sponsor, I will suggest adding an explicit check in the
LendingTermOnboarding::createTerm
function that ensuresmaxDelayBetweenPartialRepay
andminPartialRepayPercent
are either both zero or non-zero when creating a termAssessed type
Error
The text was updated successfully, but these errors were encountered: