Incorrect validation of minBorrow amount #156
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-1182
grade-c
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/loan/LendingTerm.sol#L527-L531
Vulnerability details
Impact
Users who want to pay back their debt to leave exactly the minimum borrow amount will be unable to do so. This is because the check that ensures that the remaining borrowed amount of the user is up to the minimum borrowed amount is done incorrectly.
Proof of Concept
The check is too strict and will require the user to have more than the required minBorrow amount left as borrowed amount.
In the check above, if minBorrow is 50, borrowAmount = 100, issuanceDecrease = 50,
at least 50, should be left as borrowed amount after payment, but this check fails because
100 - 50 = 50(minBorrow) > 50 //fails and revert
Tools Used
Manual review
Recommended Mitigation Steps
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: