Liquidations can easily be DOSed by a user that creates too many pending stakes.
Let's take a look at the user flow when liquidating a vault in LiquidationPoolManager.sol.
Anybody can call the runLiquidation()
function which should result in liquidating a vault that is undercollateralized:
We'll concentrate on the call to the distributeFees()
function:
As you can see, if there are fees to be distributed we're calling distributeFees
in LiquidationPool:
As you can see, the function is looping over all the holders and all the pending stakes. A malicious user could easily create a lot of pending stakes and DOS the distributeFees
function making it revert and by extension, reverting the liquidation of the vault.
A pending stake is created via increasePosition
in the LiquidationPool contract and is not removed from the pending stakes array until 24hrs have passed. This can be checked in the consolidatePendingStakes
function.
So even if there's not a malicious user, simply from increased usage and a lot of users increasing their positions a DOS can happen.
Impossible liquidation of vaults even if they are undercollateralized and/or with bad debt.
Manual review
The whole design should be should be improved. Right now, there is too much looping in these functions - over the pending stakes and over the holders, which are not bound in any way.
A possible solution could be to limit the number of pending stakes a user can open at the same time and bound the holders at some reasonable amount. However, I'm not sure this is the best way to mitigate it.
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.