Presence of an obsolete, unprotected function that initializes ownership - Rescuable::initializeOwnership.
The contract is an integral part of the functionality of the project as any vulnerabilities in it, can affect the derived classes
CapitalPool.sol
DeliveryPlace.sol
PreMarkets.sol
SystemConfig.sol
TokenManager.sol
Commit Hash: 04fd8634701697184a3f3a5558b41c109866e5f8
Repository URL: https://github.com/Cyfrin/2024-08-tadle/tree/main
The owner of the Rescuable contract is initially set through the constructor, through the constructor of the Ownable contract
The Rescuable contract contains the function Rescuable::initializeOwnership for initializing ownership.
The function Rescuable::initializeOwnership is not guarded by appropriate access control, enabling anyone to invoke it.
However, even if malicious actors attempt to invoke Rescuable::initializeOwnership, it will always revert with an AlreadyInitialized error, as the owner has been set in the constructor.
In summary, the function can be safely removed.
Malicious actors could attempt to transfer ownership by invoking the Rescuable::initializeOwnership function due to the missing access controls. However, given the owner initialization in the constructor, the function in its current form will revert, due to the following validation
Add the following Rescuable.t.sol contract to the test directory
Run forge test --match-contract Rescuable
Observe the result
Manual Code Review: Analyzing the contract code directly.
Static Analysis Tools: Aderyn - https://github.com/Cyfrin/aderyn
Remove the** Rescuable::initializeOwnership **function since the constructor initializes the owner. This function should be removed to prevent confusion and potential security risks associated with its misuse.
Ensure you have a robust test suite, covering access controls.
Benefit from the usage of static analysis tools such as Slither and Aderyn to detect common vulnerabilities and bad practices.
If there is a valid use case for dynamically changing ownership post-deployment, ensure the functionality is secured with appropriate access control modifiers like onlyOwner or similar, to prevent unauthorized use. Furthermore, consider using Ownable::transferOwnership
Aside from `Rescuable.sol` being OOS, this is invalid based on codehawks guidelines regarding unprotected initializers. Additionally, this should be called concurrently when deploying a new proxy, but this submissions does not identify that particular issue of an uninitialized owner for proxy 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.