Skip to content
DoS Audit finding Intermediate

Token transfer can revert in unstickMinting because of insufficient funds in the vault.

The unstickMinting emergency function recalculates the collateral to burn using the current market price of the fAsset, so if that price rises after a collateral reservation the computed amount can exceed the vault's actual token balance. The payout transfer then reverts, leaving the agent unable to unstick the minting and recover collateral.

ni8mare Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#46247 [SC-Medium] Token transfer can revert in unstickMinting because of insufficient funds in the vault.

Submitted on May 27th 2025 at 08:37:42 UTC by @ni8mare for Audit Comp | Flare | FAssets

Description

Brief/Intro

The unstickMinting function may fail when attempting to transfer vault collateral (typically USDX stablecoin) to the agent's owner address. This occurs when the fAsset price increases between collateral reservation and the unstick operation, causing the calculated transfer amount to exceed the vault's available balance, resulting in a denial of service.

Vulnerability Details

Agents call unstickMinting - (https://dev.flare.network/fassets/minting#expired-proof) as a last resort to unlock collateral when minters cannot complete the minting process and agents are unable to call default within 24 hours of collateral reservation.

The vulnerability occurs in the following sequence:

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

Solidity
function unstickMinting(
        IConfirmedBlockHeightExists.Proof calldata _proof,
        uint64 _crtId
    ) internal {
        ...SNIP...
        
        // burn reserved collateral at market price
        uint256 amgToTokenWeiPrice = Conversion.currentAmgPriceInTokenWei(
            agent.vaultCollateralIndex
        );
        uint256 reservedCollateral = Conversion.convertAmgToTokenWei(
            crt.valueAMG, //doesn't consider minting fee??
            amgToTokenWeiPrice
        );
->       Agents.burnVaultCollateral(agent, reservedCollateral);
        
       ...SNIP..
    }
    
    
    // Used by asset manager for liquidation and failed redemption.
    // Is nonReentrant to prevent reentrancy in case the token has receive hooks.
    function payout(IERC20 _token, address _recipient, uint256 _amount)
        external override
        onlyAssetManager
        nonReentrant
    {
    //@audit revert here because _amount > balance of vault
    ->   _token.safeTransfer(_recipient, _amount);
    }

The burnVaultCollateral function calculates the transfer amount based on current market prices without verifying vault balance:

Solidity
function burnVaultCollateral(
    Agent.State storage _agent,
    uint256 _amountVaultCollateralWei
) internal {
    // ... initialization code ...
    
    if (vaultCollateral.token == poolCollateral.token) {
        burnVaultNATCollateral(_agent, _amountVaultCollateralWei);
    } else {
        // ... NAT calculation code ...
        
        // @audit: Transfer may fail if vault balance < _amountVaultCollateralWei
        vault.payout(
            vaultCollateral.token,
            _agent.ownerManagementAddress,
            _amountVaultCollateralWei
        );
        
        // ... remaining transfer logic ...
    }
}

The payout function performs the transfer without balance validation:

Solidity
function payout(IERC20 _token, address _recipient, uint256 _amount)
    external override
    onlyAssetManager
    nonReentrant
{
    // @audit: Reverts if _amount > token balance of vault
    _token.safeTransfer(_recipient, _amount);
}

Impact Details

This vulnerability causes the unstickMinting function to revert in critical situations where agents need emergency exit capabilities. Since this is an emergency function designed for rare but important scenarios, any failure is unacceptable and could leave agents unable to recover their collateral.

The impact represents a denial of service where the smart contract becomes unable to operate due to insufficient token funds, which should be classified as a medium severity vulnerability according to Immunefi's impact classification guidelines.

References

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

Proof of Concept

Proof of Concept

  1. Agent vault have 120 USDX worth 120$.
  2. minter call reserveCollateral and want to mint 100 fXRP when 1 fXRP = 1$ so total value he want to mint is 100$.
  3. Because vault CR is 120%, all the 120 USDX is reserved for the minting.
  4. After 24 hours price of fXRP is 1.5$.
  5. agent call unstickMinting
  6. Because market price of fXRP has increased, so the calculated reservedCollateral will be 150$(USDX).
  7. In payout function, it tries to transfer 150 USDX, but it fails because the balance of the vault is only 120 USDX.

The original report as published on Immunefi, by ni8mare. 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 amount to burn is recomputed from the current market price at unstick time without checking it against the vault's actual token balance, so a price rise makes the transfer exceed the balance.

Impact

The emergency unstickMinting path could revert, a denial of service that may leave agents unable to recover their collateral in the rare situations the function exists for.

What the attacker needed

Agent vault with reserved collateral; fAsset price rises after reservation; 24 hours pass before unstick

How it was found

  1. The agent vault holds 120 USDX of collateral.
  2. A minter reserves collateral to mint 100 fXRP at a price of 1 USDX per fXRP.
  3. The vault's 120% collateral ratio means all 120 USDX is reserved.
  4. After 24 hours the fXRP price rises to 1.5 USDX.
  5. The agent calls unstickMinting.
  6. The recalculated reserved collateral is 150 USDX, but the vault only holds 120 USDX, so the payout transfer reverts.

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.

An agent locks up collateral in a vault so that a minter can create a token. If the minter never finishes, the agent can call an emergency function to get the collateral back. This report says that function can fail because it works out how much to return using the latest price, which may be higher than what the vault actually holds, so the transfer bounces and the agent is stuck.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by ni8mare

View all

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

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.