The StakingPool contract is susceptible to front-running attack in StakingPool::deposit function where there is a condition at a end as mentioned below which causes this attack/issue.This issue arises from a condition at the end of the function, as shown below:
The Attack is as follows:
Priority pool tries to call this deposit function to transfer funds.
Now attacker observes this in the mempool.
The attacker quickly submits a transaction with a higher gas price, calling StakingPool::donateTokens, which would violate the condition if (endingBalance > startingBalance && endingBalance > unusedDepositLimit) in StakingPool::deposit where at the end this condition is checked for sucessful transaction else it reverts based on the transaction observed in the mempool.
Now due to this the transaction of the PriorityPool calling deposit reverts with this error InvalidDeposit().
In certain scenarios, priority pool can be prevented from depositing user funds, effectively creating adenial of service condition for the deposit functionality.
Manual Review
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.