56451 sc low alchemistallocator allocate and deallocate do not enforce cap checks as intended
Description
Brief/Intro
Vulnerability Details
// AlchemistAllocator::allocate()
function allocate(address adapter, uint256 amount) external {
// SNIP...
uint256 daoTarget = type(uint256).max;
@> uint256 adjusted = absoluteCap > relativeCap ? absoluteCap : relativeCap;
if (msg.sender != admin) {
// caller is operator
@> adjusted = adjusted > daoTarget ? adjusted : daoTarget;
}
// pass the old allocation to the adapter
bytes memory oldAllocation = abi.encode(vault.allocation(id));
vault.allocate(adapter, oldAllocation, amount);
}
// AlchemistAllocator::deallocate()
function deallocate(address adapter, uint256 amount) external {
// SNIP...
uint256 daoTarget = type(uint256).max;
@> uint256 adjusted = absoluteCap < relativeCap ? absoluteCap : relativeCap;
if (msg.sender != admin) {
// caller is operator
@> adjusted = adjusted < daoTarget ? adjusted : daoTarget;
}
// pass the old allocation to the adapter
bytes memory oldAllocation = abi.encode(vault.allocation(id));
vault.deallocate(adapter, oldAllocation, amount);
}Impact Details
References
Proof of Concept
Proof of Concept
Previous57697 sc low missing recipient from checks in zeroxswapverifier enable direct asset theftNext56956 sc high lack of slippage control in tokemak strategies can make myt suffer losses on allocation
Was this helpful?