Users can avoid liquidations by abusing the cooldown mechanism #617
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#L153-L154
Vulnerability details
Impact
Users can avoid liquidations by abusing the cooldown mechanism
Vulnerability Details
The problem is that when a liquidation is attempted, it checks for the
cooldown
as seen here (last parametertrue
):CollateralAndLiquidity.sol#L153-L154
This means that if the user has an active
cooldown
, it will make the transaction revert:StakingRewards.sol#L104-L107
A
cooldown
can be easily triggered by a user, just by depositing some collateral. This is done via_increaseUserShare()
, which sets thecooldown
.The minimum amount of collateral is determined while adding liquidity, which can be as low as the DUST amount, which is 100 wei of a token.
So, the user will avoid liquidation during the whole duration of the
cooldown
. This can be performed repeatedly by the user, after the cooldown expires, at a minimum cost of 100 wei of tokens each time.A POC is provided to assess the validity of the claimings.
Proof of Concept
src/stable/tests/CollateralAndLiquidity.t.sol
COVERAGE="no" NETWORK="sep" forge test -vv --rpc-url https://sepolia.gateway.tenderly.co --mt "testAvoidLiquidation"
Recommended Mitigation Steps
Do not use cooldown when liquidating users:
Assessed type
Other
The text was updated successfully, but these errors were encountered: