Skip to content
Business logic Audit finding Intermediate

Collateral Reservation Fee distribution uses current poolFeeShareBips instead of value stored during during time of collateral reservation

The fee distribution function for collateral reservations reads the agent's current pool fee share setting rather than the value recorded when the reservation was made. An agent who changes that setting between reservation and minting causes the reservation fee to be split differently from the agreed terms, over- or under-paying the collateral pool.

rilwan99 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#47106 [SC-Low] Collateral Reservation Fee distribution uses current poolFeeShareBips instead of value stored during during time of collateral reservation

Submitted on Jun 9th 2025 at 01:05:07 UTC by @rilwan99 for Audit Comp | Flare | FAssets

Description

Brief/Intro

During minting operations in the FAssets protocol, when distributeCollateralReservationFee() is called (either after a successful mint via executeMinting() or after a payment default via mintingPaymentDefault()), the function incorrectly uses the agent's current poolFeeShareBIPS instead of the value that was stored in the collateral reservation at the time of reservation. This leads to inconsistent fee distribution between the agent and collateral pool compared to what was agreed upon during the initial collateral reservation.

Vulnerability Details

The issue occurs in the distributeCollateralReservationFee() function in CollateralReservations.sol:

Solidity
function distributeCollateralReservationFee(
    Agent.State storage _agent,
    uint256 _fee // reservationFeeNatWei + executorFeeNatGWei
)
    internal
{
    if (_fee == 0) return;
    // @audit BUG this uses agent.poolFeeShareBIPS state var, which might have been updated
    uint256 poolFeeShare = _fee.mulBips(_agent.poolFeeShareBIPS);
    _agent.collateralPool.depositNat{value: poolFeeShare}();
    IIAgentVault(_agent.vaultAddress()).depositNat{value: _fee - poolFeeShare}(Globals.getWNat());
}

When a collateral reservation is created in reserveCollateral(), the poolFeeShareBIPS value is stored in the reservation: cr.poolFeeShareBIPS = agent.poolFeeShareBIPS + 1;

However, distributeCollateralReservationFee() ignores this stored value and uses the agent's current poolFeeShareBIPS setting instead. This is inconsistent with how pool fees are calculated in minting operations, where the stored value is correctly used:

Solidity
function calculatePoolFeeUBA(
    Agent.State storage _agent,
    CollateralReservation.Data storage _crt
)
    internal view
    returns (uint256)
{
    // After an upgrade, poolFeeShareBIPS is stored in the collateral reservation.
    // To allow for backward compatibility, value 0 in this field indicates use of old _agent.poolFeeShareBIPS.
    uint16 storedPoolFeeShareBIPS = _crt.poolFeeShareBIPS;
    uint16 poolFeeShareBIPS = storedPoolFeeShareBIPS > 0 ? storedPoolFeeShareBIPS - 1 : _agent.poolFeeShareBIPS;
    return _calculatePoolFeeUBA(_crt.underlyingFeeUBA, poolFeeShareBIPS);
}

Impact Details

Impact Details This vulnerability leads to incorrect fee distribution in the following scenarios:

  1. Agent reduces poolFeeShareBIPS after collateral reservation: The collateral pool receives less fees than expected, while the agent vault receives more.
  2. Agent increases poolFeeShareBIPS after collateral reservation: The collateral pool receives more fees than expected, while the agent vault receives less.

The impact affects:

  • Collateral Pool Token (CPT) holders: May receive incorrect fee distributions based on changed agent settings rather than the agreed terms at reservation time
  • Agent vault: May receive more or less fees than the originally agreed split
  • Protocol integrity: Breaks the immutability principle that reservation terms should remain fixed once established

The financial impact depends on the difference between the original and current poolFeeShareBIPS values and the total collateral reservation fees involved. While individual impacts may be small, this could affect multiple minting operations over time, potentially leading to systematic over/under-compensation of either party.

References

https://github.com/flare-labs-ltd/fassets/blob/main/contracts/assetManager/library/CollateralReservations.sol

Proof of Concept

Proof of Concept

Assume

  • Agent's poolFeeShareBIPS is set to 1,000 (10%)
  • Collateral reservation fee is 100 NAT
  • Expected fee distribution: Agent vault gets 90 NAT, Collateral pool gets 10 NAT
  1. User creates collateral reservation via reserveCollateral()
  • Agent's current poolFeeShareBIPS is 1,000 (10%)
  • Collateral reservation stores poolFeeShareBIPS = 1,000 + 1 = 1,001 for backward compatibility
  • User pays 100 NAT as collateral reservation fee
  • Expected fee split: 90 NAT to agent vault, 10 NAT to collateral pool
  1. Agent updates their pool fee share
  • Agent calls function to update poolFeeShareBIPS to 2,000 (20%)
  • This change should not affect existing collateral reservations
  1. User completes minting via executeMinting()
  • distributeCollateralReservationFee() is called
  • Function incorrectly uses current agent.poolFeeShareBIPS (2,000) instead of stored value (1,000)
  • Actual fee split: 80 NAT to agent vault, 20 NAT to collateral pool

Collateral pool receives 10 NAT more than expected, agent vault receives 10 NAT less

The original report as published on Immunefi, by rilwan99. 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

The distribution function reads the live agent.poolFeeShareBIPS state variable instead of the poolFeeShareBIPS value saved in the collateral reservation record.

Impact

The collateral pool and agent vault may each receive more or less of the reservation fee than agreed, with the size depending on how far the setting moved and how many reservations are affected.

What the attacker needed

Agent changes pool fee share; reservation settled after the change

The fix

The distribution should use the pool fee share stored in the collateral reservation, falling back to the agent's current value only when the stored field is zero, as the pool fee calculation already does.

How it was found

  1. A user creates a collateral reservation, which stores the agent's pool fee share at that moment.
  2. The agent updates their pool fee share setting before the reservation is settled.
  3. The user completes minting, triggering the fee distribution function.
  4. The function splits the fee using the new setting rather than the stored one.

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 someone mints a token, they pay a fee that is split between the agent and a shared pool. The split percentage is meant to be locked in when the reservation is made. Here the code looks up the agent's current percentage at payout time instead, so changing the setting in between shifts money between the two parties.

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 rilwan99

View all

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

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.