Skip to content
Business logic Audit finding Beginner

Incorrect function selectors used in zeroxswapverifier

The ZeroXSwapVerifier contract hard-codes incorrect 0x function selectors for the Settler execute function and for action types such as transferFrom. As a result, every swap verification call reverts with an unsupported-selector error, so the verifier cannot be used at all.

SOPROBRO Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

56982 sc medium incorrect function selectors used in zeroxswapverifier

Submitted on Oct 22nd 2025 at 11:48:28 UTC by @SOPROBRO for Audit Comp | Alchemix V3

Description

Brief/Intro

The ZeroXSwapVerifier has incorrect 0x function selectors, causing all swap verification calls to fail and rendering the contract completely non-functional.

Vulnerability Details

The ZeroXSwaoVerifier is meant to permit 0x swap calldata, however, the constants for the 0x Settler function selectors are wrong, meaning, the entire contract is rendered useless.

For example:

Solidity
bytes4 private constant EXECUTE_SELECTOR = 0xcf71ff4f;

The correct selector for:

Solidity
execute(SlippageAndActions,bytes[])

is:

0xe2297b1b

These constants are used when constructing calldata for the decodeAndVerifyActions and verifySwapCalldata functions, resulting in failed or misrouted calls when interacting with the ZeroXSwapVerifier, resulting in the following revert revert("Unsupported function selector");. Furthermore, the action selectors for different swap types also have wrong selectors

For example:

Solidity
bytes4 private constant TRANSFER_FROM = 0x8d68a156;

The correct selector for:

Solidity
transferFrom(IERC20 token, address from, address to, uint256 amount)

is:

0xd3f54f06

Impact Details

While this contact is not currently implemented, I have been told in discord by @Ov3rkoalafied that we can treat this contact as if it is correctly implemented. Therefore, the impact of this is complete loss of functionality of the ZeroXSwapVerifier, which is important for atomic withdrawals from strategies.

References

Please refer to the discord server for @Ov3rkoalafied response

Proof of Concept

Proof of Concept

Add the following test to ZeroXSwapVerifier.t.sol, and run in the console forge test --mt testVerifyUniswapV3VIP_fails -vvvv to run the test, and see the test will fail with "IS" due to the function selector not matching.

Solidity
function testVerifyUniswapV3VIP_fails() public {
	bytes memory fills = abi.encode(address(token), 100e18);
	bytes memory action = abi.encodeWithSelector(
		UNISWAPV3_VIP,
		spender,
		300, // bps
		3000, // feeOrTickSpacing
		false, // feeOnTransfer
		fills
	);

	ZeroXSwapVerifier.SlippageAndActions memory saa =
		ZeroXSwapVerifier.SlippageAndActions({recipient: spender, buyToken: address(0), minAmountOut: 0, actions: new bytes[](1)});
	saa.actions[0] = action;
	bytes4 correctSelector = bytes4(keccak256("execute(SlippageAndActions,bytes[])"));
	console.logBytes4(correctSelector);
	bytes memory _calldata = abi.encodeWithSelector(correctSelector, saa, new bytes[](0));
	vm.expectRevert(bytes("IS"));
	ZeroXSwapVerifier.verifySwapCalldata(
		_calldata,
		owner,
		address(token),
		1000 // 1000 bps = 10% max slippage
	);
}

The original report as published on Immunefi, by SOPROBRO. 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

The contract's hard-coded bytes4 constants for the 0x Settler execute function and for action selectors such as transferFrom do not match the real function signatures.

Impact

The ZeroXSwapVerifier is completely non-functional, which the reporter says matters for atomic withdrawals from strategies, although the contract is not currently implemented.

What the attacker needed

None

The fix

The selector constants should be corrected to match the real 0x Settler execute and action function signatures.

How it was found

  1. Add the provided test to ZeroXSwapVerifier.t.sol.
  2. Run forge test with the test name testVerifyUniswapV3VIP_fails.
  3. Observe the test fail with the revert reason IS because the selector does not match.

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 function selector is a short four-byte code that tells a smart contract which function to run. This contract stored the wrong codes for the 0x swap functions it wanted to allow, so when it checked a swap it looked for a function that does not exist and refused the call. The verifier therefore could not approve any swap.

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 SOPROBRO

View all

4 more disclosed reports, best first.

More from Alchemix V3

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.