Skip to content
Access control Audit finding Beginner

Acceptadminownership doesn t allow expected user approval

The acceptAdminOwnership function is guarded by the onlyAdmin modifier, so the pendingAdmin cannot call it to accept ownership. The current admin must call it instead, which defeats the intended two-step ownership transfer.

magtentic Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

57637 sc low acceptadminownership doesn t allow expected user approval

Submitted on Oct 27th 2025 at 19:46:04 UTC by @magtentic for Audit Comp | Alchemix V3

Description

Brief/Intro

acceptAdminOwnership is a function to transfer a pendingAdmin request as part of a 2 step process.
As such, there is an expectancy that the pendingAdmin should be able to call the function without the function reverting.

Vulnerability Details

When pendingAdmin calls acceptAdminOwnership, the transaction reverts.
This is unexpected, as the function is meant to be called by the pendingAdmin.
The reason for this mainly resides with the function having the onlyAdmin modifier attached to it which then forces the admin to only call this function.

    function acceptAdminOwnership() external onlyAdmin {
...

onlyAdmin modifier :

    modifier onlyAdmin() {
        require(msg.sender == admin, "PD");
        _;
    }

This process just nullifies the 2 step process of calling transferAdminOwnerShip then the pendingAdmin calling acceptAdminOwnership as the current admin could've then just called setAdmin with the new admin details.

Impact Details

pendingAdmin cannot accept admin ownership, in the context of the naming, acceptance of a pendingAdmin to admin is done by the pendingAdmin and not the current admin.

References

As a sidenote, the function transferAdminOwnerShip has an uppercase S in the name which should be lowercase for readability.

Proof of Concept

Proof of Concept

Steps below shows how a pendingAdmin cannot accept the admin ownership to themselves and needs to be done by the existing admin on their behalf.

  • Current admin configures a new admin by calling transferAdminOwnerShip
  • New admin tries to accept admin ownership by calling acceptAdminOwnership which then fails.
  • Current admin calls acceptAdminOwnership which now passes due to the onlyAdmin modifier.
  • Additional flows calling setAdmin to transfer ownership back to previous admin showing only a single step was required from the current admin
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;

import {Test} from "forge-std/Test.sol";
import {VaultV2} from "../../lib/vault-v2/src/VaultV2.sol";
import {ERC20Mock} from "../../lib/vault-v2/test/mocks/ERC20Mock.sol";
import {IVaultV2} from "../../lib/vault-v2/src/interfaces/IVaultV2.sol";
import {TestYieldToken} from "./mocks/TestYieldToken.sol";
import {TestERC20} from "./mocks/TestERC20.sol";
import {TokenUtils} from "../libraries/TokenUtils.sol";
import {MockYieldToken} from "./mocks/MockYieldToken.sol";
import {IMockYieldToken} from "./mocks/MockYieldToken.sol";
import {MockMYTStrategy} from "./mocks/MockMYTStrategy.sol";
import {MockAlchemistCurator} from "./mocks/MockAlchemistCurator.sol";
import {MYTTestHelper} from "./libraries/MYTTestHelper.sol";
import {IMYTStrategy} from "../interfaces/IMYTStrategy.sol";

contract AlchemistCuratorTest is Test {
    using MYTTestHelper for *;

    MockAlchemistCurator public mytCuratorProxy;
    VaultV2 public vault;
    address public operator = address(0x2222222222222222222222222222222222222222); // default operator
    address public admin = address(0x4444444444444444444444444444444444444444); // DAO OSX
    address public newAdmin = address(0x12345); 
    address public mockVaultCollateral = address(new TestERC20(100e18, uint8(18)));
    address public mockStrategyYieldToken = address(new MockYieldToken(mockVaultCollateral));
    uint256 public defaultStrategyAbsoluteCap = 200 ether;
    uint256 public defaultStrategyRelativeCap = 1e18; // 100%
    MockMYTStrategy public mytStrategy;

    function setUp() public {
        vm.startPrank(admin);
        mytCuratorProxy = new MockAlchemistCurator(admin, operator);
        vault = MYTTestHelper._setupVault(mockVaultCollateral, admin, address(mytCuratorProxy));
        mytStrategy = MYTTestHelper._setupStrategy(address(vault), mockStrategyYieldToken, admin, "MockToken", "MockTokenProtocol", IMYTStrategy.RiskClass.LOW);
        vm.stopPrank();
    }

    function testAcceptPendingAdminFailure() public {
        vm.prank(admin);
        mytCuratorProxy.transferAdminOwnerShip(newAdmin);

        //New Admin tries to accept and fails miserably
        vm.startPrank(newAdmin);
        vm.expectRevert();
        mytCuratorProxy.acceptAdminOwnership();
        vm.stopPrank();

        //Current admin then has to acceptAdminOwnership for new admins
        vm.startPrank(admin);
        mytCuratorProxy.acceptAdminOwnership();
        vm.stopPrank();

        //2 step process for no reason as admin could've just called setAdmin to transfer ownership
        vm.prank(newAdmin);
        mytCuratorProxy.setAdmin(admin);

        //Test with new admin to transfer ownership to verify that it doesn't revert
        vm.prank(admin);
        mytCuratorProxy.transferAdminOwnerShip(newAdmin);
    }
}

The original report as published on Immunefi, by magtentic. 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

Root cause

The acceptAdminOwnership function uses the onlyAdmin modifier, which requires the caller to be the current admin, instead of allowing the pendingAdmin to call it.

Impact

The pendingAdmin cannot accept ownership, so the two-step transfer process is broken and the current admin must perform the acceptance, effectively making it a single-step transfer.

What the attacker needed

Current admin calls transferAdminOwnerShip

The fix

The acceptAdminOwnership function should be callable by the pendingAdmin, not the current admin, for example by removing the onlyAdmin modifier and checking that the caller is the pendingAdmin.

How it was found

  1. Current admin calls transferAdminOwnerShip to set a new admin.
  2. New admin calls acceptAdminOwnership, which reverts.
  3. Current admin calls acceptAdminOwnership, which succeeds.
  4. Current admin can use setAdmin to transfer ownership in a single step.

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 smart contract has an admin who controls it. The contract tries to let a new admin take over in two steps: the old admin nominates someone, and that person accepts. But the code only lets the old admin call the accept function, so the new person cannot accept. This means the two-step process does not work as intended.

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 magtentic

View all

8 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.