By continuously spamming getReward/stake/withdraw function, attacker will make rewardPerTokenStored
variable unchanged while the time keep increasing, lead to non reward will be claimable by all staker.
When updateReward
modifier is called, it will update rewardPerTokenStored
and lastUpdateTime
:
_rewardPerToken()
function:
lastTimeRewardApplicable()
function:
It can be seen that in _rewardPerToken()
function, if (((_lastTimeRewardApplicable(rewardData.periodFinish) - ````rewardData.lastUpdateTime) * ````rewardData.rewardRate * 1e18) ````/ totalSupply);
equal to 0, rewardPerTokenStored
will be unchanged, but lastUpdateTime
value is still updated. When totalSupply
is big enough, and attacker continuously call functions that have updateReward
modifier (getReward/stake/withdraw), reward wont be updated.
Reward cant be claimed when totalSupply
is big enough because rewardPerTokenStored
unchanged while time is up.
Manual review
Update lastUpdateTime
only when rewardPerTokenStored
is increased
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.