Two step mechanism to transfer ownership is broken due to incorrect access control
The two-step ownership transfer in the AlchemistCurator contract is broken because the acceptAdminOwnership function is restricted to the current admin instead of the pending admin. This means the pending admin cannot accept ownership, and if the current admin mistakenly transfers to an invalid address, the contract could become permanently locked.
- Disclosed after under an hour
58189 sc low two step mechanism to transfer ownership is broken due to incorrect access control
Submitted on Oct 31st 2025 at 09:24:19 UTC by @KKam86 for Audit Comp | Alchemix V3
- Report ID: #58189
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi\\_audit/src/AlchemistCurator.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
Implementation of two-step mechanism to transfer ownership in AlchemistCurator contract doesn't work as intended because function acceptAdminOwnership() have access control modifier onlyAdmin. In result only current admin can call acceptAdminOwnership(). This function should be called by new pending admin to accept new privileges.
Vulnerability Details
Two-step mechanism to transfer ownership consists of two functions which must be called sequentially in correct order:
- Current admin transfers his privileges (ownership) to another address by calling
transferAdminOwnerShip(). This new address is assigned topendingAdminvariable. This address must accept new privileges. - New pending admin must accept ownership by making a call to
acceptAdminOwnership(). This function should be reserved only topendingAdmin.
However second step of transfering ownership process in AlchemistCurator is wrongly implemented. Function acceptAdminOwnership() have access control modifier onlyAdmin and in result only current admin can call this function:
modifier onlyAdmin() {
require(msg.sender == admin, "PD"); // admin is the current admin in AlchemistCurator contract
_;
}
As an example, OpenZeppelin's Ownable2Step contract implements two-step mechanism for transfering ownership in the following, correct way:
- Current owner calls
transferOwnership()and propose new pending admin:
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*
* Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
- New pending admin accepts the ownership transfer by making a call to
acceptOwnership():
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
>> if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
Also transferOwnership() function emit additional event OwnershipTransferStarted to signal the begining of ownership transfer process.
Impact Details
- No protection against common mistakes, such as transfers of ownership to incorrect accounts, or to contracts that are unable to interact with the permission system.
- Risk of permanent DOS. If current admin accepts wrong address (which is unable to interact with
AlchemistCuratorcontract) by mistake, then all functions withonlyAdminmodifier will always revert. There is no way to undo the changes (only redeploying the newAlchemistCuratorcontract).
References
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable2Step.sol
Proof of Concept
Proof of Concept
Place following test in AlchemistCurator.t.sol file:
function testAcceptAdminOwnershipPendingAdminAccessRevert() public {
address newAdmin = makeAddr("newAdmin");
vm.prank(admin);
mytCuratorProxy.transferAdminOwnerShip(newAdmin);
assertEq(mytCuratorProxy.pendingAdmin(), newAdmin);
// New pending admin tries to accept ownership
vm.startPrank(newAdmin);
vm.expectRevert(abi.encode("PD"));
mytCuratorProxy.acceptAdminOwnership();
vm.stopPrank();
}
Output:
Ran 1 test for src/test/AlchemistCurator.t.sol:AlchemistCuratorTest
[PASS] testAcceptAdminOwnershipPendingAdminAccessRevert() (gas: 47377)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 145.55ms (21.00ms CPU time)
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
The two-step ownership transfer fails, removing protection against mistakes and risking permanent denial of service if the admin nominates an invalid address, as all onlyAdmin functions would revert with no way to undo.
What the attacker needed
Current admin initiates ownership transfer; Pending admin attempts to accept
The fix
The acceptAdminOwnership function should be callable only by the pendingAdmin, not the current admin.
How it was found
- Current admin calls transferAdminOwnerShip with a new address, setting pendingAdmin.
- The new pending admin attempts to call acceptAdminOwnership.
- The call reverts because the function requires the caller to be the current admin.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In smart contracts, ownership transfer often uses a two-step process: the current owner nominates a new owner, and that new owner must accept. Here, the accept function is wrongly restricted to the current owner, so the nominated person can never accept. This breaks the safety mechanism and could lock the contract if the wrong address is nominated.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.