Skip to content
Business logic Audit finding Intermediate

Dex aggregator unused eth loss

The deposit functions in the DexAggregatorWrapper contract do not refund excess ETH sent by the user, leaving it stuck in the contract. An attacker could potentially steal this ETH via a separate refund vulnerability, or the funds may be permanently locked.

Blobism Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

49835 sc insight dex aggregator unused eth loss

Submitted on Jul 19th 2025 at 21:56:53 UTC by @Blobism for Attackathon | Plume Network

Description

Brief / Intro

If a user calls either of the Dex Aggregator deposit methods with a value of ETH larger than the amount they request to wrap, the remaining ETH gets left in the contract, resulting in the funds being locked/stolen.

Vulnerability Details

Calling depositOneInch or depositOkxUniversal with the nativeValueToWrap parameter will result in only that amount of sent ETH getting wrapped to WETH, and any remaining ETH gets left in the contract.

The wrapping of the WETH is shown below. Notice an amount can be wrapped that is smaller than msg.value:

Solidity
function _checkAndMintNativeAmount(uint256 nativeAmount) internal returns (bool useNative) {
    if (nativeAmount > msg.value) {
        revert DexAggregatorWrapper__InsufficientEthForSwap();
    }
    if (nativeAmount > 0) {
        // Direct WETH call, no SafeTransferLib needed here
        canonicalWrapToken.deposit{ value: nativeAmount }();
        useNative = true;
    }
    // Implicitly returns false if nativeAmount is 0
}

After the ETH is wrapped and sent, the remaining ETH is NOT refunded in depositOneInch and depositOkxUniversal, so the remaining ETH gets left in the contract. See the 1inch version:

Solidity
function depositOneInch(
    // ...
    uint256 nativeValueToWrap,
    PredicateMessage calldata predicateMessage
)
    external
    payable
    nonReentrant
    returns (uint256 shares)
{
    // ...

    // Use safeTransfer to send shares to msg.sender
    ERC20(vaultAddress).safeTransfer(msg.sender, shares);

    // <----------- BUG: no excess ETH refund

    _calcSharesAndEmitEvent(
        supportedAsset,
        CrossChainTellerBase(address(teller)),
        address(desc.srcToken),
        desc.amount,
        supportedAssetAmount
    );
}

Compare this to depositAndBridgeOneInch and depositAndBridgeOkxUniversal, where remaining ETH is refunded at the end of the methods. See the 1inch version:

Solidity
function depositAndBridgeOneInch(
    // ...
)
    external
    payable
    nonReentrant
{
    // ...

    // Refund any excess ETH
    _refundExcessEth(payable(msg.sender));

    _calcSharesAndEmitEvent(supportedAsset, teller, address(desc.srcToken), desc.amount, supportedAssetAmount);
}

{% hint style="warning" %} Important note: the ETH refund method contains a vulnerability which allows this unused ETH to be stolen. This is a distinct bug — the current issue is critical regardless of whether the excess ETH is permanently locked or can be stolen by a separate exploit. While a user might attempt to recover funds via the broken refund mechanics, an attacker can race to use that approach first and steal funds from the contract. Aside from that exploit, the funds may remain permanently locked. {% endhint %}

Impact Details

Because nativeValueToWrap is a parameter of the deposit methods, it is reasonable for a user to pass a larger amount of ETH than what they are wrapping. It is a critical vulnerability that the remaining ETH is not returned to the user.

The "deposit and bridge" methods handle this correctly in principle (disregarding the distinct refund vulnerability) because they refund remaining ETH at the end of the methods.

References

See src/helper/DexAggregatorWrapperWithPredicateProxy.sol in the target repository: https://github.com/immunefi-team/attackathon-plume-network-nucleus-boring-vault/blob/main/src/helper/DexAggregatorWrapperWithPredicateProxy.sol

Proof of Concept

The following path leads to the vulnerability:

{% stepper %} {% step %} User calls depositOneInch or depositOkxUniversal with a nonzero nativeValueToWrap which is smaller than msg.value (native ETH sent). {% endstep %}

{% step %} Some of the native ETH is not wrapped and remains in the contract. {% endstep %}

{% step %} The remaining ETH is now locked in the contract, or can potentially be stolen by an attacker using a separate exploit to drain the unused ETH. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by Blobism. 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 deposit functions fail to refund any excess ETH sent by the user after wrapping the required amount.

Impact

The excess ETH could be permanently locked in the contract or stolen by an attacker exploiting a separate refund vulnerability.

What the attacker needed

User sends more ETH than nativeValueToWrap

The fix

The deposit functions should refund any excess ETH to the user, as the depositAndBridge functions do.

How it was found

  1. User calls depositOneInch or depositOkxUniversal with a nativeValueToWrap smaller than the ETH sent.
  2. Some ETH is not wrapped and remains in the contract.
  3. The remaining ETH is locked or can be stolen via a separate exploit.

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 more money (ETH) than needed to a smart contract function, the extra should be returned to you. Here, the contract keeps the extra ETH, and it can get stuck forever or be taken by someone else.

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 Blobism

View all

19 more disclosed reports, best first.

More from Plume Network

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.