The initialize
functions in both SystemConfig.sol
and TokenManager.sol
lack modifiers to ensure they can only be called once. This absence allows the initialize
functions to be called multiple times, leading to potential issues with contract state predictability and security. Adding the initializer
modifier ensures these functions can only be invoked once during the contract's lifecycle.
Location: contracts/SystemConfig.sol
, Lines 25-31
Code Snippet:
Location: contracts/TokenManager.sol
, Lines 43-45
Code Snippet:
The initialize functions can currently be called multiple times because there is no mechanism in place to prevent them from being re-invoked after the first successful call. This can lead to undesirable changes in state variables and potential security vulnerabilities.
Unpredictable State Changes: Repeated calls to initialize can overwrite critical initialization parameters, leading to unpredictable behavior.
Security Risks: The ability to reinitialize contracts can introduce significant security risks, particularly if rogue actors gain control over the call.
To mitigate this issue, the initialize functions should use the initializer modifier from the OpenZeppelin Initializable contract. This ensures that the initialize functions can only be executed once.
Import and Extend OpenZeppelin's Initializable
Contract: Import OpenZeppelin's Initializable
contract and extend it in both SystemConfig.sol
and TokenManager.sol
.
Use the initializer
Modifier: Apply the initializer
modifier to the initialize
functions to ensure they can only be called once.
SystemConfig.sol:
TokenManager.sol:
Invalid, can only be initialized by admin, which are trusted per contest READ.ME. So this would take a malicious admin to reinitialize contracts.
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.