The LiquidationPool.sol
contract allows users to stake assets by providing TST or EUROs tokens by calling increasePosition()
. The user needs to wait at least a day before he can decreasePosition()
and claim his assets back. During this period a malicious user could cause DoS by providing insignificant amount of TST or EUROs.
A user can execute thousand of transactions with the intentions to flood the pendingStakes
array. This is especially easy on chains with low gas fees.
By calling increasePosition()
, providing insignificant amount of TST or EUROs and paying low gas fees is pretty easy achievable by creating a bot.
Let’s say Alice is a user with good intentions and she stakes her assets. But then Bob comes and he wants to break the protocol. Bob executes LiquidationPool .increasePosition
10 000 (for example) times by providing 0.000001 TST every time. On every call Bob creates a new pending stake with duration one day leading to DoS.
https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/LiquidationPool.sol#L140
When Alice comes back and decides to claim her assets back by calling decreasePosition
she will have to wait consolidatePendingStakes()
to iterate through all of the void pendingStakes bob created.
https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/LiquidationPool.sol#L121
In the worst case after a day has passed Alice tries again to decreasePosition but this time she will have to wait consolidatePendingStakes()
not just to iterate but to deletePendingStake
on every iteration. This way Alice wouldn’t be able to claim back her assets.
https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/LiquidationPool.sol#L127
The attack is pretty easy for implementation and the likelihood to happen is big. But as all of the methods responsible for receiving assets and rewards back depend on consolidatePendingStakes()
this means all of the assets can stay locked so I consider it as a High. Users won’t be able not just to decreasePositions
but also to increasePositions
.
Manual review
Set a minimum amount for staking of TST or EUROs or limit the pendingStakes in a 24 hour period.
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.