Skip to content
DoS Audit finding Intermediate

Unable to withdraw native tokens because vault and redeem hooks do not handle native tokens

The vault's withdrawal logic uses ERC20 balanceOf calls even when the asset is a native token, causing those calls to revert. As a result, users cannot withdraw native tokens after depositing them.

0x23r0 Follow with 0xc0ffEE, 7 and 12 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-07-mellow-flexible-vaults-judging/issues/147

Found by

0x23r0, 0xc0ffEE, 7, Cybrid, Greed, dan__vinci, edger, hunt1, katz, ke1caM, khaye26, klaus, t.aksoy, theboiledcorn, weblogicctf

Summary

The vault and redeem hook do not handle native token, preventing them from processing native token withdrawal requests. Users cannot withdraw native tokens.

Root Cause

The vault is generally implemented to support native tokens, and native tokens are included in the supported token list. However, when querying token balances during withdrawal, it does not consider the case where the asset token is a native token. This causes withdrawals to fail.

  1. RedeemQueue and SignatureRedeemQueue call vault.getLiquidAssets to query the token balance for processing withdrawals. If no hook is used, it calls ERC20's balanceOf. If the asset is a native token, this function call fails and the transaction is reverted. modules/ShareModule.sol#L150
Solidity
function getLiquidAssets() public view returns (uint256) {
    ...
    address hook = getHook(queue);
@>  return hook == address(0) ? IERC20(asset).balanceOf(address(this)) : IRedeemHook(hook).getLiquidAssets(asset);
}
  1. If a hook is used, it calls Hook.getLiquidAssets. Currently, only BasicRedeemHook exists as a redeem hook. The BasicRedeemHook.getLiquidAssets function fails if the asset is a native token because balanceOf fails and gets reverted. hooks/BasicRedeemHook.sol#L35-L39
Solidity
function getLiquidAssets(address asset) public view virtual returns (uint256 assets) {
    IVaultModule vault = IVaultModule(msg.sender);
@>  assets = IERC20(asset).balanceOf(address(vault));
    uint256 subvaults = vault.subvaults();
    for (uint256 i = 0; i < subvaults; i++) {
        address subvault = vault.subvaultAt(i);
@>      assets += IERC20(asset).balanceOf(subvault);
    }
}
  1. RedeemQueue and SignatureRedeemQueue call vault.callHook to process withdrawals. This function calls Hook.callHook via delegatecall if a redeem hook is registered. Currently, only BasicRedeemHook exists as a redeem hook. BasicRedeemHook.callHook fails if the asset is a native token because balanceOf fails and gets reverted. hooks/BasicRedeemHook.sol#L11-L19
Solidity
function callHook(address asset, uint256 assets) public virtual {
    IVaultModule vault = IVaultModule(address(this));
@>  uint256 liquid = IERC20(asset).balanceOf(address(vault));
    ...
    for (uint256 i = 0; i < subvaults; i++) {
        address subvault = vault.subvaultAt(i);
@>      uint256 balance = IERC20(asset).balanceOf(subvault);
        ...
    }
}

Internal Pre-conditions

  1. Using native token as asset token

External Pre-conditions

None

Attack Path

  1. Attempt to withdraw after depositing native token

Impact

Cannot withdraw native token. Users cannot withdraw asset token.

PoC

The following PoC shows that vault.getLiquidAssets fails. Add to flexible-vaults/test/unit/modules/ShareModule.t.sol and run.

Solidity
function test_poc_GetLiquidAssets() external {
    address asset = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); // native
    assets.push(address(asset));

    Deployment memory deployment = createVault(vaultAdmin, vaultProxyAdmin, assets);

    vm.startPrank(vaultAdmin);
    deployment.vault.setQueueLimit(2);
    deployment.vault.createQueue(0, true, vaultProxyAdmin, address(asset), new bytes(0));
    deployment.vault.createQueue(0, false, vaultProxyAdmin, address(asset), new bytes(0));
    assertEq(deployment.vault.getQueueCount(), 2, "Queue count should be 2");
    vm.stopPrank();

    address depositQueue = deployment.vault.queueAt(address(asset), 0);
    address redeemQueue = deployment.vault.queueAt(address(asset), 1);

    vm.prank(redeemQueue);
    vm.expectRevert();
    deployment.vault.getLiquidAssets();
}

Mitigation

When the asset token is a native token, query the native token balance instead of using ERC20.balanceOf.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/mellow-finance/flexible-vaults/pull/10/files

The original report as published on Sherlock, by 0x23r0. 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 code assumes the asset is always an ERC20 token and calls balanceOf on it, which fails for native tokens.

Impact

Users cannot withdraw native tokens from the vault.

What the attacker needed

Vault uses native token as asset

The fix

The protocol team fixed this issue by updating the code to query the native token balance when the asset is a native token.

How it was found

  1. Deposit native tokens into the vault.
  2. Attempt to withdraw the native tokens.
  3. The withdrawal fails because the vault calls ERC20 balanceOf on the native token address.

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.

This smart contract vault lets people deposit and withdraw tokens. It mistakenly treats the native blockchain currency (like ETH) as a regular token, so when it tries to check the balance using a token-specific function, the check fails and withdrawals are blocked.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0x23r0

View all

23 more disclosed reports, best first.

More from Mellow Flexible Vaults

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.