The collateralization rate check is not enforced properly. Usually, when a protocol states that collateralzation rate is 80%, this means that for every 100 usd value worth of collateral deposited, the user can borrow up to 80 usd value.
In the protocol, the rate seems to be the other way round. The rate is multiplied on the collateral instead of the debt, the user can borrow more than the collateral, which leads to undercollaterized positions.
In the borrow function, the collateralValue is obtained, followed by the existing debt value. Then, the function checks if (collateralValue < userTotalDebt.percentMul(liquidationThreshold)), revert, which is the core issue here.
Taking a closer look:
Let's say collateralValue is 1000 USD worth. The totaldebt, with the liquidationThreshold of 80%, should not be more than 800 USD worth.
In the check, the totalDebt is multiplied by the liquidation threshold, meaning the totalDebt can exceed 1000 USD, which should ideally be in a liquidation position already.
Undercollaterized position, users can borrow more than their collateral, leading to bad debt accumulation and ultimately insolvency.
Manual Review
The collateral value should be multiplied by the liquidation threshold instead of the debt value.
This means that the debt cannot go above the collaterization rate (eg 800 in the above example)
If (800 < 801), revert.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.