Closed sherlock-admin closed 1 year ago
Escalate for 10 USDC I believe this is a valid issue, would love you to take a second look on that Already the poc is pretty extensive I believe there is nothing to add. There is no functionality to check if certain loan is collateralized with to-be-delisted collateral. If such exist, then a bad debt may occur.
Escalate for 10 USDC I believe this is a valid issue, would love you to take a second look on that Already the poc is pretty extensive I believe there is nothing to add. There is no functionality to check if certain loan is collateralized with to-be-delisted collateral. If such exist, then a bad debt may occur.
You've created a valid escalation for 10 USDC!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
I really appreciate the well explained issue here. I see it as an admin error. They should actually check for this not to happen before delisting. Though I will raise it internally to see more opinions.
Result: Low Unique Considering this issue a low as it can be considered an admin error. since only admin action can lead to such a situation
ArmedGoose
medium
Liquidatable collateral may be delisted leading to bad debt
Summary
If a market is also configured as a collateral, it can be hard delisted without any check if currently any borrowed positions are collateralized using that market. Due to that, after such delisting, there may still remain positions that will become unliquidatable. The tokens will remain in the protocol, but there might not be any possibility to liquidate them afterwards, so in the end, any potential debt will have to be absorbed by the protocol.
Vulnerability Detail
The vulnerability consists of several factors. Highlighting some protocol assumptions that lead to it:
There is no actual check on delisting, if a market is currently a collateral. It may happen, that if a collateral market is delisted, then the position cannot be liquidated anymore. If the user won't repay, then there will be no way to liquidate that position.
Impact
Protocol may incur losses due to positions at loss which will not be liquidated. However, since delisting is on protocol side, it cannot be exploited by users on purpose, thus likelihood is low. I rate this in turn as Medium.
Code Snippet
As per below unit test, you can see user has an active debt, the market has been delisted, and there is now no possibility to liquidate that user. Even though it is mathematically liquidatable, it reverts due to "collateral not listed" as per the
vm.expectRevert("collateral market not listed");
Run with
forge test -vv --match-test test_liquidation_delisting_poc
Tool used
Foundry Manual Review
Recommendation
For markets that are currently configured as collateral, delisting process should be different, the best user-friendly approach I can think of, a grace period should be announced before delisting, where users are informed that the collaterals will not be honored anymore after that period of time, and next upon delisting, if there are still any positions collateralized with that to-be-delisted collateral, they should be forcefully liquidated - for example, by adjusting their liquidation threshold to a point where all positions can be liquidated. A check on hardDelist something like "if its a collateral market, then check if there are any loans taken with this collateral" may be helpful to prevent bad debts.