LiquidationPool
can get intentionally or unintentionally DOSed by there existing too many pending positions. This will lead to time periods where stakers might not have any incentive to interact with this contract.
Anyone can start staking in the LiquidationPool
contract by invoking LiquidationPool::increasePosition()
. Every time a user creates a new position, it gets pushed into the pendingStakes
array. This is an externally-controllable unbounded array and introduces a risk of a potential DOS through gas griefing.
The entry point of this exploit would be the increasePosition()
function, which is invoked every time a user wants to increase their existing position or start staking for the first time:
This would in turn call consolidatePendingStakes()
, which iterates through all pendingStakes
entries and checks which ones can be turned into consolidated positions:
The following functions from the contract are directly or indirectly affected:
(public) position()
(public) increasePosition()
(public) decreasePosition()
(public) distributeFees()
(public) distributeAssets()
(private) getTstTotal()
(private) holderPendingStakes()
(private) deletePendingStake()
(private) consolidatePendingStakes()
This will result in varying gas costs for users interacting with the pool. Some of the stakers might lose incentive to use it because the gas costs could become far higher than their staked amounts and newcomers might not want to stake at all.
This could also be maliciously exploited by actors who want to DOS the protocol. They would create as many pending positions as their resources allow them to which would lead to most of the stakers being locked out of the contract or even pushing the transaction gas required beyond the block gas limit.
Manual Analysis
I would recommend converting pendingStakes
to a mapping, similar to how it's done with positions
.
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.