-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no way to liquidate underwater loans #153
Comments
0xSorryNotSorry marked the issue as sufficient quality report |
0xSorryNotSorry marked the issue as primary issue |
eswak (sponsor) disputed |
The way the protocol is expected to handle these situations is by having offchain observers looking at the debt positions, and if one of them gets close to underwater (or is underwater), offboard the term and call all loans. The issue states that "term offboarding [...] will take a week with the possibility of being vetoed", but this is not the case, offboarding can be as fast as 2 blocks and cannot be vetoed. If one loan can grow out of health while the other loans are still safe, that means the lending term parameters are incorrect (it should have required periodic payments), and it is the expected behaviors that all loans of this term go into liquidation if the term is offboarded. Borrowers with a healthy position that go into liquidation can bid on their own collateral to prevent leaking any MEV, which is equivalent to repaying their loan. |
This is not a dup of #1057, as it mentions the case where the collateral's price goes down. In this scenario, the term should be off-boarded, and all loans will be callable. |
Trumpero marked the issue as unsatisfactory: |
Trumpero marked the issue as unsatisfactory: |
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/src/loan/LendingTerm.sol#L652-L656
Vulnerability details
Impact
As explained by the devs, markets are composed of one peg token (USDC) and a few terms that can have different collateral tokens (USDC, WETH, DAI). However, currently, there is no way to liquidate undercollateralized single positions.
Proof of Concept
In the current system, to liquidate a loan, you need either of these two:
However, there is no measure to liquidate single borrowers with undercollateralized loans. The only possibility that remains is term offboarding. However, this will also cause all other borrowers to be liquidated as well. Moreover, it will take a week, with the possibility of being vetoed.
This leads to an issue where a borrower has paid its partial payment, but their collateral asset value goes below their debt value, at which point the system acquires bad debt. After a borrower's debt becomes more than their collateral, the borrower can just stop paying the partial payments and leave with the debt token.
Example:
maxDebtPerCollateralToken
Tools Used
Manual review.
Recommended Mitigation Steps
The easiest suggestion to implement is to restrict the collateral to the same token as the loan. This way, they are going to maintain a ratio of 1:1. While borrowers will still be able to sell their received loan tokens for another token of their choice.
Assessed type
Error
The text was updated successfully, but these errors were encountered: