if something happens and no one invokes syncRewards() for two or more rewardsCycle.
Alice noticed that and decide to deposit() some frxEth with this old share price lat's say 1:5 but the real price if someone has invoked syncRewards() on the time the price will be 1:7
Now if someone invokes syncRewards() Alice will steal some rewards
Recommended Mitigation Steps
Add a period to rewardsCycleEnd lat’s say 3 days and check if block.timestamp >= rewardsCycleEnd + 3 days if no invoke syncRewards() to update the state
Lines of code
https://github.com/corddry/ERC4626/blob/643cd044fac34bcbf64e1c3790a5126fec0dbec1/src/xERC4626.sol#L45-L62
Vulnerability details
Impact
The user could buy shares with old price
Proof of Concept
if something happens and no one invokes
syncRewards()
for two or morerewardsCycle
. Alice noticed that and decide todeposit()
somefrxEth
with this old share price lat's say1:5
but the real price if someone has invokedsyncRewards()
on the time the price will be1:7
Now if someone invokessyncRewards()
Alice will steal some rewardsRecommended Mitigation Steps
Add a period to
rewardsCycleEnd
lat’s say 3 days and check ifblock.timestamp >= rewardsCycleEnd + 3 days
if no invokesyncRewards()
to update the state