when owener or prioritypool invokes the function _updateStrategyRewards
in StakingPool contract attacker can frontrun this call and can drain all rewards
_updateStrategyRewards will be called in two function updateStrategy and removeStrategy and this internal call is responsible for distributing the tokens and there is no consideration of lockup period or stake period for reward calculation so attacker can front run this call and he will stake the huge amount into stakingpool and he will get most reward share un reward distribution after this he will unstake the tokens
logs:
StakingPool
account6 0x65079BB3f085240f1AFCBb3E4188afE93c194b84
balanceOf account1 1.07e+21
added balanceOf account1 70000000000000000000
balanceOf account2 1.07e+21
added balanceOf account2 70000000000000000000
balanceOf account3 1.07e+21
added balanceOf account3 70000000000000000000
balanceOf owner 120000000000000000000
added balanceOf owner 120000000000000000000
balanceOf erc677Receiver 240000000000000000000
added balanceOf erc677Receiver 240000000000000000000
totalSupply 1.32e+22
balanceOf account6 7.49e+21
added balanceOf account6 489999999999999500000
balanceOf account7 2.14e+21
added balanceOf account7 140000000000000000000
here users having accounts1,2,3 each deposited 1000 and when _updateStrategyRewards invoked account6 and 7 they frontrun the function and staked so many tokens and got the most of the reward shares due to this accounts1,2,3 got very lesser. after this attacker will withdraw/unstake all of their tokens.
Attacker can get most of the reward share just staking before the the call of _updateStragyRewards.
Loss of loyal users as they will get much lesser rewards
Manual Review
Include lockup Period for reward calculations or distribute rewards based on the time period that user has been staked
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.