Skip to content
Business logic Audit finding Intermediate

Stranded ETH on batched `crosschainTransferShares` call

A payable function that transfers shares across chains silently discards ETH when called inside a batch, leaving the funds stuck in the router contract. An attacker or unlucky user could repeatedly send ETH that becomes stranded, recoverable only by a privileged admin sweep.

gh0xt Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-10-centrifuge-protocol-v3-1-audit-judging/issues/397

Found by

gh0xt

Summary

ETH sent alongside a batched crosschainTransferShares call gets stranded on VaultRouter. In the batch path, the gateway is already funded separately, so the router never forwards or refunds msg.value. The ETH stays in the router’s balance pending priviledged, unguaranteed admin recovery.

Root Cause

The VaultRouter:crossChainTransferShares, allows users transfer share tokens accross different centrifugeId. The function is payable but zeroes out msg.value if the isBatching == true.
https://github.com/sherlock-audit/2025-10-centrifuge-protocol-v3-1-audit/blob/main/protocol/src/vaults/VaultRouter.sol#L118-L120 This makes sure that we dont have a revert at Gateway:send https://github.com/sherlock-audit/2025-10-centrifuge-protocol-v3-1-audit/blob/main/protocol/src/core/messaging/Gateway.sol#L154 However, because the function simply zeroes out the msg.Value and does not refund the user their ETH, the ETH gets stuck in the VaultRouter contract. Even though the contract is recoverable; recovery is priviledged, not guaranteed and no sender attribution is preserved on the sweep, so the exact remediation pattern is not necessarily clear. This is also repeatable, affecting unsuspecting users following a supposed benign path.

Consider this, a user deposits in the SyncVault in centrifugeId == 1 through the VaultRouter. They would like to have the shareToken on centrifugeId == 2 but the SyncVault's deposit does not mint cross network, so the user batches deposit with crossChainTransferShares by calling the gateway's withBatch with a multicall contract. In this batched multicall, they also forward some ETH to the crossChainTransferShares as the function is payable. Because there are no check or reverts on msg.value > 0 when isBatching == true here, the function calls spoke.crosschainTransferShares with msg.Value == 0, leaving ETH stranded in the VaultRouter. On success, there is no internal refund path for the router, so autorecovery is not possible.

This is more than an accidental direct transfer because the same payable function legitimately requires ETH off batch yet silently discards it in batch.

Internal Pre-conditions

  1. crosschainTransferShares path is payable and lacks require(msg.value == 0);
  2. Router doesn’t auto-route or refund ETH

External Pre-conditions

  1. Caller submits a batch that calls crosschainTransferShares{value: X>0}
  2. Call succeeds (valid ownership/allowance), and the batch has no step that withdraws or forwards the ETH

Attack Path

  1. User deposits into SyncDepositVault on chain A via VaultRouter.deposit, minting local shares
  2. User approves router to move those shares
  3. User builds a batch via gateway.withBatch that calls VaultRouter.crosschainTransferShares and attaches ETH
  4. Router enters batching mode: gateway.isBatching()==true
  5. crosschainTransferShares pulls shares from user, then calls spoke.crosschainTransferShares{ value: 0 }(...) because batching forces value: 0
  6. The spoke call proceeds without needing the user’s ETH. No revert occurs
  7. The batch commits. The ETH sent to the router is not refunded and remains in VaultRouter
  8. Shares get bridged to chain B as intended; user believes all good
  9. ETH is now stranded in VaultRouter balance; only recoverable by privileged sweep, no sender attribution
  10. Repeating this pattern in more batches accumulates more stuck ETH

Impact

It is a repeatable and reachable loss of user supplied ETH via a benign flow. As there are no automatic refunds, only a privileged sweep can recover the lost funds (of varying amounts, >$10 possible) with no sender attribution.

PoC

Add this suite to test/vaults/integration:

Solidity
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;

import "../../../src/misc/interfaces/IERC20.sol";
import "../../../src/misc/interfaces/IERC7540.sol";
import "../../../src/misc/interfaces/IERC7575.sol";
import {CastLib} from "../../../src/misc/libraries/CastLib.sol";
import {MathLib} from "../../../src/misc/libraries/MathLib.sol";
import {IERC7751} from "../../../src/misc/interfaces/IERC7751.sol";

import "../../core/spoke/integration/BaseTest.sol";

import {ISpoke} from "../../../src/core/spoke/interfaces/ISpoke.sol";
import {MessageLib} from "../../../src/core/messaging/libraries/MessageLib.sol";

import {VaultRouter} from "../../../src/vaults/VaultRouter.sol";
import {IBaseVault} from "../../../src/vaults/interfaces/IBaseVault.sol";
import {SyncDepositVault} from "../../../src/vaults/SyncDepositVault.sol";
import {IAsyncVault} from "../../../src/vaults/interfaces/IAsyncVault.sol";
import {IVaultRouter} from "../../../src/vaults/interfaces/IVaultRouter.sol";
import {IAsyncRequestManager} from "../../../src/vaults/interfaces/IVaultManagers.sol";
import {IGateway} from "../../../src/core/messaging/interfaces/IGateway.sol";

// Helper to drive Gateway.withBatch and forward ETH to the router inside the callback
contract BatchCallback {
    IGateway public immutable G;
    IVaultRouter public immutable R;

    constructor(IGateway g, IVaultRouter r) { G = g; R = r; }

    // Called by Gateway.withBatch(...) with {value: callbackValue}
    function _run2(bytes calldata call1, bytes calldata call2) external payable {
        // step 1: deposit (nonpayable)
        (bool ok1,) = address(R).call(call1);
        require(ok1, "router call1 failed");

        // step 2: crosschainTransferShares (payable, but batching will zero msg.value internally)
        (bool ok2,) = address(R).call{value: msg.value}(call2);
        require(ok2, "router call2 failed");

        G.lockCallback();
    }

    function start2(bytes calldata call1, bytes calldata call2, uint256 callbackValue, address refund) external payable {
        G.withBatch{value: msg.value}(
            abi.encodeWithSelector(this._run2.selector, call1, call2),
            callbackValue,
            refund
        );
    }
}


contract VaultRouterAuditTest is BaseTest {
    using MessageLib for *;
    using MathLib for uint256;

    uint256 constant GAS = 10_000_000; // 10M gas
    bytes PAYLOAD_FOR_GAS_ESTIMATION = MessageLib.NotifyPool(1).serialize();

    function test_BatchedDepositAndCrosschain_StrandsETHOnRouter() public {
        // Deploy vault
        (, address vaultAddr,) = deploySimpleVault(VaultKind.SyncDepositAsyncRedeem);
        SyncDepositVault vault = SyncDepositVault(vaultAddr);
        IShareToken share = IShareToken(address(vault.share()));

        // Cross-chain prerequisites
        uint16 dst = 2; // non-local centrifugeId
        centrifugeChain.updateMember(vault.poolId().raw(), vault.scId().raw(), address(uint160(dst)), type(uint64).max);
        root.endorse(address(uint160(dst)));
        root.endorse(address(spoke));

        // Batch helper + memberships so hook allows mint/transfer to callback
        BatchCallback cb = new BatchCallback(gateway, vaultRouter);
        centrifugeChain.updateMember(vault.poolId().raw(), vault.scId().raw(), address(cb), type(uint64).max);
        root.endorse(address(cb));

        // Assets → callback; approvals for router
        uint256 assets = 100e18;
        erc20.mint(address(this), assets);
        erc20.transfer(address(cb), assets);
        vm.prank(address(cb));
        erc20.approve(address(vaultRouter), assets);

        // Precompute shares and pre-approve share allowance from callback to router
        uint256 sharesToSend = vault.previewDeposit(assets);
        vm.prank(address(cb));
        share.approve(address(vaultRouter), type(uint256).max);

        // Build inner router calls executed inside the single withBatch callback
        bytes memory call1 = abi.encodeWithSelector(
            vaultRouter.deposit.selector,
            vault,
            assets,
            address(cb),  // receiver = callback
            address(cb)   // owner = callback (router pulls assets from cb)
        );

        uint256 half = sharesToSend / 2;
        bytes memory call2 = abi.encodeWithSelector(
            vaultRouter.crosschainTransferShares.selector,
            vault,
            uint128(half),
            dst,
            bytes32(bytes20(address(this))), // receiver on dst
            address(cb),                     // owner = callback
            0,                               // extraGasLimit
            0,                               // remoteExtraGasLimit
            address(0)                       // refund
        );

        // Fund batch: COST to gateway, DUST to callback; DUST will be forwarded on call2 and stranded on router
        uint256 COST = 1 ether;
        uint256 STUCK_ETH = 1 ether;
        vm.deal(address(cb), COST + STUCK_ETH);

        uint256 before = address(vaultRouter).balance;
        cb.start2{value: COST + STUCK_ETH}(call1, call2, STUCK_ETH, address(this));
        uint256 after_ = address(vaultRouter).balance;

        assertEq(after_ - before, STUCK_ETH, "ETH should remain on router when batching deposit+transfer");
    }
}

Mitigation

Add a guard at function entry.

Solidity
error ETHNotAcceptedInBatch();

function crosschainTransferShares(...) external payable protected {
    bool batching = gateway.isBatching();
    if (batching && msg.value != 0) revert ETHNotAcceptedInBatch();

    // …
    spoke.crosschainTransferShares{ value: batching ? 0 : msg.value }(...);
}

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/centrifuge/protocol-internal/pull/98

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

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 function is payable but, when batching is active, it sets the value forwarded to zero without checking that no ETH was sent or refunding it.

Impact

User-supplied ETH is repeatedly lost and can only be recovered by a privileged sweep with no sender attribution.

What the attacker needed

User has shares and approves the router; user batches a cross-chain transfer with ETH attached; batch succeeds without forwarding the ETH

The fix

The protocol team fixed this issue by adding a guard that reverts if ETH is sent while batching.

How it was found

  1. User deposits into a sync deposit vault via the router, minting local shares.
  2. User approves the router to move those shares.
  3. User builds a batch via the gateway that calls the cross-chain share transfer function and attaches ETH.
  4. The router enters batching mode and the transfer function forwards zero value, so the call succeeds without using the ETH.
  5. The batch commits, shares are bridged, but the ETH is not refunded and remains in the router.

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 function that accepts ETH (the cryptocurrency of the Ethereum network) is supposed to either use that ETH or give it back. When this function is called as part of a batch of actions, it quietly sets the ETH amount to zero and never returns the money, so the ETH sits in the contract forever unless an admin manually moves it.

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 from Centrifuge Protocol V3.1

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.