58578 sc low zeroxswapverifier allows attackers to drain strategy tokens via crafted calldata

Submitted on Nov 3rd 2025 at 10:31:12 UTC by @Lion47624 for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58578

  • Report Type: Smart Contract

  • Report severity: Low

  • Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/utils/ZeroXSwapVerifier.sol

  • Impacts:

    • Theft of unclaimed yield

Description

Brief/Intro

The ZeroXSwapVerifier library is designed to validate 0x swap calldata before execution. However, its verification functions fail to check critical parameters within the swap actions, specifically the source (from) and destination (to) addresses. This allows an attacker to craft a malicious 0x transaction that passes verification but transfers funds from the calling contract to an address of their choice, leading to a direct drain of assets.

Vulnerability Details

Component: src/utils/ZeroXSwapVerifier.sol

Affected Functions:

  • _verifyTransferFrom

  • _verifySellToLiquidityProvider

  • _verifyBasicSellToPool

  • _verifyUniswapV3VIP

  • _verifyVelodromeV2VIP

The core of the issue lies in the incomplete validation within the helper functions that verify individual 0x actions. For example, the _verifyTransferFrom function only checks that the token being transferred matches the expected targetToken.

File: src/utils/ZeroXSwapVerifier.sol solidity // ...existing code... /** * @dev Verify TRANSFER_FROM action * Format: transferFrom(IERC20 token, address from, address to, uint256 amount) */ function _verifyTransferFrom(bytes memory action, address owner, address targetToken, uint256 targetAmount) internal view { (address token, , , uint256 amount) = abi.decode( _slice(action, 4), (address, address, address, uint256) );

// ...existing code...

As shown above, the from and to parameters are ignored. An attacker can supply calldata where from is the address of the contract using the verifier (the owner) and to is the attacker's address. Since the token address check will pass, the verifier will incorrectly approve the malicious action.

Impact Details

This vulnerability allows for the theft of all tokens that a contract, which relies on ZeroXSwapVerifier, has approved for the 0x protocol. It completely undermines the security purpose of the verifier library.

References

https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/utils/ZeroXSwapVerifier.sol#L238-L246

Proof of Concept

Proof of Concept

create a new poc.t.sol file in the test folder, copy and paste the following test suite and run forge test --mt test_canDrainFundsViaMalformedTransferFrom. The test proves that the verifier fails to check the from address in the swap data, allowing the attacker to specify the strategy contract itself as the source of the funds to be stolen.

Was this helpful?