Skip to content
Business logic Audit finding Intermediate

Lack of incentive to liquidate small positions can cause the system to accumulate bad debt

The protocol allows users to open arbitrarily small isolated positions with no minimum debt size, and liquidating such tiny positions pays a fee smaller than the gas cost. An attacker could open many small positions that become liquidatable, leaving them unliquidated and letting bad debt build up in the system.

Oxdeadmanwalking Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

57969 sc insight lack of incentive to liquidate small positions can cause the system to accumulate bad debt

Submitted on Oct 29th 2025 at 17:32:00 UTC by @Oxdeadmanwalking for Audit Comp | Alchemix V3

Description

Brief/Intro

The Alchemist, allows positions to be liquidated below a minimum collateralization threshold. This liquidation is always partial, aiming to restore the position's collateralization to a targer level. Any user is allowed to open as many positions as they wish, without size constraints, with each position being identified by a unique NFT id. The lack of minimum size however, can make liquidations unprofitable for very small positions due to gas costs, especially on ETH mainnet. Since an account's positions are isolated, a malicious actor can open a large amount of small positions and in the event that they become liquidatable, the lack of incentive to liquidate can cause bad debt to the protocol.

Vulnerability Details

Upon borrowing in Alchemist, no minimum amount is enforced, only a non 0 amount and the id of the position is user supplied, with 0 indicating creation of a new isolated position of arbitrary size

    function mint(uint256 tokenId, uint256 amount, address recipient) external {
        _checkArgument(recipient != address(0));
        _checkForValidAccountId(tokenId);
@>  _checkArgument(amount > 0);
        _checkState(!loansPaused);
        _checkAccountOwnership(IAlchemistV3Position(alchemistPositionNFT).ownerOf(tokenId), msg.sender);

        // Query transmuter and earmark global debt
        _earmark();

        // Sync current user debt before more is taken
        _sync(tokenId);

        // Mint tokens to recipient
        _mint(tokenId, amount, recipient);
    }

The liquidation mechanism also does not check for a minimum size when liquidating, meaning all positions below the minimum collateralization, no matter how small can get liquidated, which is intended.

        // Recalculate ratio after any repayment to determine if further liquidation is needed
        collateralInUnderlying = totalValue(accountId);
        collateralizationRatio = collateralInUnderlying * FIXED_POINT_SCALAR / account.debt;
        if (collateralizationRatio <= collateralizationLowerBound) {
            // Do actual liquidation
            return _doLiquidation(accountId, collateralInUnderlying, repaidAmountInYield);
        } else {
            // Case: debt still exists but repayment brought the account back to normal levels
            // Since only a repayment happened, send repayment fee to caller
            feeInYield = _resolveRepaymentFee(accountId, repaidAmountInYield);
            TokenUtils.safeTransfer(myt, msg.sender, feeInYield);
            return (repaidAmountInYield, feeInYield, 0);
        }

A malicious actor however can start opening a large amount of small positions denominated in MYT and wait for the positions to be liquidatable. Due to the nature of the liquidation system, the fee paid to the liquidator will not be sufficient to cover the gas costs, making liquidations unprofitable. As MYT drops in price, those liquidatable positions will accumulate until bad debt accumulates in the system, potentially causing the protocol to be insolvent.

Lastly, the protocol has no mention of a protocol owned liquidation bot that will handle those small liquidations.

Impact Details

Lack of incentive to liquidate small positions can cause the protocol to incur bad debt and potentially go insolvent. A minimum debt amount is advised per-nft position to avoid this.

References

Proof of Concept

Proof of Concept

  1. Add this test to the end of Alchemist.t.sol
    function test_POC_small_positions_uneconomical_to_liquidate() external {
        // Setup healthy global position first (ensures good global collateralization)
        vm.startPrank(yetAnotherExternalUser);
        SafeERC20.safeApprove(address(vault), address(alchemist), 10000 ether);
        alchemist.deposit(10000 ether, yetAnotherExternalUser, 0);
        vm.stopPrank();

        // Setup: Create a small position 1e18 worth of MYT
        uint256 smallDeposit = 1 ether;

        vm.startPrank(externalUser);
        SafeERC20.safeApprove(address(vault), address(alchemist), smallDeposit);
        alchemist.deposit(smallDeposit, externalUser, 0);
        uint256 tokenId = AlchemistNFTHelper.getFirstTokenId(externalUser, address(alchemistNFT));

        // Borrow max (90% LTV = 0.9 ETH)
        uint256 maxBorrow = alchemist.totalValue(tokenId) * FIXED_POINT_SCALAR / minimumCollateralization;
        alchemist.mint(tokenId, maxBorrow, externalUser);
        vm.stopPrank();

        // Make position undercollateralized by dropping collateral value 6%
        // Less severe drop ensures position has surplus for fee payment
        uint256 initialSupply = IERC20(mockStrategyYieldToken).totalSupply();
        uint256 newSupply = initialSupply * 106 / 100;
        IMockYieldToken(mockStrategyYieldToken).updateMockTokenSupply(newSupply);

        // Measure gas cost of liquidation
        address liquidator = address(0x999);
        vm.startPrank(liquidator);
        vm.startSnapshotGas("liquidate_small_position");
        (uint256 assets, uint256 feeInYield,) = alchemist.liquidate(tokenId);
        uint256 gasUsed = vm.stopSnapshotGas("liquidate_small_position");
        vm.stopPrank();


        console.log("----------------Liquidation completed----------------");
        console.log("gasUsed: ", gasUsed);
        console.log("feeInYield: ", feeInYield);
        console.log("assets liquidated: ", assets);
    }
  1. Run the test:
forge test --match-test test_POC_small_positions_uneconomical_to_liquidate -vv
  1. The output should look like the following
Ran 1 test for src/test/AlchemistV3.t.sol:AlchemistV3Test
[PASS] test_POC_small_positions_uneconomical_to_liquidate() (gas: 1293868)
Logs:
  ----------------Liquidation completed----------------
  gasUsed:  319221
  feeInYield:  1379999999999999
  assets:  553799999999999994

We can see that for ~0,5 MYT seized, the fee was only ~0,13MYT . Assuming a price of MYT of 1.1USD due to yield accrued in the share, gas costs of 10 gwei andf ETH at 4000 USD, the total cost of liquidation given the gas measurement in the test is:

gasUsed * ETH per gas (gwei) * ETH Price = 319221 * 0.000000001 * 4000 = ~1,27 USD.

So in the end:

  • totalCost =~1,27 USD.
  • totalIncentive ~= 0,13 * 1,1 = 0,143 USD

Making small positions unprofitable to liquidate.

The original report as published on Immunefi, by Oxdeadmanwalking. 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 absence of a minimum position size, combined with a liquidation fee that does not scale enough to cover gas for very small positions.

Impact

Small liquidatable positions may be left unliquidated, so bad debt could accumulate and potentially make the protocol insolvent; the report notes no protocol-owned liquidation bot exists to handle them.

What the attacker needed

Ability to open positions; collateral price drops; gas costs exceed liquidation fee

The fix

A minimum debt amount should be enforced per NFT position to avoid uneconomical liquidations.

How it was found

  1. Create a small position by depositing a tiny amount of collateral.
  2. Borrow the maximum allowed against it.
  3. Drop the collateral value slightly so the position becomes liquidatable.
  4. Call liquidate and measure the gas used and the fee received.
  5. Compare the fee value with the gas cost to see the liquidation is unprofitable.

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.

In a lending system, if a borrower's collateral falls too low, someone else is paid a fee to step in and close the loan. Here the loans can be made so tiny that the fee is worth less than the cost of the transaction, so nobody bothers. If many such tiny loans go bad, the protocol is left holding the losses.

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 Oxdeadmanwalking

View all

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