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.
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.
- RedeemQueue and SignatureRedeemQueue call
vault.getLiquidAssetsto query the token balance for processing withdrawals. If no hook is used, it calls ERC20'sbalanceOf. If the asset is a native token, this function call fails and the transaction is reverted. modules/ShareModule.sol#L150
function getLiquidAssets() public view returns (uint256) {
...
address hook = getHook(queue);
@> return hook == address(0) ? IERC20(asset).balanceOf(address(this)) : IRedeemHook(hook).getLiquidAssets(asset);
}
- If a hook is used, it calls
Hook.getLiquidAssets. Currently, only BasicRedeemHook exists as a redeem hook. TheBasicRedeemHook.getLiquidAssetsfunction fails if the asset is a native token becausebalanceOffails and gets reverted. hooks/BasicRedeemHook.sol#L35-L39
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);
}
}
- RedeemQueue and SignatureRedeemQueue call
vault.callHookto process withdrawals. This function callsHook.callHookvia delegatecall if a redeem hook is registered. Currently, only BasicRedeemHook exists as a redeem hook.BasicRedeemHook.callHookfails if the asset is a native token becausebalanceOffails and gets reverted. hooks/BasicRedeemHook.sol#L11-L19
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
- Using native token as asset token
External Pre-conditions
None
Attack Path
- 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.
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
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
- Deposit native tokens into the vault.
- Attempt to withdraw the native tokens.
- 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.