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.
- 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
- Report ID: #47106
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/flare-foundation/fassets/blob/main/contracts/assetManager/library/CollateralReservations.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
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:
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:
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:
- Agent reduces
poolFeeShareBIPSafter collateral reservation: The collateral pool receives less fees than expected, while the agent vault receives more. - Agent increases
poolFeeShareBIPSafter 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
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
- 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
- Agent updates their pool fee share
- Agent calls function to update poolFeeShareBIPS to 2,000 (20%)
- This change should not affect existing collateral reservations
- 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
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
- A user creates a collateral reservation, which stores the agent's pool fee share at that moment.
- The agent updates their pool fee share setting before the reservation is settled.
- The user completes minting, triggering the fee distribution function.
- 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.