The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: high
Invalid

There is no safety buffer between liquidation threshold and LTV ratio for borrowers

Summary

Lacking of protection for borrowers just in case they take loans at maximum allowed by LTV ratio.
As a result, the borrower could get liquidated the moment they borrow a loan.

Vulnerability Details

Before a borrower can mint certain euros from their collateral asset, they should pass a requirement that the minted amount they want to create should be equal or less than the maxMintable, maxMintable is the measurement of the protocol to know what is the maximum value of euros allowed to be borrowed based on deposited collateral asset by the borrower and collateral rate set by protocol. We can compute LTV ratio as loaned assets divided by collateral assets.

function maxMintable() private view returns (uint256) {
return euroCollateral() * ISmartVaultManagerV3(manager).HUNDRED_PC() / ISmartVaultManagerV3(manager).collateralRate();
}

Next step, let's see on how the liquidation works, this will be executed by the function liquidate and it has requirement that the borrower position should be undercollateralised before it proceed.

function liquidate() external onlyVaultManager {
require(undercollateralised(), "err-not-liquidatable");
liquidated = true;
minted = 0;
liquidateNative();
ITokenManager.Token[] memory tokens = getTokenManager().getAcceptedTokens();
for (uint256 i = 0; i < tokens.length; i++) {
if (tokens[i].symbol != NATIVE) liquidateERC20(IERC20(tokens[i].addr));
}
}

As you can see below, undercollateralised function is using maxMintable as the basis to trigger the liquidation.

function undercollateralised() public view returns (bool) {
return minted > maxMintable();
}

Let us remember that the maxMintable is also use in the calculation of maximum loan allowed to be borrowed, in that case, it is only showing that the liquidation threshold is equal to LTV ratio. If the maxMintable changes only a very slight difference below the minted value, this will trigger liquidation immediately, in which it shows there is no safety buffer for borrowers to prepare and save their collateral assets from being liquidated.

Proof of Concept

Let us illustrate here a scenario showing the case of a user being liquidated with no safety buffer.
The collateral rate set by protocol is 110%.

1 Borrower take a loan at maximum value equal to collateral rate of 110%. He minted (loan) 100 euros out of 110 euros equivalent collateral asset.

2 Suddenly the collateral value drop from 110 euros to 108.9 euros due to slight market volatility. That is only 1% drop from original value.

3 At this moment, liquidation is already open for execution because the computation of maxMintable is already less than the minted value of 100 euros.
Currently, maxMintable is 99 euros (108.9 euro collateral / 110% collateral rate).

4 Borrower has no time to prepare to deposit another collateral and the liquidators already started the liquidation process.

5 No collateral assets remained inside the vault and already distributed to liquidators and protocol.

Impact

Borrowers can be liquidated unfairly due to no safety buffer. A slight market movement can already cause liquidation.

Tools Used

Manual review

Recommendations

Liquidation threshold should not be equal to LTV ratio and must be higher that should give enough preparation to borrower to add collateral assets.
In our case illustration, the LTV ratio is 90.9% (100 euros loaned assets / 110 euros collateral assets) because collateral ratio is 110%. So if we need to implement liquidation threshold it should be higher than 90.9%, enough buffer for borrower, let's say for example is 95% (100 euros loaned assets / 105.2 euros collateral assets value)

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

canRemoveCollateral

oceansky Submitter
over 1 year ago
tripathi Auditor
over 1 year ago
oceansky Submitter
over 1 year ago
hrishibhat Lead Judge
over 1 year ago
hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.