pendingStakes
is an array that is used to hold new stakes created by user. These stakes will be added to user's accounts after 24 hours. An attacker could add a lot of small value stakes, that increase pendingStakes
length and will cause DoS.
Attacker can call increasePosition
multiple times with as little as 1 wei
of EURO
or TST
. These stakes will be added to pendingStakes
array. increasePosition
, decreasePosition
and consolidatePendingStakes
invoke consolidatePendingStakes
function inside their body, which loop through all of the pending stakes. It means that these function won't work when length of pendingStakes
will cause DoS.
pendingStakes.push(PendingStake(msg.sender, block.timestamp, _tstVal, _eurosVal));
Add this test to liquidationPool.js
inside test
folder and run npx hardhat test
. It might take some time to finish.
For me this test failed for 279 pending stakes.
As a result of DoS users will not be able to withdraw their staked tokens, increase position and distributeAssets
functionality will be stopped which is necessary for users to receive rewards.
VScode, Manual Review
Protocol could replace the array with the mapping and whenever a user creates a new pending stake update their pending stake mapping. For the time mechanism an arithmetic average could be used. For example user one staked 10 TST and has 24 hours left to be included in staking. After 14 hours when user one wants to increase his pending stake, update his mapping and add a lock, with 17 hours left to be included. It is just an example of new pseudo functionality but it is up to the protocol how they are going to implement this change.
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.