Skip to content
Access control Audit finding Intermediate

Inherited setadmin function allows to bypass two step admin ownership transfer mechanism

The AlchemistCurator contract intends a two-step admin transfer, but it inherits a single-step setAdmin function from PermissionedProxy that lets the current admin change the admin address immediately. An admin could therefore bypass the confirmation step, intentionally or by mistake, and hand control to a wrong or unusable address.

ByteKnight Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

57114 sc low inherited setadmin function allows to bypass two step admin ownership transfer mechanism

Submitted on Oct 23rd 2025 at 15:53:46 UTC by @ByteKnight for Audit Comp | Alchemix V3

Description

Brief/Intro

The AlchemistCurator contract implements a two-step admin ownership transfer mechanism via the transferAdminOwnerShip() and acceptAdminOwnership() functions. However, since AlchemistCurator inherits from PermissionedProxy, it also inherits the setAdmin() function at PermissionedProxy, which allows the current admin to directly change the admin address in a single transaction, completely bypassing the intended two-step transfer security mechanism.

Vulnerability Details

The AlchemistCurator contract tries to implement a secure two-step ownership transfer mechanism:

SOL
function transferAdminOwnerShip(address _newAdmin) external onlyAdmin {
    pendingAdmin = _newAdmin;
}

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

However, AlchemistCurator inherits from PermissionedProxy, which provides a direct single-step admin change function:

SOL
function setAdmin(address _admin) external onlyAdmin {
    require(_admin != address(0), "zero");
    admin = _admin;
    emit AdminUpdated(_admin);
}

This inheritance creates two parallel admin transfer mechanisms:

  1. Two-step mechanism (desired): transferAdminOwnerShip() -> acceptAdminOwnership()
  2. Single-step bypass (inherited): setAdmin()

The presence of the setAdmin() completely undermines the security benefits of the two-step mechanism, as this function can be used intentionally or accidentally to instantly transfer ownership to any address without requiring confirmation from the new admin.

NOTE: This finding is related to but distinct from the Report ID: 56911, which identifies that the two-step pattern itself is incorrectly implemented (using onlyAdmin instead of checking pendingAdmin). This finding demonstrates that even if that issue were fixed, the inherited setAdmin() function would still allow bypassing the two-step mechanism entirely.

Impact Details

Having both a two-step and single-step mechanism creates confusion about which pattern should be used and can lead to instant transfer of a control to an incorrect address (due to typo, copy-paste error, or sending to a contract that cannot manage the protocol), which could lead to the contract being inaccessible.

References

Proof of Concept

Proof of Concept

To verify the flaw, do the following steps:

  1. In the PermissionedProxy contract change the visibility of the admin state variable to public. We only need this to be able to log admin address in the terminal with console2.log();
SOL
    address public admin;
  1. Add the following test to existing test suite in the AlchemistCurator.t.sol file:
SOL
function testTwoStepAdminOwnershipCanBeBypassed() public {
        // First, we check who is the current admin in the Alchemist Curator contract
        address currentAdmin = mytCuratorProxy.admin();
        console2.log("Current admin: ", currentAdmin);

        // Next, admin can accidentally or intentionally call the SetAdmin function from PermissionedProxy
        // Thus, bypassing the two-step ownership transfer mechanism implemented in the Alchemist Curator contract with transferAdminOwnerShip and acceptAdminOwnership functions
        address newAdmin = makeAddr("newAdmin");
        console2.log("New admin address: ", newAdmin);

        vm.prank(admin);
        mytCuratorProxy.setAdmin(newAdmin);

        // Lastly, we check that admin was set to a new admin address without him explicitly accepting it. This may lead to a constant ownership loss
        currentAdmin = mytCuratorProxy.admin();
        console2.log("Updated admin: ", currentAdmin);
    }
  1. To run the test, run the following script in terminal and paste your fork url:
FOUNDRY_PROFILE=default forge test --fork-url <YOUR_FORK_URL> --mt testTwoStepAdminOwnershipCanBeBypassed  -vvvv --evm-version cancun

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

Likely the contract inherits a base contract that exposes a direct single-step setAdmin function, leaving two parallel ways to change the admin and undermining the two-step design.

Impact

The two-step protection can be bypassed, so control could be transferred instantly to an incorrect address, potentially making the contract inaccessible; the report rates this as low severity.

What the attacker needed

Caller is the current admin

The fix

The inherited single-step setAdmin function should be removed, overridden or restricted so the two-step transfer is the only way to change the admin.

How it was found

  1. Make the inherited admin state variable public so its value can be logged in tests.
  2. Add a test that reads the current admin, calls the inherited setAdmin with a new address as the admin, then reads the admin again.
  3. Run the test with forge against a fork to confirm the admin changed without the new admin accepting.

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 contract is a program on a blockchain that holds funds and rules. This one wanted a safe handover: the old admin nominates a new admin, and the new admin must accept before the change happens. But a helper contract it is built on also offers a one-click handover, so the safe two-step process can be skipped entirely.

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 ByteKnight

View all

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