Skip to content
Business logic Audit finding Intermediate

DepositNat() in CollateralPool Fails to Notify Asset Manager, By not calling the updateCollateral

The depositNat() function in CollateralPool updates the pool's internal collateral total but does not call updateCollateral() on the asset manager, so the wider system is not notified of the deposit. This can cause an agent to remain in liquidation even after sufficient collateral has been deposited.

danvinci_20 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#46930 [SC-Low] `depositNat()` in `CollateralPool` Fails to Notify Asset Manager, By not calling the `updateCollateral`

Submitted on Jun 6th 2025 at 11:47:31 UTC by @danvinci_20 for Audit Comp | Flare | FAssets

Description

Description

The CollateralPool contract includes a depositNat() function that allows the asset manager to deposit native currency (msg.value). However, this function does not call updateCollateral(), which is essential to notifying the agent collateral system that a deposit has occurred. As a result, although the internal totalCollateral value in the pool is updated, the broader system remains unaware of the collateral change.

This breaks critical collateral synchronization between CollateralPool and the asset manager, potentially allowing incorrect liquidation behavior and desynchronization of agent status.

Solidity
function depositNat()
    external payable
    onlyAssetManager
{
    @>> _depositWNat();
}

function _depositWNat()
    internal
{
    // msg.value is always > 0 in this contract
    if (msg.value > 0) {
        totalCollateral += msg.value;
       @>> wNat.deposit{value: msg.value}();
    }
}

unlike the agentVault the depositNat calls the updateCollateral() as intended:

Solidity
 // used by asset manager to transfer collateral reservation fee to the agent vault
    function depositNat(IWNat _wNat)
        external payable override
        onlyAssetManager
    {
        _wNat.deposit{value: msg.value}();
        assetManager.updateCollateral(address(this), _wNat);
        _tokenUsed(_wNat, TOKEN_DEPOSIT);
    }

Impact Details

This can lead to Incorrect Liquidation Status, since The agent remains in liquidation despite meeting collateral requirements.

Recommendation

Ensure that every deposit function that affects an agent's collateral position calls assetManager.updateCollateral() immediately after the deposit is complete. This guarantees consistency and ensures that liquidation and recovery flows function as intended.

Proof of Concept

Proof of Concept

Consider the following scenario:

  1. An agent’s collateral ratio drops below the minimum, triggering liquidation.
  2. The asset manager calls the CollateralReservations.distributeCollateralReservationFee()expects a deposit which can help to rescue the agent (through depositNat()).
  3. The deposit goes through to the collateralPool via CollateralPool.depositNat(), which updates totalCollateral, but does not update the asset manager.

As a result, the system continues to treat the agent as undercollateralized unfairly. This can result in the liquidation process continuing despite the agent having sufficient funds.

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

Impact

The agent may remain in liquidation despite meeting collateral requirements, potentially causing incorrect liquidation behaviour.

What the attacker needed

Agent collateral ratio below minimum; asset manager calls depositNat()

The fix

Ensure that every deposit function that affects an agent's collateral position calls assetManager.updateCollateral() immediately after the deposit is complete.

How it was found

  1. An agent's collateral ratio drops below the minimum, triggering liquidation.
  2. The asset manager calls distributeCollateralReservationFee(), which expects a deposit that can help rescue the agent via depositNat().
  3. The deposit goes through CollateralPool.depositNat(), which updates totalCollateral but does not update the asset manager.

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 smart contract holds collateral for agents. When someone deposits money into that contract, the contract updates its own record but forgets to tell the main system that the deposit happened. So the main system still thinks the agent has too little collateral and may keep trying to liquidate it.

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 danvinci_20

View all

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