Users can mistakenly think that the return value is the named return, but it is actually the actualreturn statement that comes after. To know that the user needs to read the code and is confusing.
Furthermore, removing either the actual return or the named return will save gas.
external / public functions parameters should be validated to make sure the address is not 0.
Otherwise if not given the right input it can mistakenly lead to loss of user funds.
OptionsFactory.sol.isQToken _qToken
EIP712MetaTransaction.sol._verify user
QTokenStringUtils.sol._qTokenSymbol _strikeAsset
OptionsUtils.sol.getTargetQTokenAddress _oracle
Title: Not verified owner
Severity: Low Risk
owner param should be validated to make sure the owner address is not address(0).
Otherwise if not given the right input all only owner accessible functions will be unaccessible.
CollateralToken.sol.metaSetApprovalForAll owner
Controller.sol._collateralTokenApproval _owner
Controller.sol._qTokenPermit _owner
CollateralToken.sol.burnCollateralTokenBatch owner
CollateralToken.sol.burnCollateralToken owner
Title: Missing commenting
Severity: Low Risk
The following functions are missing commenting as describe below:
ConfigTimelockController.sol, schedule (public), parameters target, value, data, predecessor, salt, delay not commented
EIP712MetaTransaction.sol, _verify (internal), @return is missing
ConfigTimelockController.sol, _getProtocolValueDelay (internal), parameter protocolValueType not commented
Title: Duplicates in array
Severity: Low Risk
You allow in some arrays to have duplicates. Sometimes you assumes there are no duplicates in the array.
Title: Two Steps Verification before Transferring Ownership
Severity: Low Risk
The following contracts have a function that allows them an admin to change it to a different address. If the admin accidentally uses an invalid address for which they do not have the private key, then the system gets locked.
It is important to have two steps admin change where the first is announcing a pending new admin and the new address should then claim its ownership.
A similar issue was reported in a previous contest and was assigned a severity of medium: code-423n4/2021-06-realitycards-findings#105
QuantConfig.sol
Title: In the following public update functions no value is returned
Severity: Low Risk
Title: Missing non reentrancy modifier
Severity: Low Risk
The following functions are missing reentrancy modifier although some other pulbic/external functions does use reentrancy modifer.
Even though I did not find a way to exploit it, it seems like those functions should have the nonReentrant modifier as the other functions have it as well..
Controller.sol, initialize is missing a reentrancy modifier
Title: Init frontrun
Severity: Low Risk
Most contracts use an init pattern (instead of a constructor) to initialize contract parameters. Unless these are enforced to be atomic with contact deployment via deployment script or factory contracts, they are susceptible to front-running race conditions where an attacker/griefer can front-run (cannot access control because admin roles are not initialized) to initially with their own (malicious) parameters upon detecting (if an event is emitted) which the contract deployer has to redeploy wasting gas and risking other transactions from interacting with the attacker-initialized contract.
Many init functions do not have an explicit event emission which makes monitoring such scenarios harder. All of them have re-init checks; while many are explicit some (those in auction contracts) have implicit reinit checks in initAccessControls() which is better if converted to an explicit check in the main init function itself.
(details credit to: https://github.com/code-423n4/2021-09-sushimiso-findings/issues/64)
The vulnerable initialization functions in the codebase are:
Title: Two arrays length mismatch
Severity: Low/Med Risk
The functions below fail to perform input validation on arrays to verify the lengths match.
A mismatch could lead to an exception or undefined behavior.
Consider making this a medium risk please.
Title: Override function but with different argument location
Severity: Low/Med Risk
ChainlinkFixedTimeOracleManager.sol.constructor inherent ProviderOracleManager.sol.constructor but the parameters does not match
ChainlinkOracleManager.sol.constructor inherent ProviderOracleManager.sol.constructor but the parameters does not match
Title: Named return issue Severity: Low Risk
Users can mistakenly think that the return value is the named return, but it is actually the actualreturn statement that comes after. To know that the user needs to read the code and is confusing. Furthermore, removing either the actual return or the named return will save gas.
Title: Not verified input Severity: Low Risk
Title: Not verified owner Severity: Low Risk
Title: Missing commenting Severity: Low Risk
Title: Duplicates in array Severity: Low Risk
AssetsRegistry.addAssetWithOptionalERC20Methods pushed (_underlying)
AssetsRegistry.addAsset pushed (_underlying)
QuantConfig.setProtocolAddress pushed (_protocolAddress)
Title: Two Steps Verification before Transferring Ownership Severity: Low Risk
The following contracts have a function that allows them an admin to change it to a different address. If the admin accidentally uses an invalid address for which they do not have the private key, then the system gets locked. It is important to have two steps admin change where the first is announcing a pending new admin and the new address should then claim its ownership. A similar issue was reported in a previous contest and was assigned a severity of medium: code-423n4/2021-06-realitycards-findings#105
Title: In the following public update functions no value is returned Severity: Low Risk
In the following functions no value is returned, due to which by default value of return will be 0. We assumed that after the update you return the latest new value. (similar issue here: https://github.com/code-423n4/2021-10-badgerdao-findings/issues/85).
Title: Missing non reentrancy modifier Severity: Low Risk
The following functions are missing reentrancy modifier although some other pulbic/external functions does use reentrancy modifer. Even though I did not find a way to exploit it, it seems like those functions should have the nonReentrant modifier as the other functions have it as well..
Title: Init frontrun Severity: Low Risk
Most contracts use an init pattern (instead of a constructor) to initialize contract parameters. Unless these are enforced to be atomic with contact deployment via deployment script or factory contracts, they are susceptible to front-running race conditions where an attacker/griefer can front-run (cannot access control because admin roles are not initialized) to initially with their own (malicious) parameters upon detecting (if an event is emitted) which the contract deployer has to redeploy wasting gas and risking other transactions from interacting with the attacker-initialized contract.
Many init functions do not have an explicit event emission which makes monitoring such scenarios harder. All of them have re-init checks; while many are explicit some (those in auction contracts) have implicit reinit checks in initAccessControls() which is better if converted to an explicit check in the main init function itself. (details credit to: https://github.com/code-423n4/2021-09-sushimiso-findings/issues/64) The vulnerable initialization functions in the codebase are:
Title: Two arrays length mismatch Severity: Low/Med Risk
The functions below fail to perform input validation on arrays to verify the lengths match. A mismatch could lead to an exception or undefined behavior. Consider making this a medium risk please.
Title: Override function but with different argument location Severity: Low/Med Risk
Title: Unsafe Cast Severity: Medium Risk
use openzeppilin's safeCast in:
Title: Div by 0 Severity: Medium Risk
Division by 0 can lead to accidentally revert, (An example of a similar issue - https://github.com/code-423n4/2021-10-defiprotocol-findings/issues/84)