If a new extra reward is added later, existing stakes will not be able to withdraw #252
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
invalid
This doesn't seem right
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2022-05-vetoken/blob/main/contracts/BaseRewardPool.sol#L121-L129
https://github.com/code-423n4/2022-05-vetoken/blob/main/contracts/BaseRewardPool.sol#L175-L178
https://github.com/code-423n4/2022-05-vetoken/blob/main/contracts/BaseRewardPool.sol#L198-L201
https://github.com/code-423n4/2022-05-vetoken/blob/main/contracts/BaseRewardPool.sol#L217-L220
https://github.com/code-423n4/2022-05-vetoken/blob/main/contracts/BaseRewardPool.sol#L244-L247
Vulnerability details
Impact
When the user stakes token, it iterates over all the extraRewards and adds to the user stake:
When withdrawing it also iterates over all the list and claims the rewards:
The problem is that extraRewards list might change between the stake and withdrawal because a reward manager can add a new extra reward:
Existing stakes will not be updated and while the exact implementation of extra rewards is not clear, I expect that it should revert if the amount exceeds user's balance.
The same situation is present in both VE3DRewardPool and BaseRewardPool.
Recommended Mitigation Steps
I think claiming extra rewards should be extracted to a separate function where users can specify the exact rewards that they are interested in.
The text was updated successfully, but these errors were encountered: