Closed code423n4 closed 1 year ago
hansfriese marked the issue as satisfactory
hansfriese marked the issue as primary issue
To the warden: I would have appreciated a full test case proof of concept for this attack; I will have to prepare one myself tomorrow to verify. @hansfriese if I can verify this issue it is 100% a high risk and not a medium risk.
@TimTinkers OK. I will.
Thanks @hansfriese, I responded to #288.
The user's reward won't be manipulated. Please check #288 for details. Close as invalid due to the wrong impact.
hansfriese marked the issue as unsatisfactory: Insufficient proof
Lines of code
https://github.com/code-423n4/2023-03-neotokyo/blob/dfa5887062e47e2d0c801ef33062d44c09f6f36e/contracts/staking/NeoTokyoStaker.sol#L1819-L1842
Vulnerability details
Impact
configurePools is used to set the startTime and reward for each window in the pool,
but since in getPoolReward, if pool.rewardWindows[0].startTime != 0 will cause an overflow,
so pool.rewardWindows[0].startTime must be 0 to not cause getPoolReward to fail. This introduces the new issue that when pool.rewardWindows[0].startTime == 0, if pool.rewardWindows[0].reward is not equal to 0, the user will be able to claim a large amount of rewards. Consider configurePools is called, set pool.rewardWindows[0].startTime = 0, pool.rewardWindows[0].reward ! = 0, then in the getPoolReward function, the user can claim the accumulated rewards since January 1, 1970
Proof of Concept
https://github.com/code-423n4/2023-03-neotokyo/blob/dfa5887062e47e2d0c801ef33062d44c09f6f36e/contracts/staking/NeoTokyoStaker.sol#L1819-L1842 https://github.com/code-423n4/2023-03-neotokyo/blob/dfa5887062e47e2d0c801ef33062d44c09f6f36e/contracts/staking/NeoTokyoStaker.sol#L1312-L1320
Tools Used
None
Recommended Mitigation Steps
Consider setting the startTime and reward of _pools.rewardWindows[0] to 0 by default in configurePools.