Liquidation fails because of cooldown expiration of an user.
The cooldown can be kept engaged all the time if user calls depositCollateralAndIncreaseShare just to trigger the cooldown everytime it passes
Proof of Concept
The liquidation function in CollateralAndLiquidity can fail if the user Share activity was put in cooldown.
Lines of code
https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/stable/CollateralAndLiquidity.sol#L154 https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/staking/StakingRewards.sol#L104-L111 https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/staking/StakingRewards.sol#L57-L71 https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/stable/CollateralAndLiquidity.sol#L70
Vulnerability details
Impact
Liquidation fails because of cooldown expiration of an user. The cooldown can be kept engaged all the time if user calls depositCollateralAndIncreaseShare just to trigger the cooldown everytime it passes
Proof of Concept
The liquidation function in CollateralAndLiquidity can fail if the user Share activity was put in cooldown.
DOS
https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/stable/CollateralAndLiquidity.sol#L154
We can see in _decreaseUserShare
There's a require statement that user must not be in a cooldown now, this will cause the Liquidation to fail
Enable cooldown
In collateralAndLiquidity
depositCollateralAndIncreaseShare -> _depositLiquidityAndIncreaseShare -> _increaseUserShare
https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/staking/StakingRewards.sol#L57-L71
User can activate the cooldown using the deposit mechanism https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/stable/CollateralAndLiquidity.sol#L70
Tools Used
Manual analysis
Recommended Mitigation Steps
Change the bool for useCooldown in liquidateUser to false from true
Assessed type
Timing