Upgradeable contracts use the initialize function to initialize state variables instead of the constructor in traditional contracts. Similarly, the SystemConfig.sol contract uses the initialize function to initialize the SystemConfigStorage::basePlatformFeeRate and SystemConfigStorage::baseReferralRate variables.
The SystemConfig::initialize function has no protection against re-initialization
Thus, the contract can be re-intialized changing the initial values of the state variables.
When SystemConfig.sol is re-initialized using the SystemConfig::initialize function, it results in different SystemConfigStorage::basePlatformFeeRate and SystemConfigStorage::baseReferralRate values for users who interact with the protocol before and after the re-initialization of the contract.
Manual Review
Foundry
Proof of Concept:
Run: forge test --match-test test_SystemConfig_Can_ReInitialize
Output:
Thus the values of the state variables have changed after re-initialization.
Consider protecting the SystemConfig::initialize function against re-initialization by using the initializer modifier from openzeppelin.
This way, the SystemConfig.sol contract can only be initiallized once.
The following issues and its duplicates are invalid as admin errors/input validation/malicious intents are1 generally considered invalid based on [codehawks guidelines](https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity#findings-that-may-be-invalid). If they deploy/set inputs of the contracts appropriately, there will be no issue. Additionally admins are trusted as noted in READ.ME they can break certain assumption of the code based on their actions, and
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.