Skip to content
Smart contracts Audit finding Intermediate

The Alchemist::burn function experiences precision loss, resulting in the avoidance of protocol fees

The burn function in the Alchemist contract calculates the protocol fee by multiplying the converted debt amount by the fee rate and dividing by the basis points, which rounds down to zero for small burn amounts. An attacker can repeatedly burn tiny amounts of debt to reduce their debt without ever paying the protocol fee, effectively stealing the fees owed.

pashap9990 Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

58323 sc critical the alchemist burn function experiences precision loss resulting in the avoidance of protocol fees

Submitted on Nov 1st 2025 at 09:18:15 UTC by @pashap9990 for Audit Comp | Alchemix V3

Description

Finding Description and Impact

CDP holders can reduce their debt through Alchemist::burn. Furthermore, they are required to remit a fee to the protocol, which is deducted from their collateral. However, CDP holders can evade paying fees to the protocol, resulting in the theft of fees due to precision losses.

Code snippet

https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/AlchemistV3.sol#L483

Textual PoC

Suppose mtoken --> debt token rate is 1:1 and the protocol fee is 100 [1%].

  • User A deposits 100e18 mToken as collateral and gets 50e18 alToken as debt.
  • User A calls Alchemist::burn with 10 as the debt amount in the next block.
_accounts[recipientId].collateralBalance -= convertDebtTokensToYield(credit) * protocolFee / BPS;
10 * 100 / 10_000 = 0.1 --> which rounds down to zero

It's evident that the user's debt decreased, whereas the user didn't pay any fee.

Proof of Concept

Proof of Concept

Kindly incorporate the following PoC in Alchemist.t.sol

Solidity
    function testBurnFunctionSufferFromPrecisionLoss() external {
        uint256 amount = 100e18;

        vm.startPrank(address(0xbeef));
        SafeERC20.safeApprove(address(vault), address(alchemist), amount + 100e18);
        alchemist.deposit(amount, address(0xbeef), 0);
        // a single position nft would have been minted to 0xbeef
        uint256 tokenId = AlchemistNFTHelper.getFirstTokenId(address(0xbeef), address(alchemistNFT));
        alchemist.mint(tokenId, amount / 2, address(0xbeef));

        vm.roll(block.number + 1);

        SafeERC20.safeApprove(address(alToken), address(alchemist), amount);
        (uint256 beforeCollateral, uint256 beforeUserDebt,) = alchemist.getCDP(tokenId);
        uint i = 0;
        while(i < 1000){
            alchemist.burn(10, tokenId);
            i++;
        }
        vm.stopPrank();

        (uint256 afterCollateral, uint256 afterUserDebt,) = alchemist.getCDP(tokenId);

        assertEq(beforeCollateral, afterCollateral);
        assertLe(afterUserDebt, beforeUserDebt);
    }

The original report as published on Immunefi, by pashap9990. 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 fee calculation performs integer division that truncates to zero for small burn amounts, without enforcing a minimum fee or rounding up.

Impact

The protocol loses fee revenue because CDP holders can reduce their debt without paying the required fee, as demonstrated by the PoC showing unchanged collateral and reduced debt after many small burns.

What the attacker needed

A CDP position with collateral and debt; ability to call burn repeatedly

How it was found

  1. Deposit collateral and mint a debt position.
  2. Advance the block number.
  3. Repeatedly call burn with a very small debt amount.
  4. Observe that collateral balance is unchanged and debt is reduced.

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.

When you repay a loan on this platform, a small fee is taken from your collateral. The code calculates that fee by multiplying the repayment amount by a percentage, but if the repayment is very small, the result is less than one unit and gets rounded down to zero. By making many tiny repayments, a user can avoid paying any fee at all while still reducing their debt.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by pashap9990

View all

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

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.