Skip to content
Business logic Audit finding Intermediate

AlchemechNFT holder will get too little FLUX be

The FluxToken contract's getClaimableFlux function incorrectly multiplies the claim amount by 0.4% for Patron NFT holders and then again by 0.05% for Alchemic NFT holders, resulting in Alchemic NFT holders receiving 250 times less FLUX than intended. This permanently reduces the FLUX they can claim.

Holterhus Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

31479 - [SC - High] alchemechNFT holder will get too little FLUX be...

Submitted on May 20th 2024 at 05:06:46 UTC by @Holterhus for Boost | Alchemix

Report ID: #31479

Report type: Smart Contract

Report severity: High

Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/FluxToken.sol

Impacts:

  • Permanent freezing of unclaimed royalties

Description

Brief/Intro

When alchemicNFT holders claim FLUX, the amount to claim is calculated relative to the amount that Patron NFT holders claim, which dramatically underestimates the amount to claim.

Vulnerability Details

When NFT holders claim FLUX, the calculated amount should either by multiplied by 0.4% (for Patron NFT holders) or 0.05% (for alchemicNFT holders).

However, in the implementation of getClaimableFlux(), we first multiply by 0.4% to get the Patron NFT holder amount. Then, if it's an Alchemic NFT holder, we multiply that resulting value by 0.05% to get the final amount.

The result is that Alchemic NFT holders receive 0.4% * 0.05% = 0.0002% of the calculated amount, which is 250x less than they should.

Impact Details

Alchemic NFT holders will receive 250x less FLUX than they should when claiming. This loss of FLUX amount is permanent and can't be fixed.

References

FluxToken.sol

Proof of Concept

The following test can be added to FluxToken.t.sol. It should return 0.05% of 500_000, which would equal 250, but instead returns 1.

Solidity
function test_InflatedAlchemicNFTClaim() external {
    uint256 amount = 500_000;
    uint256 bptCalculation = flux.getClaimableFlux(amount, alchemechNFT);
    assertEq(bptCalculation, 1);
}

The original report as published on Immunefi, by Holterhus. 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 function applies the Patron NFT multiplier (0.4%) first and then, for Alchemic NFT holders, multiplies the result by the Alchemic multiplier (0.05%) instead of using only the correct multiplier.

Impact

Alchemic NFT holders permanently receive 250 times less FLUX than they should when claiming.

What the attacker needed

Hold an Alchemic NFT

The fix

The function should apply only the correct multiplier (0.05% for Alchemic NFT holders) instead of multiplying by both 0.4% and 0.05%.

How it was found

  1. Call getClaimableFlux with an amount and the Alchemic NFT identifier.
  2. Observe that the returned value is 1 instead of the expected 250 for an input of 500,000.

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 own a special NFT, you can claim some FLUX tokens. The code that calculates how much you get made a mistake: it applied two discounts one after the other, so people with one type of NFT got a tiny fraction of what they should. This means they lost tokens they were owed, and it cannot be undone.

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 Holterhus

View all

7 more disclosed reports, best first.

More from Alchemix

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.