Submitted by hyh, also found by codexploder
_updateRewardForAllTokens is called in withdraw() only, while both withdraw() and withdrawToken() are public and can be called directly. Reward update is needed on users balance change, its absence leads to reward data rewriting and rewards losing impact for a user.
Per discussion with project withdrawToken() will not be exposed in UI, so setting the severity to be medium as users direct usage of the vulnerable function is required here, while the impact is losing of a part of accumulated rewards.
withdraw() is a wrapper for withdrawToken(), which changes users balance. withdrawToken() can be called directly, and in this case there will be no rewards update:
Gauge.sol#L548-L561
This way if a user call withdrawToken(), the associated rewards can be lost due to incomplete reward balance accounting.
A showcase of reward update issue: https://github.com/belbix/solidly/issues/1
Its replicated live with users losing accumulated rewards: https://github.com/solidlyexchange/solidly/issues/55
Consider moving rewards update to withdrawToken(), since it is called by withdraw() anyway:
Or, if the intent is to keep withdrawToken() as is, consider making it private, so no direct usage be possible:
pooltypes (Velodrome) disputed
Alex the Entreprenerd (judge) commented:
