Pending Owner cannot accept ownership because of wrong implementation of `transferOwnership` and `acceptOwnership` functions
The ownership transfer functions in TimedAdminFacet are implemented incorrectly: the pending owner cannot accept ownership because the acceptOwnership function calls reassignOwner, which requires the caller to be the current owner. This prevents the ownership handover from completing, potentially leaving the contract without an effective admin.
0xnija Follow with SoarinSkySagar, neeloy and 2 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2025-09-ammplify-judging/issues/183
Found by
0xnija, SoarinSkySagar, neeloy, thimthor, v_2110
Summary
When admin(owner) try to transfer ownership, pending owner is unable to accept ownership even after the required delay has elapsed because of wrong implementation of transferOwnership and acceptOwnership functions in TimedAdminFacet which is the base contract of AdminFacet.
This prevents the ownership handover process from completing as intended, potentially leaving the contract without an effective admin and blocking any actions that require ownership privileges.
Root Cause
It calls AdminLib.reassignOwner function in acceptOwnership function called by pending owner instead of calling it in transferOwnership function called by current owner.
/* Owner changes */
function transferOwnership(address _newOwner) external virtual override {
AdminLib.validateOwner();
Timed.memoryPrecommit(OWNER_USE_ID, abi.encode(_newOwner));
}
/// The pending owner can accept their ownership rights.
function acceptOwnership() external virtual override {
bytes memory entry = Timed.fetchPrecommit(OWNER_USE_ID, getDelay(true));
address _newOwner = abi.decode(entry, (address));
AdminLib.reassignOwner(_newOwner);
AdminLib.acceptOwnership();
emit IERC173.OwnershipTransferred(AdminLib.getOwner(), msg.sender);
}
In reassignOwner function, it validates owner to check if msg.sender is current owner.
function reassignOwner(address newOwner) internal {
validateOwner(); // This is the only validate we do internal to AdminLib because it's so important.
adminStore().pendingOwner = newOwner;
}
function validateOwner() internal view {
if (msg.sender != adminStore().owner) {
revert NotOwner();
}
}
So it will be reverted with NotOwner error as the caller of acceptOwnership(msg.sender) is pending owner, not the owner.
Internal Pre-conditions
- Admin try to transfer ownership to a new owner by calling
transferOwnership. - After delay(3 days according to codebase), the new owner try to accept ownership by calling
acceptOwnership.
External Pre-conditions
None
Attack Path
- Admin try to transfer ownership to a new owner by calling
transferOwnership. - After delay(3 days according to codebase), the new owner try to accept ownership by calling
acceptOwnership.
Impact
The pending admin (owner) is unable to accept ownership even after the required delay has elapsed since the current admin’s call to transferOwnership.
This prevents the ownership handover process from completing as intended.
PoC
Add below test function to Ammplify\test\facets\Admin.t.sol and run forge test --mt testPendingOwnerCannotAcceptOwnership -vvvv in terminal.
function testPendingOwnerCannotAcceptOwnership() public {
address pendingOwner = makeAddr("pendingOwner");
adminFacet.transferOwnership(pendingOwner);
// Skip the time delay for testing (3 days as per AdminFacet.getDelay implementation)
vm.warp(block.timestamp + 3 days);
vm.startPrank(pendingOwner);
vm.expectRevert(AdminLib.NotOwner.selector);
adminFacet.acceptOwnership();
vm.stopPrank();
}
Mitigation
Call AdminLib.reassignOwner in transferOwnership function.
function transferOwnership(address _newOwner) external virtual override {
AdminLib.validateOwner();
AdminLib.reassignOwner(_newOwner); // @audit: call it here
Timed.memoryPrecommit(OWNER_USE_ID, abi.encode(_newOwner));
}
function acceptOwnership() external virtual override {
// @audit: You should leave this as is even though you try to remove below condition check because need to check delay is passed or not
bytes memory entry = Timed.fetchPrecommit(OWNER_USE_ID, getDelay(true));
address _newOwner = abi.decode(entry, (address));
// @audit: Just check if _newOwer is msg.sender. You can skip this check because AdminLib.acceptOwnership checks it
if (_newOwner != msg.sender) {
revert AdminLib.ImproperOwnershipAcceptance();
}
AdminLib.acceptOwnership();
emit IERC173.OwnershipTransferred(AdminLib.getOwner(), msg.sender);
}
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 pending owner cannot accept ownership even after the delay, preventing the ownership handover from completing and potentially leaving the contract without an effective admin.
What the attacker needed
Admin initiates ownership transfer; Delay of 3 days passes; Pending owner calls acceptOwnership
The fix
The fix is to call AdminLib.reassignOwner in the transferOwnership function instead of in acceptOwnership, and to adjust acceptOwnership to only check that the caller is the pending owner and that the delay has passed.
How it was found
- Admin calls transferOwnership to nominate a new owner.
- After the delay (3 days), the pending owner calls acceptOwnership.
- The call reverts with NotOwner because the pending owner is not the current owner.
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 later accept. Here, the accept step mistakenly checks that the caller is the current owner, so the nominated person can never complete the transfer. This leaves the contract stuck with the old owner and blocks any admin actions.
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.