QA Report #223
Labels
bug
Something isn't working
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
No two-step process for critical ownership transfer
Impact
The current admin transfer process involves the current admin calling TransparentUpgradeableProxy.changeAdmin(). This function checks the new admin address is not the zero address and proceeds to update the admin slot. If the nominated EOA account is not a valid account, it is entirely possible the admin might be accidentally transferred to an uncontrolled account, breaking all functions with the ifAdmin() modifier.
Proof-of-Concept
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/Booster.sol#L123
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/VoterProxy.sol#L62
Recommended Mitigation Steps
Consider implementing a two step process where the admin nominates an account and the nominated account needs to call an acceptOwnership() function for the transfer of admin to fully succeed. This ensures the nominated EOA account is a valid and active account.
Reference
code-423n4/2021-08-notional-findings#94
SafeApprove Has Been Deprecated
Proof-of-Concept
OpenZeppelin SafeERC20
safeApprove()
function was found to be used in a number of contracts. This function has been deprecated. Refer to the comments in the SafeERC20's source code.An example of the usage of
safeApprove()
is shown below:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/828fe365eeff13e7aa188e449005ad81f7222189/contracts/token/ERC20/utils/SafeERC20.sol#L39-L44
Recommended Mitigation Steps
Use
safeIncreaseAllowance()
instead ofsafeApprove()
Reference
OpenZeppelin/openzeppelin-contracts#2219
Hardcoded BLOCKS_PER_YEAR
Proof-of-Concept
The number of block per day is hardcoded in the
BaseRewardPool
contract, and it is used for the calculation of APY. However, number of block per day is not fixed at the same rate every year. For instance, the block per day is around 5000 in 2016, while the block per day is around 6000 in 2022. Thus, the rate might change in the future.https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L59
Recommended Mitigation Steps
Consider having a setter method for BLOCKS_PER_DAY and make it non-constant.
Did not safeApprove(0) First
Impact
Some tokens (e.g. USDT) do not work when changing the allowance from an existing non-zero allowance value. They must first be approved by zero and followed by the actual allowance to be approved.
Proof-of-Concept
Recommended Mitigation Steps
Approve with a zero amount first before setting the actual amount.
The text was updated successfully, but these errors were encountered: