Skip to content
Business logic Audit finding Intermediate

Dispatcher._dispatch() does not revert on failure of transfer of funds when called with the TRANSFER_NATIVE command

The Dispatcher contract's _dispatch function does not revert when a native ether transfer fails, unlike other commands that check the success boolean. An attacker could potentially cause silent failures in multi-command transactions, leading to inconsistent state or loss of funds if subsequent commands rely on the transfer's success.

Vanshika Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#43856 [SC-Low] Dispatcher._dispatch() does not revert on failure of transfer of funds when called with the TRANSFER_NATIVE command

Submitted on Apr 13th 2025 at 07:37:26 UTC by @Vanshika for Audit Comp | Spectra Finance

Description

Brief/Intro

Dispatcher._dispatch() silently fails if native ether transfer returns a false boolean.

Vulnerability Details

Dispatcher._dispatch() should revert if the following case returns a false value:

        function _dispatch(bytes1 _commandType, bytes calldata _inputs) internal {
            uint256 command = uint8(_commandType & Commands.COMMAND_TYPE_MASK);
            // function truncted to only show relevant parts.
            . . .
            else if (command == Commands.TRANSFER_NATIVE) {
            (address recipient, uint256 amount) = abi.decode(_inputs, (address, uint256));
            // call does not revert on failure
            (bool success, ) = payable(recipient).call{value: amount}("");
            }
            . . .
        }

In other if-clauses in the same function, a false boolean is reverted with a CallFailed() error as shown below. This is missing when command == TRANSFER_NATIVE.

    if (!success) {
        revert CallFailed();
    }

Impact Details

The function does not revert on failure, which may cause errors if there are other commands relying on its success.

Proof of Concept

Proof of Concept

Copy the following into RouterTest.t.sol and run with forge test --mt test_transferNativeRevert -vvvv.

    function test_transferNativeRevert() public {
        address alice = makeAddr("alice");
        bytes memory commands = abi.encodePacked(bytes1(uint8(Commands.TRANSFER_NATIVE)));
        bytes[] memory inputs = new bytes[](1);
        inputs[0] = abi.encode(alice, 1e18);
        
        vm.prank(testUser);
        router.execute(commands, inputs);

        // unsuccessful transfer but no revert
        assertEq(address(router).balance, 0);
        assertEq(alice.balance, 0);
    }

Expected result:

Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 7.23s (147.87ms CPU time)

Ran 1 test suite in 7.25s (7.23s CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)

The original report as published on Immunefi, by Vanshika. 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 code omits a check on the success boolean returned by the low-level call for the TRANSFER_NATIVE command, unlike other commands that revert on failure.

Impact

The function does not revert on failure, which may cause errors if there are other commands relying on its success.

What the attacker needed

Ability to call router.execute with TRANSFER_NATIVE command; Recipient that rejects ether transfer

The fix

The code should check the success boolean and revert with a CallFailed error if the transfer fails, as done for other commands.

How it was found

  1. Encode a command for TRANSFER_NATIVE with a recipient and amount.
  2. Call router.execute with that command and input.
  3. Observe that the transfer fails (recipient balance remains zero) but the transaction does not revert.

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 ether to someone, the transfer can fail (for example, if the recipient rejects it). The code should check if the transfer succeeded and undo everything if it didn't. Here, for one specific command, it forgets to check, so the transaction continues as if the transfer worked, which could cause problems later.

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 Vanshika

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.