REWARD_TOKEN can be locked in the UniStaker
when no deposit exists
#177
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
duplicate-369
edited-by-warden
🤖_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/cde876f5eed60eb2df4104cf031ddc21b1f538b9/src/UniStaker.sol#L570
Vulnerability details
Impact
The reward will be locked when no deposit exists in the current
UniStaker
contract.Proof of Concept
When no deposit exists in the current contract, which means the stake amount is 0.
However, the reward notifier can arbitrarily to invoke
notifyRewardAmount
to add the new rewards.Assume the
scaledRewardRate
is 10 * SCALE_FACTOR, after 900 seconds, the first stake coming, the checkpoint will be updated and the reward start.However, no rewards are distributed among the first 900 seconds, the 10 * 900 rewards will be locked.
Reference: https://code4rena.com/reports/2022-09-y2k-finance#m-15-rewards-are-not-rolled-over
Tools Used
Manual
Recommended Mitigation Steps
Adding additional flags to record the 0 deposit timestamp and accumulated rewards. And consider rolling it back to the staking reward.
Assessed type
Other
The text was updated successfully, but these errors were encountered: