Skip to content
Business logic Audit finding Intermediate

Improper validation of absoluteCap and relativeCap enables excessive fund allocation in AlchemistAllocator.

The vault's cap enforcement logic uses an inverted comparison when selecting between absoluteCap and relativeCap, so it can pick the larger cap instead of the smaller one. An attacker or operator could then allocate more funds to an adapter than the intended risk limit allows, potentially leading to protocol insolvency if that adapter fails.

Oxvictorsr Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

57964 sc low improper validation of absolutecap and relativecap enables excessive fund allocation in alchemistallocator

Submitted on Oct 29th 2025 at 16:51:29 UTC by @Oxvictorsr for Audit Comp | Alchemix V3

Description

Introduction

The vault’s cap enforcement logic incorrectly validates the adjusted allocation value against absoluteCap and relativeCap. Instead of using the correct boundary comparison, the current logic can select the wrong cap limit, causing the system to allocate more assets than intended to certain adapters. This flaw effectively bypasses the protocol’s risk control mechanism, enabling overexposure to risky or malicious adapters and leading to potential protocol insolvency if the affected strategy underperforms or fails.

Vulnerability Details

In the vault’s allocation flow, the protocol calculates the final adjusted value that determines how much can be allocated to a given adapter or strategy. The relevant logic (simplified) is as follows:

Solidity
adjusted = adjusted > absoluteCap 
    ? relativeCap 
    : absoluteCap;

However, this condition is semantically inverted. It should ensure that the adjusted allocation respects both the absolute cap (the hard upper limit of assets that can be deployed into a given adapter) and the relative cap (a soft, proportional limit based on total vault assets).

The correct logic should ensure the allocation never exceeds whichever cap is smaller, for example:

Solidity
adjusted = adjusted > relativeCap 
    ? relativeCap 
    : adjusted;

By using the wrong comparison direction, the system may incorrectly assign a higher value to adjusted, effectively disabling the cap enforcement mechanism.

As a result, the vault’s internal tracking may show an adapter receiving allocations that exceed its intended cap, breaking the expected invariants that limit exposure per risk class.

Impact Details

This logic flaw allows over-allocation of vault funds to certain adapters, violating the protocol’s intended risk distribution model. The possible consequences include:

  • Protocol insolvency: If the over-allocated adapter experiences losses, the vault may become undercollateralized relative to user deposits.
  • Loss of user funds: Excess allocation to a single adapter or strategy exposes the vault to higher single-point-of-failure risk.
  • Broken invariants: Cap enforcement becomes unreliable, affecting automated rebalancing, accounting, and safety checks across the system.
  • Governance risk: Operators or automated allocators could unknowingly allocate beyond safe thresholds.

Because this affects the core vault solvency mechanism, the severity is High, with the corresponding impact type being Protocol Insolvency under the program’s scope.

Proof of Concept

Proof of Concept

Solidity
function testAdjustedCalculation_UsesWrongCapComparison() public {
    // Simulate a scenario where:
    // absoluteCap = 200 ether, relativeCap = 100 ether
    uint256 absoluteCap = 200 ether;
    uint256 relativeCap = 100 ether;
    

    // === Vulnerable logic as currently implemented ===
    // Note: It picks the *larger* of the two values instead of the smaller one.
    uint256 adjusted = absoluteCap > relativeCap ? absoluteCap : relativeCap;

    // === Expected correct logic ===
    // adjusted should be the *smaller* of the two caps, to ensure allocations don't exceed safe limits.
    uint256 correctAdjusted = absoluteCap > relativeCap ? relativeCap : absoluteCap;

    // === Log output for visibility ===
    emit log_named_uint("absoluteCap", absoluteCap);
    emit log_named_uint("relativeCap", relativeCap);
    emit log_named_uint("Vulnerable adjusted", adjusted);
    emit log_named_uint("Expected correct adjusted", correctAdjusted);

    // === Assertion: show that vulnerable logic overestimates ===
    assertGt(adjusted, correctAdjusted, "Adjusted should not exceed the smaller cap");

}

The original report as published on Immunefi, by Oxvictorsr. 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 ternary comparison for choosing between absoluteCap and relativeCap is inverted, so it selects the larger cap rather than the smaller one.

Impact

Over-allocation to an adapter could break risk limits and, if the adapter suffers losses, may lead to protocol insolvency and loss of user funds.

What the attacker needed

Allocation logic uses the flawed comparison

The fix

The comparison should be corrected so that the adjusted allocation never exceeds whichever cap is smaller.

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 vault has two limits on how much money can go into any one strategy: a hard maximum (absoluteCap) and a proportional limit (relativeCap). The code was supposed to use whichever limit is smaller, but it used a comparison that could pick the larger one. That means more money than intended could be sent to a risky strategy, and if that strategy loses money, the vault might not have enough to pay everyone back.

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.