Liquidation Can Be Prevented by Triggering Cooldown Expiration #235
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-312
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/stable/CollateralAndLiquidity.sol#L154
Vulnerability details
Impact
Liquidations can be prevented by a user increasing or decreasing their share amount to reset the cooldown for decreasing shares.
Proof of Concept
In the
liquidateUser
function, the call to_decreaseUserShare
passes intrue
for theuseCooldown
parameter. This means that any calls to liquidate will revert when the user's position is in cooldown.A user can easily trigger the cooldownExpiration by calling
depositCollateralAndIncreaseShare
. A user can deposit liquidity even if their position is currently liquidatable. ThecooldownExpiration
for increasing and decreasing shares is the same, so this affects liquidations at all. Therefore the user can prevent liquidations on their insolvent positions indefinitely.Tools Used
Manual review
Recommended Mitigation Steps
The fix is simple: the bool value
false
rather thantrue
should be used when calling the_decreaseUserShare()
function withinliquidateUser
Assessed type
DoS
The text was updated successfully, but these errors were encountered: