Skip to content
Access control Audit finding Beginner

Broken contract ownership logic at alchemistv3 sol

The contract's ownership transfer is broken because the function to accept admin ownership is protected by the same admin-only modifier as the transfer function, so the pending admin cannot call it. The contract remains stuck with the initial admin, and the pending admin can never take over.

Cyborg Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

57746 sc low broken contract ownership logic at alchemistv3 sol

Submitted on Oct 28th 2025 at 16:28:14 UTC by @Cyborg for Audit Comp | Alchemix V3

Description

Brief/Intro

Broken contract ownership logic at AlchemistV3.sol due to impossible accept ownership method.

Vulnerability Details

Inside src/AlchemistCurator.sol there are 2 methods to handle the admin transfership - methods transferAdminOwnerShip and acceptAdminOwnership. The problem here is that both methods are created with modifier onlyAdmin meaning that the selected pendingAdmin at method transferAdminOwnerShip can't really request method acceptAdminOwnership in order to accept the admin role, because he is not yet the admin thus the onlyAdmin modifier will revert. There is no way for the pendingAdmin to accept the ownership and there is no way for the current admin to force transfer the ownership. The smart contract has very important methods for Morpho's Vault V2 that are protected with the onlyAdmin modifier.

Impact Details

The AlchemistV3 contract being stuck with the initial admin.

Recommendation

Remove the onlyAdmin modifier from method acceptAdminOwnership and add validation to check if the msg.sender == pendingAdmin:

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

Proof of Concept

Proof of Concept

Create file src/test/AlchemistCurator.test_acceptAdminOwnership.t.sol and run it with command forge test src/test/AlchemistCurator.test_acceptAdminOwnership.t.sol -vv:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import "forge-std/Test.sol";
import {MockAlchemistCurator} from "./mocks/MockAlchemistCurator.sol";


contract AlchemistCuratorTest is Test {
    MockAlchemistCurator public mytCuratorProxy;
    address public admin = address(0x4444444444444444444444444444444444444444); // DAO OSX
    address public newAdmin = address(0x123);

    function setUp() public {
        vm.startPrank(admin);
        mytCuratorProxy = new MockAlchemistCurator(admin, admin);
        vm.stopPrank();
    }

    function test_acceptAdminOwnership() public {
        vm.startPrank(admin);
        assertEq(mytCuratorProxy.pendingAdmin(), address(0));

        mytCuratorProxy.transferAdminOwnerShip(newAdmin);
        assertEq(mytCuratorProxy.pendingAdmin(), newAdmin);

        vm.startPrank(newAdmin);
        vm.expectRevert(bytes("PD")); // error returned from https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/utils/PermissionedProxy.sol#L18
        mytCuratorProxy.acceptAdminOwnership();
    }
}

The original report as published on Immunefi, by Cyborg. 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 incorrectly uses the onlyAdmin modifier, which prevents the pending admin from calling it.

Impact

The contract is stuck with the initial admin, and the pending admin can never accept ownership, so the admin role cannot be transferred.

What the attacker needed

Admin calls transferAdminOwnerShip; pending admin calls acceptAdminOwnership

The fix

The onlyAdmin modifier should be removed from acceptAdminOwnership and replaced with a check that the caller is the pending admin.

How it was found

  1. The current admin calls transferAdminOwnerShip to set a pending admin.
  2. The pending admin calls acceptAdminOwnership.
  3. The call reverts because the onlyAdmin modifier rejects the pending 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.

A smart contract has an admin who can call important functions. To hand over control, the current admin nominates a new admin, and that person must accept. Here, the accept function can only be called by the current admin, so the nominated person is blocked and the contract stays with the original admin forever.

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 Cyborg

View all

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