Skip to content
Business logic Audit finding Intermediate

The refundAccount is erroneously set to msg.sender instead of tx.origin when refundAccount specified as address(0)

When a user leaves the refund account as the zero address, the bridge deposit processor falls back to the immediate caller rather than the original user. Because the caller is always the Dispenser contract, any excess fees are refunded to the wrong address.

haxatron1 Follow with SBSecurity, Emmanuel and 1 other

Originally disclosed on Code4rena

Submitted by haxatron, also found by peanuts (1, 2), SBSecurity, givn (1, 2), Emmanuel, and EV_om

For multiple bridge functions, it allows a user to specify a refundAccount parameter to receive the excess fees paid for cross-chain transaction.

Example shown below:

WormholeDepositProcessorL1.sol#L59-L98

    function _sendMessage(
        address[] memory targets,
        uint256[] memory stakingIncentives,
        bytes memory bridgePayload,
        uint256 transferAmount
    ) internal override returns (uint256 sequence) {
        ...
        // If refundAccount is zero, default to msg.sender
        if (refundAccount == address(0)) {
            refundAccount = msg.sender;
        }
        ...
    }

When the refundAccount is address(0) we default to the msg.sender. The intended functionality of this, as quoted by sponsor:

For example, when the user does not care about the funds, or they don’t want to go into the payload data complications.

The intention is - we don’t want to steal user’s funds, and if they don’t care - we refer them to the user.

However, for the L1DepositProcessor contracts, msg.sender will always be the Dispenser contract, so the refunds will be sent to the wrong address. This also affects the Arbitrum contracts.

Impact

The intended functionality is broken and refunds will be sent to the wrong address.

Recommended Mitigation Steps

Set the refundAccount to tx.origin instead.

kupermind (Olas) confirmed

Olas mitigated

Varun_05 (warden) commented:

Fixed.


The original report as published on Code4rena, by haxatron. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 fallback for an unspecified refund account uses msg.sender, which in these L1 processors is always the Dispenser contract rather than the end user.

Impact

The intended refund behaviour is broken and excess fees are sent to the wrong address rather than the user.

What the attacker needed

User leaves refund account as zero address; cross-chain bridge deposit

The fix

The fallback should use tx.origin instead of msg.sender; the report notes the project mitigated this.

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 can send leftover fees back to someone. The code meant to send them back to the person who started the transaction, but it actually used the contract that called it next, which is always an internal helper contract. So the money goes to the wrong place instead of the user.

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 haxatron1

View all

7 more disclosed reports, best first.

More from Olas

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.