Skip to content
Business logic Audit finding Intermediate

Fund freeze scenario

The Dispatcher contract's native token transfer uses a low-level call whose return value is not checked, so if the recipient rejects the transfer the tokens remain stuck in the contract instead of the transaction reverting. An attacker could cause native tokens to be frozen in the contract by sending them to a recipient that cannot accept them.

Shahen Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#43528 [SC-Low] fund freeze scenario

Submitted on Apr 7th 2025 at 19:20:26 UTC by @Shahen for Audit Comp | Spectra Finance

Description

Brief/Intro

In the Dispatcher._dispatch() function, If the passed command is TRANSFER_NATIVE and the recipient cant accept native tokens, instead of reverting the whole transaction the native tokens will be stuck in the contract where Dispatcher.sol is inherited to. Mitigation is simple by checking the return value of the low-level call in L485 (Dispatcher.sol).

I have attached a coded foundry poc, Make a new test file under /test and paste the test code. Run forge test --match-path <testfile-name> -vvv

Vulnerability Details

Same as above brief intro

Impact Details

Freezing of native tokens if recipient address cant accept natives.

References

https://github.com/immunefi-team/Spectra-Audit-Competition/blob/1cebdc67a9276fd87105d13f302fd77d000d0c0b/src/router/Dispatcher.sol#L485

Proof of Concept

Proof of Concept

// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.20;

import "forge-std/Test.sol";
import {Dispatcher} from "../../src/router/Dispatcher.sol";
import {Commands} from "../../src/router/Commands.sol";


contract A is Dispatcher {

    constructor() Dispatcher(address(0x3)) {}
    function with_val(bytes calldata inputs) external payable {
        bytes1 commandType = bytes1(uint8(Commands.TRANSFER_NATIVE));
        _dispatch(commandType,inputs);
    }


}

contract B {
    //cant accept natives
}

contract freezeTest is Test {

   
    A public _a;
    B public _b;
    

    function setUp() public {
        
        _a = new A();
        _b = new B(); //recipient

    }


    function test_freeze() public {
        
        deal(address(this),1e18);
        assertEq(address(this).balance, 1e18);
        bytes memory _inputs = abi.encode(address(_b),uint256(1e18));


        //1. calls _dispatch() with command TRANSFER_NATIVE and a certain msg.value
        //2. If the recipient cant accept native tokens, instead of reverting the whole transaction the native tokens will be stuck in the contract where Dispatcher.sol is inherited to.
        _a.with_val{value: 1e18}(_inputs);
        assertEq(address(_a).balance, 1e18);
        assertEq(address(_b).balance, 0);

        //3. Mitigation is simple, check the return value of the lowlevel call in L485 (Dispatcher.sol)

    }

}

The original report as published on Immunefi, by Shahen. 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 return value of the low-level call used to transfer native tokens is not checked, so a failed transfer does not revert the transaction.

Impact

Native tokens could be temporarily frozen in the contract if the recipient cannot accept them.

What the attacker needed

Recipient cannot accept native tokens; attacker can trigger TRANSFER_NATIVE command

How it was found

  1. Deploy a contract that inherits Dispatcher and exposes a function calling _dispatch with the TRANSFER_NATIVE command.
  2. Deploy a recipient contract that cannot accept native tokens.
  3. Call the dispatch function with a native token value and the recipient address as input.
  4. Observe that the transaction does not revert and the tokens remain in the Dispatcher contract while the recipient balance stays zero.

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 a smart contract sends cryptocurrency (native tokens) to another address, it should check whether the transfer succeeded. Here, the contract ignores the result, so if the recipient refuses the money, it stays trapped in the contract instead of being returned or the whole action being cancelled. This means funds can get stuck.

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 Shahen

View all

3 more disclosed reports, best first.

More from Spectra Finance

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.