-
Notifications
You must be signed in to change notification settings - Fork 0
No Transfer Ownership Pattern #65
Copy link
Copy link
Open
Labels
0 (Non-critical)Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisationCode style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisationbugSomething isn't workingSomething isn't workingresolvedFinding has been patched by sponsor (sponsor pls link to PR containing fix)Finding has been patched by sponsor (sponsor pls link to PR containing fix)sponsor confirmedSponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Metadata
Metadata
Assignees
Labels
0 (Non-critical)Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisationCode style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisationbugSomething isn't workingSomething isn't workingresolvedFinding has been patched by sponsor (sponsor pls link to PR containing fix)Finding has been patched by sponsor (sponsor pls link to PR containing fix)sponsor confirmedSponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
cccz
Vulnerability details
Impact
The current ownership transfer process involves the current owner calling transferOwnership(). This function checks the new owner is not the zero address and proceeds to write the new owner’s address into the owner’s state variable. If the nominated EOA account is not a valid account, it is entirely possible the owner may accidentally transfer ownership to an uncontrolled account, breaking all functions with the onlyOwner() modifier.
Proof of Concept
https://github.com/code-423n4/2022-01-openleverage/blob/main/openleverage-contracts/contracts/Airdrop.sol#L9
Tools Used
None
Recommended Mitigation Steps
Implement zero address check and consider implementing a two step process where the owner nominates an account and the nominated account needs to call an acceptOwnership() function for the transfer of ownership to fully succeed. This ensures the nominated EOA account is a valid and active account.