Skip to content
Access control Audit finding Beginner

Broken two step admin transfer pattern

The acceptAdminOwnership function uses the onlyAdmin modifier, so only the current admin can call it, not the pending admin. This lets the current admin complete a transfer unilaterally, defeating the two-step pattern and risking permanent loss of control if the new address is wrong.

teoslaf1 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

58198 sc low broken two step admin transfer pattern

Submitted on Oct 31st 2025 at 10:23:39 UTC by @teoslaf1 for Audit Comp | Alchemix V3

Description

Description

The acceptAdminOwnership() function has incorrect access control that prevents the pending admin from accepting ownership while allowing the current admin to complete the transfer unilaterally. This completely defeats the purpose of the two-step transfer pattern, which requires the new admin to explicitly accept ownership to prevent accidental transfers to incorrect or inaccessible addresses.

The function uses onlyAdmin modifier, which checks msg.sender == admin (the current admin), when it should check msg.sender == pendingAdmin (the new pending admin).

Vulnerable Code

Solidity
function acceptAdminOwnership() external onlyAdmin {  // Wrong modifier
    admin = pendingAdmin;
    pendingAdmin = address(0);
    emit AdminChanged(admin);
}

Impact

  • Pending admin cannot accept ownership: The intended recipient is blocked from accepting the transfer
  • Current admin retains full control: Can complete the transfer unilaterally without the new admin's consent or confirmation
  • Risk of permanent loss: If admin transfers to a wrong/inaccessible address, they can still complete it, permanently losing control
  • Defeats security pattern: The two-step transfer becomes a one-step transfer with extra steps
  • No validation of new admin: The new address never proves it can interact with the contract

Recommendation

Change the access control to require the pending admin (not current admin) to accept:

Solidity
function acceptAdminOwnership() external {
    require(msg.sender == pendingAdmin, "not pending admin");
    admin = pendingAdmin;
    pendingAdmin = address(0);
    emit AdminChanged(admin);
}

Proof of Concept

Proof of Concept

Add this to AlchemistCurator.t.sol

Solidity
   function testBrokenAdminTransfer() public {
        address pendingAdmin = address(0x6666666666666666666666666666666666666666);
        
        // Step 1: Current admin initiates transfer to new address
        vm.prank(admin);
        mytCuratorProxy.transferAdminOwnerShip(pendingAdmin);
        
        // Step 2: Pending admin CANNOT accept because onlyAdmin requires current admin
        vm.prank(pendingAdmin);
        vm.expectRevert(abi.encode("PD")); // This should not revert in a proper 2-step transfer
        mytCuratorProxy.acceptAdminOwnership();
        
        // Step 3:Current admin can accept on behalf of pending admin
        vm.prank(admin);
        mytCuratorProxy.acceptAdminOwnership();
        
        // Result: Admin changed without pendingAdmin ever calling accept
        // The pendingAdmin is now the admin, but they never confirmed the transfer
        assertEq(mytCuratorProxy.pendingAdmin(), address(0));
    }

The original report as published on Immunefi, by teoslaf1. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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 admin cannot accept ownership, and the current admin can complete the transfer unilaterally, which could permanently lose control if the new address is wrong or inaccessible.

What the attacker needed

Current admin initiates transfer; pending admin address is set

The fix

The function should be changed to require that the caller is the pending admin, not the current admin.

How it was found

  1. Current admin calls transferAdminOwnerShip to set a pending admin.
  2. Pending admin tries to call acceptAdminOwnership but the call reverts because onlyAdmin requires the current admin.
  3. Current admin calls acceptAdminOwnership and the transfer completes without the pending admin's consent.

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.

A two-step admin transfer is meant to be safe: the current admin nominates a new admin, and that new admin must accept before the change happens. Here, the accept function checks for the wrong person, so the current admin can force the change through without the new admin's agreement. This removes the safety check and could lock the contract if the new address is wrong.

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.

More by teoslaf1

View all

7 more disclosed reports, best first.

More from Alchemix V3

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.