Skip to content
Business logic Audit finding Intermediate

Cap logic error in alchemistallocator

The allocator's cap calculation compares an absolute cap expressed in asset units with a relative cap expressed in basis-point units without converting between them. This makes the comparison meaningless and, if the cap were enforced, could severely restrict withdrawals.

rbd3 Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

57832 sc insight cap logic error in alchemistallocator

Submitted on Oct 29th 2025 at 05:52:35 UTC by @rbd3 for Audit Comp | Alchemix V3

Description

Brief/Intro

Unit mismatch error in the allocation and deallocation caps calculation compares asset units with BPS units directly without conversion, causing mathematically meaningless comparisons and severe artificial restrictions on fund withdrawals.

Vulnerability Details

Solidity
// Current buggy code in AlchemistAllocator.sol:
uint256 absoluteCap = vault.absoluteCap(id);  // Returns: Asset units (wei)
uint256 relativeCap = vault.relativeCap(id);  // Returns: BPS units (WAD)
uint256 adjusted = absoluteCap < relativeCap ? absoluteCap : relativeCap;  // INCORRECT

The deallocate function in AlchemistAllocator incorrectly compares values in different units without conversion.

absoluteCap(id) → Asset units (e.g., 2000000000000000000 = 2 ETH in wei)

relativeCap(id) → BPS units (e.g., 500000000000000000 = 0.5e18 = 50%)

Impact Details

Comparing these directly is mathematically meaningless () and creates severe artificial restrictions, like asking "Is 2 kilometers less than 50 percent?"

References

https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/AlchemistAllocator.sol#L29-L44

https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/AlchemistAllocator.sol#L51-L66

Proof of Concept

Proof of Concept

In the actual code, cap isn't enforced. But if it is, this create a critical or high issue in MYT allocation and deallocation.

The original report as published on Immunefi, by rbd3. 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 code takes the smaller of two cap values that are denominated in different units (asset wei versus basis points) without normalising them first.

Impact

The report states the cap is not currently enforced, but if it were, the unit mismatch could create a critical or high issue by severely restricting allocation and deallocation.

What the attacker needed

Cap logic must actually be enforced

The fix

The comparison should convert both caps to a common unit before taking the smaller value.

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 cap is a limit on how much can be moved. One limit is written in token amounts and the other as a percentage, but the code compares the two numbers as if they were the same kind of number. That is like asking whether 2 kilometres is less than 50 percent, so the result is arbitrary.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from Alchemix V3

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.