Closed code423n4 closed 1 year ago
hansfriese marked the issue as unsatisfactory: Out of scope
hansfriese marked the issue as satisfactory
hansfriese marked the issue as duplicate of #186
hansfriese marked the issue as unsatisfactory: Out of scope
Lines of code
https://github.com/code-423n4/2023-03-neotokyo/blob/main/contracts/staking/NeoTokyoStaker.sol#L1060-L1067 https://github.com/code-423n4/2023-03-neotokyo/blob/main/contracts/staking/NeoTokyoStaker.sol#L1084-L1088 https://github.com/code-423n4/2023-03-neotokyo/blob/main/contracts/staking/NeoTokyoStaker.sol#L1851-L1856
Vulnerability details
Impact
The function _stakeBytes is a private function in the NeoTokyoStaker.sol that handles the staking of BYTES into a Citizen by a user.
There are two conditions to check whether staking BYTES into S1 Citizen or S2 Citizen.
If the VAULT_CAP or NO_VAULT_CAP constant is set to zero or even small number, then the condition citizenStatus.stakedBytes + amount > cap will always be true, which means that users will not be able to stake any BYTES tokens into a S1 Citizen or S2 Citizen. This is because the cap variable will always be zero in this case, and any non-zero amount being staked will cause the revert.
Proof of Concept
https://github.com/code-423n4/2023-03-neotokyo/blob/main/contracts/staking/NeoTokyoStaker.sol#L1851-L1856
Tools Used
Manual
Recommended Mitigation Steps
Add zero value or minimum value check in configureCaps()