Rewards accrued during totalStaked=0
is lost / unrecoverable
#20
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
🤖_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#L230
Vulnerability details
Impact
When the
totalStaked
value is 0, or there are no stakers in the pool, any rewards accrued will be lost. This is demonstrated in this simple scenario:notifyRewardAmount
with 30 WETH.scaledRewardRate
is set to 30 WETH / 30 days = 1 WETH/daylastCheckpointTime
is updated toblock.timestamp
.This will lead to unrecoverable WETH in the contract.
Proof of Concept
Any rewards accrued during a period of no stakers cannot be recovered.
Tools Used
Manual Review
Recommended Mitigation Steps
Add a
recoverWETH
admin controlled function which will allow recovering any WETH in the pool provided that the contract still remains solvent.Assessed type
Token-Transfer
The text was updated successfully, but these errors were encountered: