Skip to content
Business logic Audit finding Intermediate

RedemptionSender should estimate fees to prevent failed transactions

The RedemptionSender contract allows users to specify any gas payment for a cross-chain message, which may be insufficient to cover the actual fees. This can cause the message to fail to be forwarded, potentially burning the user's tokens.

Ruhum Follow

Originally disclosed on Code4rena

Submitted by Ruhum

RedemptionSender.sol#L43

When sending a msg to the layer zero endpoint you include enough gas for the transaction. If you don’t include enough tokens for the gas, the transaction will fail. The RedemptionSender contract allows the user to pass any value they want which might result in them sending not enough. Their transaction will fail.

To know how much you have to send there’s the estimateFees() function as described here.

Proof of Concept

    function redeemWEVE(
        uint256 amount,
        address zroPaymentAddress,
        bytes memory zroTransactionParams
    ) public payable {
        require(amount != 0, "AMOUNT_ZERO");
        require(
            IERC20(weve).transferFrom(
                msg.sender,
                0x000000000000000000000000000000000000dEaD,
                amount
            ),
            "WEVE: TRANSFER_FAILED"
        );

        ILayerZeroEndpoint(endpoint).send{value: msg.value}(
            optimismChainId,
            abi.encodePacked(optimismReceiver),
            abi.encode(msg.sender, amount),
            payable(msg.sender),
            zroPaymentAddress,
            zroTransactionParams
        );
    }

Recommended Mitigation Steps

Use the estimateFees() endpoint.

pooltypes (Velodrome) acknowledged

Alex the Entreprenerd (judge) commented:

The transaction shown has a case in which it could succeed but the message wouldn’t be forwarded.

That is because any estimate_gas will make the tx work but the gas payment may not be sufficient to fund the message fees.

Because this can cause burned tokens, I believe a check should be added and since the tx must originate from the fantomSender there would be no way of forwarding the message on the behalf of the sender.

For those reasons I believe the finding is of Medium Severity.


The original report as published on Code4rena, by Ruhum. 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 contract does not estimate the required cross-chain fee and instead relies on the user to provide a sufficient amount, which can be inadequate.

Impact

The transaction may succeed on the source chain but the message may not be forwarded, causing the user's tokens to be burned.

What the attacker needed

User must call redeemWEVE with insufficient gas payment

The fix

The contract should use the estimateFees() function to calculate the required fee and ensure the user provides enough.

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 you send a message to another blockchain, you must pay for the gas that will be used on the other side. This contract lets you choose how much to pay, but if you pay too little, the message won't be delivered and your tokens could be lost. The fix is to automatically calculate the required fee.

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 Ruhum

View all

55 more disclosed reports, best first.

More from Velodrome Finance contest

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.