Closed code423n4 closed 1 year ago
hansfriese changed the severity to QA (Quality Assurance)
This previously downgraded issue has been upgraded by hansfriese
This previously downgraded issue has been upgraded by hansfriese
hansfriese marked the issue as satisfactory
hansfriese marked the issue as duplicate of #304
hansfriese marked the issue as duplicate of #261
hansfriese marked the issue as not a duplicate
hansfriese marked the issue as duplicate of #304
hansfriese changed the severity to QA (Quality Assurance)
hansfriese marked the issue as grade-c
Lines of code
https://github.com/code-423n4/2023-03-neotokyo/blob/main/contracts/staking/NeoTokyoStaker.sol#L1077 https://github.com/code-423n4/2023-03-neotokyo/blob/main/contracts/staking/NeoTokyoStaker.sol#L1098
Vulnerability details
Impact
The impact of this is high as a user who has staked an S1 or S2 Citizen NFT can stake specific amounts of BYTES tokens with that NFT without receiving any additional rewards that they are entitled to. The user will not notice that this is happening and so be cheated out of rewards by the staking contract. Fundamentally this breaks the invariant (in certain scenarios) that e.g. staking a single time of n BYTES tokens will not yield that same outcome as staking 100 times of n/100 BYTES tokens.
Proof of Concept
POC including preliminary state and steps (foundry test):
Tools Used
Manual review
Recommended Mitigation Steps
Ensure that the user is only able to stake BYTES tokens for a S1 or S2 citizen in increments which do not result in precision loss (e.g. considering that _BYTES_PER_POINT is fixed at 200, a user staking less than 2e18 BYTES tokens will not receive any additional points).