Skip to content
Smart contracts Audit finding Advanced

Agent collateral pool is vulnerable to inflation attack

The agent collateral pool mints pool collateral tokens based on the ratio of pool token supply to the pool's native token balance, and that balance can be inflated by routing collateral reservation fees into the pool. An attacker can repeatedly reserve collateral without minting so the ratio collapses, causing later depositors to receive zero tokens while the attacker owns the whole pool.

a090325 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#46442 [SC-Low] Agent collateral pool is vulnerable to inflation attack

Submitted on May 30th 2025 at 15:10:59 UTC by @a090325 for Audit Comp | Flare | FAssets

Description

Brief/Intro

Collateral providers can deposit native tokens like FLR, SGB (for the sake of simplicity, I will only mention FLR from now on) in return for pool collateral token (PCT):

Amount of received PCT = (amount of deposited FLR) x 
                   (amount of PCT in pool) / (amount of FLR in pool)

Normally, 1 FLR in --> ~1 PCT out.

Before a victim (collateral provider) deposit in the pool, attacker can repeatedly create fake minting requests to accumulate a large amount of collateral reservation fee (paid in FLR by minters, usually ~ 0.5%) to inflate the amount of FLR in the pool. When the ratio (amount of PCT in pool) / (amount of FLR in pool) is small enough, for example 1/1000, collateral providers receive 0 PCT if they deposit less than 1000 FLR in one transaction.

See more about inflation attack here: https://blog.openzeppelin.com/a-novel-defense-against-erc4626-inflation-attacks

Vulnerability Details

It's impossible for attacker to directly transfer FLR to agent collateral pool but the pool's FLR balance still can increase significantly through Collateral Reservation process for minting.

Portion of Collateral Reservation Fee is sent to collateral pool in below function, increasing the amount of FLR (poolNatBalance) in the pool: https://github.com/flare-foundation/fassets/blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/contracts/assetManager/library/CollateralReservations.sol#L213

 function distributeCollateralReservationFee(
        Agent.State storage _agent,
        uint256 _fee
    )
        internal
    {
        ...
        _agent.collateralPool.depositNat{value: poolFeeShare}();
        ...
    }

Then _assetData.poolNatBalance is used to calculate the amount of PCT (poolToken) a collateral will receive for his deposit: https://github.com/flare-foundation/fassets/blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/contracts/assetManager/implementation/CollateralPool.sol#L485

 function _collateralToTokenShare(
        AssetData memory _assetData,
        uint256 _collateral
    )
        internal view
        returns (uint256)
    {
        bool poolConsideredEmpty = _assetData.poolNatBalance == 0 || _assetData.poolTokenSupply == 0;
        ........... // some helpers
        **uint256 tokenShareAtTopupPrice = poolConsideredEmpty ?
            collateralAtTopupPrice : _assetData.poolTokenSupply.mulDiv(
                collateralAtTopupPrice, _assetData.poolNatBalance);**
       ** uint256 tokenShareAtStandardPrice = poolConsideredEmpty && tokenShareAtTopupPrice == 0 ?
            collateralAtStandardPrice : (_assetData.poolTokenSupply + tokenShareAtTopupPrice).mulDiv(
                collateralAtStandardPrice, _assetData.poolNatBalance + collateralForTopupPricing);**
        return tokenShareAtTopupPrice + tokenShareAtStandardPrice;
    }

If _assetData.poolNatBalance (FLR amount in pool) is much larger than _assetData.poolTokenSupply (PCT amount) and collateral amount is not large enough, (tokenShareAtTopupPrice + tokenShareAtStandardPrice) could be rounded to 0.

Impact Details

Attacker can steal funds from collateral providers.

References

https://blog.openzeppelin.com/a-novel-defense-against-erc4626-inflation-attacks

Proof of Concept

Proof of Concept

It's a highly simplified PoC. Attacker (Alice) can inflate FLR/PCT ratio into higher value. She also can set attractive fee sharing and provide additional incentives to attract more pool collateral providers to maximize her profit.

  1. Attacker (Alice) registers a new agent. Minting pool collateral ratio is set to be low ~1.2, pool fee share fee is set to 99.99% to maximize the FLR inflation in pool. Alice also needs to fund other accounts like agent collateral vault (with enough collateral token for step 3)
  2. Alice deposits 1200 FLR --> gets 1200 PCT (pool collateral token)
  3. Alice (uses a different account for minting only) reserves collateral for minting (~1000 PCT, 1000 FLR and the equivalent collateral token amount in agent collateral vault). 5 FLR is on-hold as collateral reservation fee (CRF)
  4. Alice doesn't really mint anything. And because pool fee share is set to 99.99%, all CRF (5FLR) is tranfered to collateral pool. Now the pool has 1205 FLR for 1200 PCT. Collateral is released in the end and Alice can repeats her attack
  5. Alice repeats step 3&4 for 250000 cycles. Now in the pool, the amount of FLR is approximately 1000 times the amount of PCT. The gas cost for this attack settings is around 500 USD (0.1 FLR/cycle x 250000 cycles x 0.02 USD/FLR)
  6. If Bob deposits 900 FLR into Alice collateral pool, he will receive 0 PCT because: Bob's PCT = 900 x (amount of PCT in pool) / (amount of FLR in pool) = 9/10 ~ 0 (being rounded down)
  7. Alice has successfully stolen 900 FLR from Bob since she owns all the PCT in the pool.

The original report as published on Immunefi, by a090325. 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 share calculation rounds down and does not defend against a first or dominant depositor inflating the pool's native balance via reservation fees, so small deposits mint zero shares.

Impact

An attacker could steal funds from collateral providers who deposit after the ratio has been inflated, though the attack requires substantial gas spending and many repeated cycles.

What the attacker needed

Attacker registers an agent; attacker controls a minting account; attacker funds the agent collateral vault; many repeated reservation cycles

How it was found

  1. Register an agent with a low collateral ratio and a very high pool fee share, and fund the agent collateral vault.
  2. Deposit native tokens to receive pool collateral tokens.
  3. Repeatedly reserve collateral for minting without completing the mint, so the reservation fee flows into the pool.
  4. Repeat the reservation cycle many times until the native balance greatly exceeds the token supply.
  5. A victim deposits a modest amount and receives zero pool tokens, leaving the attacker owning the pool.

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 pool lets people deposit a coin and get a share token in return; the number of share tokens you get depends on how much coin the pool already holds compared with how many share tokens exist. If someone can make the pool hold a lot of coin while very few share tokens exist, a new deposit can be rounded down to zero shares, so the depositor's money effectively goes to whoever holds the existing shares. Here the attacker could push extra fees into the pool to skew that ratio.

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 a090325

View all

7 more disclosed reports, best first.

More from Flare | FAssets

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.