Skip to content
Business logic Audit finding Intermediate

ETH loss on selfCloseExitTo when redeeming to collateral

When a user calls selfCloseExitTo with ETH as an executor fee but sets redeemToCollateral to true, the contract takes the non-payable redemption branch and never forwards or refunds the ETH. The ETH becomes permanently locked in the pool contract, causing a direct loss of user funds.

Rhaydden Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#46520 [SC-Low] ETH loss on `selfCloseExitTo` when redeeming to collateral

Submitted on Jun 1st 2025 at 01:19:34 UTC by @Rhaydden for Audit Comp | Flare | FAssets

Description

Brief/Intro

In CollateralPool.selfCloseExitTo, if a user passes msg.value (intended as an executor fee) but sets _redeemToCollateral = true, the contract never forwards or refunds that ETH. It remains locked in the pool contract resulting in permanent user fund loss.

Vulnerability Details

Inside _selfCloseExitTo, the code handles f-asset redemption like this:

// … after calculating `requiredFAssets` …
if (requiredFAssets > 0) {
    if (requiredFAssets < assetManager.lotSize() || _redeemToCollateral) {
        // Non-payable call: msg.value is ignored
        assetManager.redeemFromAgentInCollateral(
            agentVault, _recipient, requiredFAssets
        );
    } else {
        // Cross-chain redemption: msg.value is forwarded as executor fee
        assetManager.redeemFromAgent{ value: msg.value }(
            agentVault, _recipient, requiredFAssets, _redeemerUnderlyingAddress, _executor
        );
    }
}

When the first branch is taken—either because the redemption amount is too small or _redeemToCollateral==true—the contract calls the non-payable redeemFromAgentInCollateral and never touches msg.value. That ETH is neither wrapped into wNat nor returned to the sender. Since there is no fallback path for raw ETH (the receive() guard only allows internal withdrawals), any ETH sent is irretrievably stuck.

Impact Details

Any ETH sent as a fee under these conditions is locked in the pool contract. Users cannot retrieve it, nor can the protocol recover it via any existing withdrawal mechanism. Even accidental small-value calls lead to direct loss. This falls squarely under Permanent freezing of funds in the impacts in scope.

Fix

In any branch that accepts msg.value, either

immediately call wNat.deposit{value: msg.value}() (via _depositWNat()) so it’s tracked as collateral, OR revert if _redeemToCollateral or requiredFAssets < lotSize but msg.value > 0

References

https://github.com/flare-labs-ltd/fassets//blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/contracts/assetManager/implementation/CollateralPool.sol#L363-L372

Proof of Concept

Proof of Concept

Add this test to CollateralPool.ts:

    describe("self-close exit fee retention", async () => {
        it("should retain msg.value when redeemToCollateral=true", async () => {
            // enter pool to get tokens.
            // We put 10 ETH into the pool so the caller gets some pool tokens
            await collateralPool.enter(0, true, { value: ETH(10) });
            // Read the pool contract’s raw ETH balance before the exit
            const before = toBN(await web3.eth.getBalance(collateralPool.address));

            const tokenBalance = await collateralPoolToken.balanceOf(accounts[0]);
            // Define a 1 ETH “executor fee” to pass via msg.value
            const fee = ETH(1);
            // call self-close exit with redeemToCollateral=true and pass fee
            await collateralPool.selfCloseExitTo(tokenBalance, true, accounts[0], "", accounts[0], { value: fee });
            // Read the pool contract’s raw ETH balance after the exit
            const after = toBN(await web3.eth.getBalance(collateralPool.address));
            // Assert that the pool’s balance increased by exactly fee (1 ETH), showing that the ETH was stuck in the contract
            assertEqualBN(after.sub(before), fee, "msg.value should remain in contract");
        });
    });

The original report as published on Immunefi, by Rhaydden. 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 contract accepts msg.value in a branch that calls a non-payable function and has no logic to refund or convert the ETH, so the value is trapped.

Impact

Any ETH sent as a fee under these conditions is permanently locked in the pool contract and cannot be recovered by the user or the protocol.

What the attacker needed

User has pool tokens; user sends ETH as msg.value; redeemToCollateral is true or amount below lot size

The fix

The contract should either immediately wrap any msg.value into wNat so it is tracked as collateral, or revert when msg.value is greater than zero and the redemption goes to collateral or is below the lot size.

How it was found

  1. Enter the collateral pool by sending ETH to receive pool tokens.
  2. Record the pool contract's ETH balance.
  3. Call selfCloseExitTo with redeemToCollateral set to true and send an ETH fee as msg.value.
  4. Check the pool contract's ETH balance and observe it increased by the fee amount, confirming the ETH is stuck.

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 user sends some cryptocurrency (ETH) along with a request, expecting it to be used as a fee. But because of a setting they chose, the code takes a different path that ignores the fee and does not give it back. The money stays stuck in the contract forever, and the user cannot get it back.

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 Rhaydden

View all

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