#45499 [SC-Low] Malicious user can prevent agent to be destroyed and lock up his funds

Submitted on May 15th 2025 at 16:51:44 UTC by @holydevoti0n for Audit Comp | Flare | FAssets

  • Report ID: #45499

  • Report Type: Smart Contract

  • Report severity: Low

  • Target: https://github.com/flare-foundation/fassets/blob/main/contracts/assetManager/facets/AgentVaultManagementFacet.sol

  • Impacts:

    • Permanent freezing of funds

Description

Brief/Intro

Malicious users can permanently lock an agent's collateral by buying tokens from the collateral pool after the agent has announced destruction. This prevents the agent owner from completing the destruction process, effectively resulting in a DoS attack that permanently locks the agent's funds.

Vulnerability Details

The agent destruction process in the protocol follows a specific sequence:

  1. The agent owner announces the intention to destroy the agent via announceDestroyAgent()

  2. After a waiting period, the owner calls destroyAgent() to complete the process and recover their collateral

The vulnerability occurs because during the waiting period between announcement and actual destruction, any user can purchase collateral pool tokens from the agent's pool calling CollateralPool.enter(). When this happens, the destroyAgent() function will fail at the following check in the CollateralPool.destroy() function: https://github.com/flare-labs-ltd/fassets/blob/acb82a27b15c56ce9dfbb6dbbd76008da6753c26/contracts/assetManager/implementation/CollateralPool.sol#L833

This check verifies that no pool tokens are in circulation before allowing destruction. However, there is no mechanism to prevent users from buying pool tokens after an agent has announced destruction, nor is there a way for the agent owner to force-redeem these tokens.

Here's a step by step on how an attacker can DoS the agent to be destroyed and thus locking up his funds:

  1. An agent announces destruction with announceDestroyAgent()

  2. The required waiting period passes

  3. A user buys collateral pool tokens with enter()

  4. When the agent owner attempts to call destroyAgent(), the transaction reverts with "cannot destroy a pool with issued tokens"

Notice this is not the same vulnerability that was reported in one of the previous bugs reported in:

The reason is that the CollateralPool.enter allows to DoS the destroying process by minting collateral pool tokens.

Impact Details

  • Malicious users can permanently lock an agent's collateral by purchasing pool tokens after destruction is announced.

  • The agent owner loses access to their funds with no recovery mechanism available. Permanent DoS as any user can always mint tokens to prevent the agent from being destroyed.

Proof of Concept

Add the following test in test/unit/fasset/library/Agent.ts:

run: npx hardhat test Output:

Was this helpful?