Skip to content
Access control Audit finding Beginner

Flawed access control in alchemistcurator admin transfer pattern leads to risk of permanent loss of control

The AlchemistCurator contract's two-step admin transfer is flawed because the accept function is protected by the current admin modifier instead of the pending admin. An admin who nominates an incorrect address and then accepts the transfer can permanently lock all administrative functions.

fullstop Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

56947 sc low flawed access control in alchemistcurator admin transfer pattern leads to risk of permanent loss of control

Submitted on Oct 22nd 2025 at 03:41:12 UTC by @fullstop for Audit Comp | Alchemix V3

Description

Brief/Intro

The AlchemistCurator.sol contract implements a two-step administrative transfer pattern, but the second step, acceptAdminOwnership(), is incorrectly protected by the onlyAdmin modifier. This modifier validates the current admin, not the pending admin. If the current admin nominates an incorrect address (e.g., due to a typo) and then finalizes the transfer, all administrative functions of the contract will be permanently locked, as the new "admin" will be an uncontrollable address.

Vulnerability Details

The standard two-step ownership transfer pattern (transfer + accept) is designed to prevent a common and critical error: transferring ownership to an incorrect address. The pattern's security relies on the new owner (pendingAdmin) proving they control the address by calling the accept function.

The AlchemistCurator contract attempts to implement this pattern but fails in the acceptance step.

  1. The Flawed Implementation (AlchemistCurator.sol)

The contract defines transferAdminOwnerShip and acceptAdminOwnership. Both are protected by the onlyAdmin modifier.

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

    function acceptAdminOwnership() external onlyAdmin {
        admin = pendingAdmin;
        pendingAdmin = address(0);
        emit AdminChanged(admin);
    }
  1. The Modifier (PermissionedProxy.sol)

The onlyAdmin modifier, inherited from PermissionedProxy.sol, checks if the msg.sender is the current admin.

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

Because acceptAdminOwnership uses onlyAdmin, it requires msg.sender == admin. This means the current admin—not the pending admin—is the only one who can call this function. This completely bypasses the security check of the two-step pattern.

  1. Contrast with Correct Implementation (in the same project)

The AlchemistV3.sol contract demonstrates the correct implementation, proving this was likely an unintentional error in AlchemistCurator. AlchemistV3.sol correctly checks if the msg.sender is the pendingAdmin.

Solidity
    function acceptAdmin() external {
        _checkState(pendingAdmin != address(0));

        if (msg.sender != pendingAdmin) {
            revert Unauthorized();
        }

        admin = pendingAdmin;
        pendingAdmin = address(0);

        emit AdminUpdated(admin);
        emit PendingAdminUpdated(address(0));
    }

Impact Details

The impact of this vulnerability is the permanent loss of administrative control over the AlchemistCurator contract.

The admin of this contract is responsible for all critical management functions, including:

Adding new MYT strategies.

Removing old MYT strategies.

Managing absolute and relative deposit caps for all strategies.

Attack Scenario (Accidental):

The current, legitimate admin decides to transfer ownership.

They call transferAdminOwnerShip(address _newAdmin) but make a typo, setting pendingAdmin to an incorrect address (e.g., a dead address or an address they do not control).

Not noticing the typo, the admin immediately calls acceptAdminOwnership() to "complete" the transfer.

The call succeeds because msg.sender is still the current admin.

The admin role is now permanently transferred to the incorrect address.

Consequence: The AlchemistCurator contract is now "bricked." No one can ever again manage strategy caps or update the list of strategies. This would freeze a core component of the protocol, preventing reactions to market conditions, managing risk, or adding new yield sources. This is an irreversible denial of service for the contract's management.

Impact Details

Provide a detailed breakdown of possible losses from an exploit, especially if there are funds at risk. This illustrates the severity of the vulnerability, but it also provides the best possible case for you to be paid the correct amount. Make sure the selected impact is within the program’s list of in-scope impacts and matches the impact you selected.

References

Vulnerable Contract: src/AlchemistCurator.sol Correct Implementation (for comparison): src/AlchemistV3.sol

Proof of Concept

Proof of Concept

This Foundry test can be added to src/test/AlchemistCurator.t.sol to reproduce the vulnerability. The test will pass, proving the vulnerability exists.

Solidity
    /// @notice This test reproduces the flaw in the admin transfer pattern.
    /// @dev The current admin (originalAdmin) can nominate a new admin
    /// and then *immediately accept* the transfer themselves,
    /// because `acceptAdminOwnership` is incorrectly protected by `onlyAdmin`.
    /// A correct implementation would require `msg.sender == pendingAdmin`.
    function testReproduce_FlawedAdminTransfer() public {
        address newAdmin = address(0x1234567890123456789012345678901234567890);
        address originalAdmin = admin; // As defined in setUp

        // 1. Current admin nominates a new admin
        vm.startPrank(originalAdmin);
        mytCuratorProxy.transferAdminOwnerShip(newAdmin);
        assertEq(mytCuratorProxy.pendingAdmin(), newAdmin, "pendingAdmin should be set to newAdmin");

        // 2. VULNERABILITY: The *current* admin calls `acceptAdminOwnership`.
        // This call succeeds because of the `onlyAdmin` modifier,
        // which checks if `msg.sender == admin` (which is true).
        mytCuratorProxy.acceptAdminOwnership();
        vm.stopPrank();

        // 3. Verify the transfer completed successfully
        // The pendingAdmin should be cleared
        assertEq(mytCuratorProxy.pendingAdmin(), address(0), "pendingAdmin should be cleared after acceptance");

        // 4. Verify that newAdmin is now the actual admin
        // We test this by having newAdmin successfully call an admin-only function.
        vm.startPrank(newAdmin);
        mytCuratorProxy.transferAdminOwnerShip(originalAdmin); // This should succeed
        vm.stopPrank();

        // 5. Verify that the originalAdmin is no longer the admin
        // This call should now fail with the "PD" (Permission Denied) error.
        vm.startPrank(originalAdmin);
        vm.expectRevert(bytes("PD"));
        mytCuratorProxy.transferAdminOwnerShip(newAdmin);
        vm.stopPrank();
    }

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

Alchemix V3 is a DeFi protocol, and this report targets the AlchemistCurator.sol contract, which sits in the src/ directory of the project. The curator contract is the component that manages MYT strategies: it is where new strategies are added, old ones removed, and where the absolute and relative deposit caps for every strategy are set. Because those functions are administrative, the contract gates them behind an admin role and provides a two-step pattern for handing that role over: transferAdminOwnerShip nominates a successor, and acceptAdminOwnership is meant to let that successor claim the role.

The report was filed as a low severity smart contract finding under the impact category "Permanent freezing of funds", with the target being the curator contract in the v3-poc repository.

Setup

The report does not describe any accounts, deployed addresses, tool versions or environment beyond the test harness. The proof of concept is a Foundry test intended to be added to src/test/AlchemistCurator.t.sol, and it relies on a setUp that defines an admin variable and a mytCuratorProxy instance of the curator. The test uses vm.startPrank, vm.stopPrank, vm.expectRevert and assertEq, so a working Foundry setup with the project's existing test scaffolding is the only precondition stated.

Finding it

The researcher compared the curator's admin transfer against the standard two-step ownership pattern. In that pattern the first step nominates a new owner and the second step must be callable only by the nominee, which proves the nominee controls the address. The whole point is to catch a mistyped or otherwise wrong address before it becomes the owner.

In AlchemistCurator.sol both halves of the pattern carry the same modifier:

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

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

The modifier comes from PermissionedProxy.sol and checks the current admin, not the pending one:

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

That makes acceptAdminOwnership callable by the outgoing admin, so the acceptance step never proves anything about the nominee. The researcher also pointed at AlchemistV3.sol in the same project as the correct version of the same pattern, where the caller is checked against pendingAdmin:

Solidity
    function acceptAdmin() external {
        _checkState(pendingAdmin != address(0));

        if (msg.sender != pendingAdmin) {
            revert Unauthorized();
        }

        admin = pendingAdmin;
        pendingAdmin = address(0);

        emit AdminUpdated(admin);
        emit PendingAdminUpdated(address(0));
    }

The contrast within one codebase is what makes the curator version look like an unintentional error rather than a deliberate design.

Exploitation

The report frames this as an accidental path rather than an attacker-driven one. The sequence is:

  1. The legitimate admin calls transferAdminOwnerShip(address _newAdmin) with a typo, so pendingAdmin becomes an address the admin does not control, such as a dead address.
  2. Without noticing, the admin calls acceptAdminOwnership() to finish the transfer.
  3. The call succeeds, because msg.sender is still the current admin and onlyAdmin is satisfied.
  4. admin is now the wrong address and pendingAdmin is reset to zero, so the role is permanently transferred away.

Step 1: Reproducing the flaw in a Foundry test

The proof of concept is a single test function:

Solidity
    /// @notice This test reproduces the flaw in the admin transfer pattern.
    /// @dev The current admin (originalAdmin) can nominate a new admin
    /// and then *immediately accept* the transfer themselves,
    /// because `acceptAdminOwnership` is incorrectly protected by `onlyAdmin`.
    /// A correct implementation would require `msg.sender == pendingAdmin`.
    function testReproduce_FlawedAdminTransfer() public {
        address newAdmin = address([redacted]);
        address originalAdmin = admin; // As defined in setUp

        // 1. Current admin nominates a new admin
        vm.startPrank(originalAdmin);
        mytCuratorProxy.transferAdminOwnerShip(newAdmin);
        assertEq(mytCuratorProxy.pendingAdmin(), newAdmin, "pendingAdmin should be set to newAdmin");

        // 2. VULNERABILITY: The *current* admin calls `acceptAdminOwnership`.
        // This call succeeds because of the `onlyAdmin` modifier,
        // which checks if `msg.sender == admin` (which is true).
        mytCuratorProxy.acceptAdminOwnership();
        vm.stopPrank();

        // 3. Verify the transfer completed successfully
        // The pendingAdmin should be cleared
        assertEq(mytCuratorProxy.pendingAdmin(), address(0), "pendingAdmin should be cleared after acceptance");

        // 4. Verify that newAdmin is now the actual admin
        // We test this by having newAdmin successfully call an admin-only function.
        vm.startPrank(newAdmin);
        mytCuratorProxy.transferAdminOwnerShip(originalAdmin); // This should succeed
        vm.stopPrank();

        // 5. Verify that the originalAdmin is no longer the admin
        // This call should now fail with the "PD" (Permission Denied) error.
        vm.startPrank(originalAdmin);
        vm.expectRevert(bytes("PD"));
        mytCuratorProxy.transferAdminOwnerShip(newAdmin);
        vm.stopPrank();
    }

The test pranks as the original admin, nominates newAdmin, and asserts that pendingAdmin is set. It then calls acceptAdminOwnership from the same original admin, which is the step that should have been reserved for the nominee, and asserts that pendingAdmin has been cleared. To show the role really moved, it pranks as newAdmin and calls the admin-only transferAdminOwnerShip, which succeeds. Finally it pranks as originalAdmin again and expects the call to revert with PD, confirming the original admin has lost the role. The report states the test passes, proving the vulnerability exists.

Root cause

The acceptance function is guarded by the wrong check. onlyAdmin requires msg.sender == admin, so the outgoing admin can complete the handover to any address, including one nobody controls. The two-step pattern's security property, that the new owner must demonstrate control of the address, is never enforced. The report notes that AlchemistV3.sol in the same project does check msg.sender != pendingAdmin and reverts with Unauthorized, which suggests the curator version is likely an unintentional error.

Impact

The admin of the curator contract controls all critical management functions: adding new MYT strategies, removing old MYT strategies, and managing absolute and relative deposit caps for all strategies. If the role is transferred to an address nobody controls, the contract is effectively bricked. No one can manage strategy caps or update the strategy list again, which freezes a core component of the protocol and prevents reacting to market conditions, managing risk or adding new yield sources. The report describes this as an irreversible denial of service for the contract's management.

The report does not describe an attacker who can trigger this from outside; the scenario given is an accidental typo by the legitimate admin followed by an immediate acceptance. The impact category selected is permanent freezing of funds.

Fix

The change it implies is to make acceptAdminOwnership check the caller against pendingAdmin rather than admin, as AlchemistV3.sol already does, so that only the nominee can complete the transfer.

Variants to test

  • Look for any two-step transfer (admin, owner, operator, guardian) where the accept function carries the same modifier as the propose function. A positive result is that the proposing account can call accept and the role moves to an address that never transacted.
  • Check whether the accept function verifies pendingAdmin != address(0). If it does not, an acceptance with no pending nominee can set the role to the zero address. A positive result is admin becoming address(0) after a bare accept call.
  • Compare sibling contracts in the same repository that implement the same pattern. A positive result is one contract checking msg.sender == pendingAdmin and another checking msg.sender == admin.
  • Check whether the propose function can be called again after a nomination to overwrite pendingAdmin, and whether the accept function can be front-run by a re-nomination. A positive result is a race where the role lands on an address the proposer did not intend.

Hunting notes

This class of bug hides in administrative plumbing rather than in the value-moving logic: ownership and role transfer functions, upgrade admin slots, and pause or guardian roles. During recon, the signal is a contract that advertises a two-step transfer but whose accept function shares a modifier with the propose function, or whose accept function has no caller check at all. Reading the modifier definitions in the inherited base contract, as this report does with PermissionedProxy.sol, is usually enough to spot it. Comparing against a sibling contract in the same repository that implements the pattern correctly is a cheap way to show intent and raise confidence. The report showed impact by walking through the specific management functions the role controls and by writing a Foundry test that demonstrates the current admin completing the handover to a nominated address.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 15 min read.

What happened, in plain words

Alchemix V3 is a DeFi protocol, meaning a set of programs that run on a blockchain and handle money-like assets. This report is about one of its smart contracts, AlchemistCurator.sol. A smart contract is a program that lives on the blockchain: once deployed, its code runs exactly as written, and nobody can quietly change it.

The curator contract has a special role called the admin. Only the admin can do the important management jobs: adding new MYT strategies, removing old ones, and setting the deposit caps for every strategy. A strategy here is a piece of code that puts funds to work; a deposit cap is a limit on how much can be put into it.

Because the admin role is powerful, the contract offers a way to hand it over safely, in two steps. The first step, transferAdminOwnerShip, nominates a successor. The second step, acceptAdminOwnership, is supposed to let that successor claim the role. The idea is that the successor has to prove they really control the address by calling the second function themselves.

The bug is that the second step is guarded by the wrong check. It asks "are you the current admin?" instead of "are you the nominated successor?". So the outgoing admin can complete the handover to any address, even one nobody controls. If the admin makes a typo in the nominated address and then accepts the transfer, the admin role ends up on an address that can never act, and the contract's management is permanently locked.

Context

Alchemix V3 is a DeFi protocol, and this report targets the AlchemistCurator.sol contract, which sits in the src/ directory of the project. The curator contract is the component that manages MYT strategies: it is where new strategies are added, old ones removed, and where the absolute and relative deposit caps for every strategy are set. Because those functions are administrative, the contract gates them behind an admin role and provides a two-step pattern for handing that role over: transferAdminOwnerShip nominates a successor, and acceptAdminOwnership is meant to let that successor claim the role.

A few terms from that paragraph, from zero:

  • Smart contract: a program stored on a blockchain. It has its own address and its own storage, and its functions can be called by anyone who sends a transaction to it.
  • Role: a named permission inside a contract. The contract keeps a record of which address holds the role, and functions can refuse to run unless the caller holds it.
  • Two-step transfer: a handover done in two calls. The first call says "the new holder will be this address". The second call, made by the new holder, says "yes, that is me, I accept". The point is to catch a wrong address before it becomes permanent.
  • MYT strategy: a piece of the protocol that puts funds to work. The curator decides which strategies exist and how much can go into each.
  • Deposit cap: a ceiling on how much can be deposited into a strategy. An absolute cap is a fixed number; a relative cap is expressed as a proportion.

The report was filed as a low severity smart contract finding under the impact category "Permanent freezing of funds", with the target being the curator contract in the v3-poc repository.

Setup

The report does not describe any accounts, deployed addresses, tool versions or environment beyond the test harness. The proof of concept is a Foundry test intended to be added to src/test/AlchemistCurator.t.sol, and it relies on a setUp that defines an admin variable and a mytCuratorProxy instance of the curator. The test uses vm.startPrank, vm.stopPrank, vm.expectRevert and assertEq, so a working Foundry setup with the project's existing test scaffolding is the only precondition stated.

What those pieces are, in plain words:

  • Foundry: a toolkit for writing and running tests against smart contracts on your own computer, without touching a real blockchain. Tests are written in Solidity, the same language as the contracts.
  • Test harness: the surrounding files and helper functions a test relies on. Here, a setUp function that runs before each test and prepares the contract and the admin address.
  • vm.startPrank / vm.stopPrank: Foundry helpers that make the next calls look as if they came from a chosen address. It is like putting on a name badge: the contract sees that address as the caller. stopPrank takes the badge off.
  • vm.expectRevert: tells the test that the next call is expected to fail, and optionally with which error message. If the call succeeds instead, the test fails.
  • assertEq: checks that two values are equal. If they are not, the test fails and prints both values.

Finding it

The researcher compared the curator's admin transfer against the standard two-step ownership pattern. In that pattern the first step nominates a new owner and the second step must be callable only by the nominee, which proves the nominee controls the address. The whole point is to catch a mistyped or otherwise wrong address before it becomes the owner.

An everyday comparison: handing over the keys to a house. You tell the locksmith "the new owner is Jane at this address", and Jane has to come and sign for the keys in person. If instead you can sign on Jane's behalf, the signing proves nothing, and a wrong address on the form goes through unchallenged.

In AlchemistCurator.sol both halves of the pattern carry the same modifier:

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

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

Line by line:

  1. function transferAdminOwnerShip(address _newAdmin) external onlyAdmin { declares the first step. It takes one input, _newAdmin, the address being nominated. external means it can be called from outside the contract. onlyAdmin is a guard that must pass before the body runs.
  2. pendingAdmin = _newAdmin; stores the nominee in a variable called pendingAdmin. Nothing has changed yet; this is only the nomination.
  3. } closes the first function.
  4. function acceptAdminOwnership() external onlyAdmin { declares the second step. It takes no input. It also carries onlyAdmin, and that is the defect.
  5. admin = pendingAdmin; copies the nominee into the real admin variable. From this moment the nominee holds the role.
  6. pendingAdmin = address(0); clears the nominee slot. address(0) is the zero address, a placeholder that no one controls.
  7. emit AdminChanged(admin); writes a log entry recording the new admin, so outside observers can see the change.
  8. } closes the second function.

The modifier comes from PermissionedProxy.sol and checks the current admin, not the pending one:

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

Line by line:

  1. modifier onlyAdmin() { declares a reusable guard that functions can attach to themselves.
  2. require(msg.sender == admin, "PD"); is the check. msg.sender is the address that called the function. The condition demands that it equals the stored admin. If not, the call is aborted with the message PD, short for permission denied.
  3. _; is a placeholder meaning "now run the body of the function this guard is attached to".
  4. } closes the modifier.

That makes acceptAdminOwnership callable by the outgoing admin, so the acceptance step never proves anything about the nominee. The researcher also pointed at AlchemistV3.sol in the same project as the correct version of the same pattern, where the caller is checked against pendingAdmin:

Solidity
    function acceptAdmin() external {
        _checkState(pendingAdmin != address(0));

        if (msg.sender != pendingAdmin) {
            revert Unauthorized();
        }

        admin = pendingAdmin;
        pendingAdmin = address(0);

        emit AdminUpdated(admin);
        emit PendingAdminUpdated(address(0));
    }

Line by line:

  1. function acceptAdmin() external { declares the acceptance step. Notice there is no onlyAdmin here; the check is done inside the body instead.
  2. _checkState(pendingAdmin != address(0)); refuses to continue if no one has been nominated. This stops an acceptance from moving the role to the zero address.
  3. if (msg.sender != pendingAdmin) { compares the caller with the nominee.
  4. revert Unauthorized(); aborts the call with an Unauthorized error if they differ. This is the line that makes the two-step pattern meaningful: only the nominee can finish the handover.
  5. } closes the condition.
  6. admin = pendingAdmin; moves the role to the nominee.
  7. emit AdminUpdated(admin); logs the new admin.
  8. emit PendingAdminUpdated(address(0)); logs that the nominee slot is now empty.
  9. } closes the function.

The contrast within one codebase is what makes the curator version look like an unintentional error rather than a deliberate design.

Exploitation

The report frames this as an accidental path rather than an attacker-driven one. The sequence is:

  1. The legitimate admin calls transferAdminOwnerShip(address _newAdmin) with a typo, so pendingAdmin becomes an address the admin does not control, such as a dead address.
  2. Without noticing, the admin calls acceptAdminOwnership() to finish the transfer.
  3. The call succeeds, because msg.sender is still the current admin and onlyAdmin is satisfied.
  4. admin is now the wrong address and pendingAdmin is reset to zero, so the role is permanently transferred away.

A dead address is an address nobody has the key for, so no one can ever call functions from it. Once the role sits there, every admin-only function refuses every caller forever.

Step 1: Reproducing the flaw in a Foundry test

The proof of concept is a single test function:

Solidity
    /// @notice This test reproduces the flaw in the admin transfer pattern.
    /// @dev The current admin (originalAdmin) can nominate a new admin
    /// and then *immediately accept* the transfer themselves,
    /// because `acceptAdminOwnership` is incorrectly protected by `onlyAdmin`.
    /// A correct implementation would require `msg.sender == pendingAdmin`.
    function testReproduce_FlawedAdminTransfer() public {
        address newAdmin = address([redacted]);
        address originalAdmin = admin; // As defined in setUp

        // 1. Current admin nominates a new admin
        vm.startPrank(originalAdmin);
        mytCuratorProxy.transferAdminOwnerShip(newAdmin);
        assertEq(mytCuratorProxy.pendingAdmin(), newAdmin, "pendingAdmin should be set to newAdmin");

        // 2. VULNERABILITY: The *current* admin calls `acceptAdminOwnership`.
        // This call succeeds because of the `onlyAdmin` modifier,
        // which checks if `msg.sender == admin` (which is true).
        mytCuratorProxy.acceptAdminOwnership();
        vm.stopPrank();

        // 3. Verify the transfer completed successfully
        // The pendingAdmin should be cleared
        assertEq(mytCuratorProxy.pendingAdmin(), address(0), "pendingAdmin should be cleared after acceptance");

        // 4. Verify that newAdmin is now the actual admin
        // We test this by having newAdmin successfully call an admin-only function.
        vm.startPrank(newAdmin);
        mytCuratorProxy.transferAdminOwnerShip(originalAdmin); // This should succeed
        vm.stopPrank();

        // 5. Verify that the originalAdmin is no longer the admin
        // This call should now fail with the "PD" (Permission Denied) error.
        vm.startPrank(originalAdmin);
        vm.expectRevert(bytes("PD"));
        mytCuratorProxy.transferAdminOwnerShip(newAdmin);
        vm.stopPrank();
    }

Line by line:

  1. The three /// lines are documentation comments. They state what the test proves: the current admin can nominate a new admin and then immediately accept the transfer themselves, because acceptAdminOwnership is guarded by onlyAdmin.
  2. function testReproduce_FlawedAdminTransfer() public { declares the test. Foundry runs any function whose name starts with test.
  3. address newAdmin = address([redacted]); picks an arbitrary address to act as the nominee. It stands in for the mistyped address in the real scenario.
  4. address originalAdmin = admin; // As defined in setUp copies the admin address prepared by the test harness into a local variable, so the test can switch back to it later.
  5. vm.startPrank(originalAdmin); makes the following calls appear to come from the original admin.
  6. mytCuratorProxy.transferAdminOwnerShip(newAdmin); performs step one: nominate newAdmin.
  7. assertEq(mytCuratorProxy.pendingAdmin(), newAdmin, "pendingAdmin should be set to newAdmin"); reads the nominee slot back and checks it holds newAdmin. This confirms the nomination was recorded.
  8. mytCuratorProxy.acceptAdminOwnership(); performs step two, still as the original admin. This is the vulnerable call: it should have been reserved for the nominee.
  9. vm.stopPrank(); takes off the name badge.
  10. assertEq(mytCuratorProxy.pendingAdmin(), address(0), "pendingAdmin should be cleared after acceptance"); checks the nominee slot is now empty, which shows the acceptance ran.
  11. vm.startPrank(newAdmin); now acts as the nominee.
  12. mytCuratorProxy.transferAdminOwnerShip(originalAdmin); // This should succeed calls an admin-only function as the nominee. It succeeds, which proves the role really moved to newAdmin.
  13. vm.stopPrank(); takes off the badge.
  14. vm.startPrank(originalAdmin); acts as the original admin again.
  15. vm.expectRevert(bytes("PD")); declares that the next call must fail with the PD message.
  16. mytCuratorProxy.transferAdminOwnerShip(newAdmin); tries an admin-only call as the original admin. It fails, because the original admin no longer holds the role.
  17. vm.stopPrank(); takes off the badge.
  18. } closes the test.

The test pranks as the original admin, nominates newAdmin, and asserts that pendingAdmin is set. It then calls acceptAdminOwnership from the same original admin, which is the step that should have been reserved for the nominee, and asserts that pendingAdmin has been cleared. To show the role really moved, it pranks as newAdmin and calls the admin-only transferAdminOwnerShip, which succeeds. Finally it pranks as originalAdmin again and expects the call to revert with PD, confirming the original admin has lost the role. The report states the test passes, proving the vulnerability exists.

Root cause

The acceptance function is guarded by the wrong check. onlyAdmin requires msg.sender == admin, so the outgoing admin can complete the handover to any address, including one nobody controls. The two-step pattern's security property, that the new owner must demonstrate control of the address, is never enforced. The report notes that AlchemistV3.sol in the same project does check msg.sender != pendingAdmin and reverts with Unauthorized, which suggests the curator version is likely an unintentional error.

Impact

The admin of the curator contract controls all critical management functions: adding new MYT strategies, removing old MYT strategies, and managing absolute and relative deposit caps for all strategies. If the role is transferred to an address nobody controls, the contract is effectively bricked. No one can manage strategy caps or update the strategy list again, which freezes a core component of the protocol and prevents reacting to market conditions, managing risk or adding new yield sources. The report describes this as an irreversible denial of service for the contract's management.

A denial of service here means the contract still exists and still holds whatever it holds, but its management functions can no longer be used by anyone. The report does not describe an attacker who can trigger this from outside; the scenario given is an accidental typo by the legitimate admin followed by an immediate acceptance. The impact category selected is permanent freezing of funds.

Fix

The change it implies is to make acceptAdminOwnership check the caller against pendingAdmin rather than admin, as AlchemistV3.sol already does, so that only the nominee can complete the transfer.

Variants to test

  • Look for any two-step transfer (admin, owner, operator, guardian) where the accept function carries the same modifier as the propose function. A positive result is that the proposing account can call accept and the role moves to an address that never transacted.
  • Check whether the accept function verifies pendingAdmin != address(0). If it does not, an acceptance with no pending nominee can set the role to the zero address. A positive result is admin becoming address(0) after a bare accept call.
  • Compare sibling contracts in the same repository that implement the same pattern. A positive result is one contract checking msg.sender == pendingAdmin and another checking msg.sender == admin.
  • Check whether the propose function can be called again after a nomination to overwrite pendingAdmin, and whether the accept function can be front-run by a re-nomination. A positive result is a race where the role lands on an address the proposer did not intend.

Hunting notes

This class of bug hides in administrative plumbing rather than in the value-moving logic: ownership and role transfer functions, upgrade admin slots, and pause or guardian roles. During recon, the signal is a contract that advertises a two-step transfer but whose accept function shares a modifier with the propose function, or whose accept function has no caller check at all. Reading the modifier definitions in the inherited base contract, as this report does with PermissionedProxy.sol, is usually enough to spot it. Comparing against a sibling contract in the same repository that implements the pattern correctly is a cheap way to show intent and raise confidence. The report showed impact by walking through the specific management functions the role controls and by writing a Foundry test that demonstrates the current admin completing the handover to a nominated address.

Glossary

  • Smart contract: a program stored on a blockchain with its own address and storage, whose functions anyone can call by sending a transaction.
  • DeFi: short for decentralised finance, software on a blockchain that handles money-like assets without a traditional bank in the middle.
  • Alchemix V3: the DeFi protocol this report targets.
  • AlchemistCurator.sol: the contract that manages MYT strategies, their deposit caps and the admin role.
  • PermissionedProxy.sol: the base contract that defines the onlyAdmin modifier used by the curator.
  • AlchemistV3.sol: a sibling contract in the same project that implements the two-step transfer correctly.
  • Admin: the role that may call the contract's management functions.
  • Role: a named permission recorded in the contract and checked before certain functions run.
  • Modifier: a reusable guard attached to a function that runs before the function body.
  • onlyAdmin: the modifier that requires the caller to be the current admin, otherwise aborting with PD.
  • msg.sender: the address that called the current function.
  • require: a Solidity check that aborts the call with an error message if its condition is false.
  • revert: a Solidity statement that aborts the call and undoes any changes made so far.
  • Two-step transfer: a handover where one call nominates a successor and a second call, made by the successor, accepts.
  • transferAdminOwnerShip: the nomination function in the curator.
  • acceptAdminOwnership: the acceptance function in the curator, guarded by the wrong check.
  • pendingAdmin: the storage slot holding the nominated successor.
  • admin: the storage slot holding the current admin.
  • address(0): the zero address, a placeholder that no one controls.
  • Dead address: an address nobody holds the key for, so no one can ever call from it.
  • MYT strategy: a component of the protocol that puts funds to work.
  • Deposit cap: a ceiling on how much can be deposited into a strategy; absolute is a fixed number, relative is a proportion.
  • Bricked: a contract whose management functions can no longer be used by anyone.
  • Denial of service: making a system unusable for its intended users.
  • Permanent freezing of funds: the impact category selected in this report, meaning assets or control are locked for good.
  • Foundry: a toolkit for writing and running smart contract tests locally.
  • Test harness: the surrounding files and setup functions a test relies on.
  • setUp: a function that runs before each test to prepare contracts and addresses.
  • vm.startPrank / vm.stopPrank: Foundry helpers that make calls appear to come from a chosen address, and stop doing so.
  • vm.expectRevert: a Foundry helper declaring that the next call must fail, optionally with a given message.
  • assertEq: a test check that two values are equal.
  • Proof of concept: a small test or script that demonstrates a bug actually happens.
  • Front-run: getting a transaction in before someone else's, so it takes effect first.
  • Recon: the reading and mapping of a codebase done before hunting for bugs.

More by fullstop

View all

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