A portion of the rewards tokens may become permanently locked in the uniStaker
#22
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-369
🤖_06_group
AI based duplicate group recommendation
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5298812a129f942555466ebaa6ea9a2af4be0ccc/src/UniStaker.sol#L570-L599
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5298812a129f942555466ebaa6ea9a2af4be0ccc/src/UniStaker.sol#L229-L234
Vulnerability details
Impact
During the accumulation period of reward tokens, if there are no staked tokens for a certain period, the amount of reward tokens generated during this period will remain in the contract forever because they cannot be claimed. This implies that the reward tokens are permanently locked in the contract.
Proof of Concept
The
notifyRewardAmount
will only accumulate the left rewards in theuniStaker
, but ignore the rewards that cannot be claimed.If there are no staked tokens in the contract from time t1 to t2, then no rewards will be accumulated during this period, and this part of the rewards will remain in the contract and cannot be claimed.
POC
Here is a test case: If Alice stakes after 15 days from when the reward is transferred to the
uniStaker
, she could receive half of the total reward tokens after therewardEndTime
(30 days). Half of the reward tokens remain locked in theuniStaker
indefinitely.Result:
Tools Used
Foundry
Recommended Mitigation Steps
It's recommended to add a
recoverERC20
function to withdraw the unused reward tokens.Assessed type
ERC20
The text was updated successfully, but these errors were encountered: