MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: medium
Invalid

Improve `_transferOwnership` in the Contracts of `Distribution`, `L1Sender`, `L2MessageReceiver`, and `L2TokenReceiver`

Summary

The_transferOwnership function, allowing contract developers to adjust ownership dynamically, enhances flexibility and security in Ethereum smart contract ecosystems.

Vulnerability Details

In smart contract development, there are typically specific roles or entities, such as the creator (deployer), administrator, owner, etc., who have special control permissions over the contract. These roles are usually represented by specific addresses, such as the creator being the address that deployed the contract, and administrators and owners being able to be set within the contract.

In the OpenZeppelin OwnableUpgradeable contract, the owner's address is by default set to msg.sender, which is the address that deployed the contract. However, this approach may have some issues:

If the owner of the contract is a smart contract instead of a human user, then msg.sender will become the address of the smart contract, not the expected owner's address.

Therefore, we may need to change the owner to ensure that the owner's address is the one we expect. In the OpenZeppelin OwnableUpgradeable contract, we can use the _transferOwnership function to change the owner in the contracts of Distribution, L1Sender, L2MessageReceiver, and L2TokenReceiver .

Distribution::Distribution_init
L1Sender::L1Sender__init
L2MessageReceiver::L2MessageReceiver__init
L2TokenReceiver::L2TokenReceiver__init

function Distribution_init(
+ address _owner,
address depositToken_,
address l1Sender_,
Pool[] calldata poolsInfo_
) external initializer {
__Ownable_init();
+ _transferOwnership(_owner);
__UUPSUpgradeable_init();

Impact

The default ownership assignment in OpenZeppelin's OwnableUpgradeable contract, where the owner's address is set to msg.sender, can lead to complications in scenarios involving factory contracts or smart contract owners. This may result in unintended ownership configurations, potentially jeopardizing the security and functionality of the contract.

Tools Used

Manual Review

Recommendation

To mitigate these concerns, it is recommended to utilize the _transferOwnership function provided by OwnableUpgradeable to customize ownership roles according to specific requirements as shown in Vulnerability Details.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.