Skip to content
Business logic Audit finding Intermediate

Unlike setters collateralization functions, AlchemistV3::initialize doesnt enforce collateralization invariants allowing to break them

The initialize function of AlchemistV3 sets collateralization parameters without checking the ordering invariant that the individual setter functions enforce. An attacker or misconfigured deployment could start the contract with inconsistent collateralization values, which the report says prevents liquidations.

hunter0xweb3 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

58291 sc medium unlike setters collateralization functions alchemistv3 initialize doesnt enforce collateralization invariants allowing to break them

Submitted on Nov 1st 2025 at 01:26:10 UTC by @hunter0xweb3 for Audit Comp | Alchemix V3

Description

Brief/Intro

AlchemistV3 defines multiple collateralization requirements: MinimumCollateralization, GlobalMinimumCollateralization, CollateralizationLowerBound and a relation between them:

globalMinimumCollateralization >= minimumCollateralization >= collateralizationLowerBound >= FIXED_POINT_SCALAR

This relationship is enforced in the setter functions for this variables, however AlchemistV3::initialize allows to break the invariant and start AlchemistV3 in an invariant breakage state

Vulnerability Details

AlchemistV3 defines variables for multiple collateralization requirements:

  • MinimumCollateralization,
  • GlobalMinimumCollateralization
  • CollateralizationLowerBound And also defines its setter functions
    function setMinimumCollateralization(uint256 value) external onlyAdmin {
@>      _checkArgument(value >= FIXED_POINT_SCALAR);
        minimumCollateralization = value;
        emit MinimumCollateralizationUpdated(value);
    }

    /// @inheritdoc IAlchemistV3AdminActions
    function setGlobalMinimumCollateralization(uint256 value) external onlyAdmin {
@>      _checkArgument(value >= minimumCollateralization);
        globalMinimumCollateralization = value;
        emit GlobalMinimumCollateralizationUpdated(value);
    }

    /// @inheritdoc IAlchemistV3AdminActions
    function setCollateralizationLowerBound(uint256 value) external onlyAdmin {
@>      _checkArgument(value <= minimumCollateralization);
@>      _checkArgument(value >= FIXED_POINT_SCALAR);
        collateralizationLowerBound = value;
        emit CollateralizationLowerBoundUpdated(value);
    }

From the setter function it can be seen that the invariant enforced by AlchemistV3 is the following

globalMinimumCollateralization >= minimumCollateralization >= collateralizationLowerBound >= FIXED_POINT_SCALAR

However this invariant is not enforced in AlchemistV3::initialize allowing to use it to break and start contract in an non compliant state:

Solidity
    function initialize(AlchemistInitializationParams memory params) external initializer {
        //...snippet...
@>      minimumCollateralization = params.minimumCollateralization;
@>      globalMinimumCollateralization = params.globalMinimumCollateralization;
@>      collateralizationLowerBound = params.collateralizationLowerBound;
        //...snippet... 

Impact Details

  • Collateralization requirements invariant breakage
  • AlchemistV3 is unable to perform liquidations
  • Contract failed to fullfil premises

References

https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/AlchemistV3.sol#L174-L176\\ https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/AlchemistV3.sol#L292-L312

Proof of Concept

Proof of Concept

The following PoC shows AlchemistV3::initialize() can be used to break the AlchemistV3 collateralization's invariant:

globalMinimumCollateralization >= minimumCollateralization >= collateralizationLowerBound >= FIXED_POINT_SCALAR

enforced by setMinimumCollateralization, setGlobalMinimumCollateralization, and setCollateralizationLowerBound AlchemistV3's functions

To do so, perform the following:

In deployCoreContracts function in src/test/AlchemistV3.t.sol modify AlchemistInitializationParams struct, only the minimumCollateralization, collateralizationLowerBound and globalMinimumCollateralization fields:

Solidity
    function deployCoreContracts(uint256 alchemistUnderlyingTokenDecimals) public {
        // ...
        AlchemistInitializationParams memory params = AlchemistInitializationParams({
            admin: alOwner,
            debtToken: address(alToken),
            underlyingToken: address(vault.asset()),
            depositCap: type(uint256).max,
            minimumCollateralization: 2_111_111_111_111_111_111, //2.1
            collateralizationLowerBound: 3_111_111_111_111_111_111, // 3.1 collateralization
            globalMinimumCollateralization: 1_111_111_111_111_111_111, // 1.1

Leave the rest of struct with the original values

Create in the same file (src/test/AlchemistV3.t.sol) the following test

Solidity
    function testInitializeInvariantBreakage() public {
        // Check invariant was break using initialize
        assert(
            alchemist.collateralizationLowerBound() > alchemist.minimumCollateralization() 
        );
        assert(
            alchemist.minimumCollateralization() > alchemist.globalMinimumCollateralization() 
        );
    }

Exec test

Bash
forge test --mt testInitializeInvariantBreakage

Observe the AlchemistV3 invariant is bypassed

The original report as published on Immunefi, by hunter0xweb3. 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 initialize function assigns the three collateralization parameters directly from the input struct without applying the same ordering checks used in the setter functions.

Impact

The contract could start with broken collateralization requirements and be unable to perform liquidations, though the report does not show a direct loss of funds.

What the attacker needed

Deployment with inconsistent parameters

The fix

The initialize function should enforce the same ordering checks as the setter functions before storing the collateralization parameters.

How it was found

  1. Modify the AlchemistInitializationParams struct in the test deployment helper so the three collateralization values are out of order.
  2. Add a test that reads the three stored values and asserts that the lower bound is greater than the minimum and the minimum is greater than the global minimum.
  3. Run the test with forge and observe that the invariant is broken.

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.

This contract has three collateralization settings that must stay in a certain order, like three numbers that must go from largest to smallest. The normal functions that change these settings check the order, but the one-time setup function does not. If the setup uses bad values, the contract starts in a broken state and may not be able to liquidate positions.

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 by hunter0xweb3

View all

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

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.