The initialize function of the contract lacks proper access control mechanisms, allowing any address to invoke it. While the initializer modifier prevents multiple invocations, it does not restrict who can call the function. This oversight can lead to unauthorized modification of critical contract state variables such as principal, schoolFees, and usdc, compromising the intended functionality of the contract.
Affected Function:
initialize
Current Modifier:
The function uses the initializer modifier to ensure it is only called once.
Issue:
The initializer modifier does not restrict the caller of the function.
Any address can call the initialize function, which allows them to set arbitrary values for critical state variables:
principal: Address of the principal.
schoolFees: The school fees amount.
usdc: Address of the USDC token contract.
Code Reference:
Unauthorized Contract Initialization:
An attacker can invoke the initialize function and set malicious or incorrect values for the contract’s critical state variables.
System Functionality Compromised:
Key functionalities relying on correctly initialized variables (such as principal and usdc) may break, leading to loss of trust or funds.
Manual review
Add Access Control
Restrict access to the initialize function by introducing a mechanism such as an onlyDeployer or onlyOwner modifier.
Example Implementation:
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.