Missing addresses verification in zeroxswapverifier
The ZeroXSwapVerifier library does not check the owner or recipient fields inside 0x swap calldata before the strategy executes it. An operator or user supplying that calldata could set the recipient to their own address so the swapped funds go to them instead of the vault.
Originally disclosed on Immunefi
- Disclosed after under an hour
58289 sc low missing addresses verification in zeroxswapverifier
Submitted on Nov 1st 2025 at 00:52:00 UTC by @nem0thefinder for Audit Comp | Alchemix V3
- Report ID: #58289
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi\\_audit/src/utils/ZeroXSwapVerifier.sol
- Impacts:
- Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Summary
The ZeroXSwapVerifier library fails to validate the recipient and ownerin 0x swap calldata, allowing operator or attackers to redirect swapped funds to arbitrary addresses during atomic deallocations.
Description
When the vault executes atomic deallocations or force atomic deallocations, it relies on ZeroXSwapVerifier to validate 0x API calldata before execution. The verifier currently checks:
- Sell token matches expected token
- Slippage is within bounds
- Action types are permitted
However, it doesn't verify owner is the legit owner or the recipient field in the SlippageAndActions struct, which specifies where the swapped tokens are sent.
In the atomic deallocation flow:
- Allocator or user (via force deallocate ) provides 0x calldata
- Strategy calls
ZeroXSwapVerifier.verifySwapCalldata() - Strategy executes the calldata via 0xSettler
- 0xSettler automatically sends output tokens to
saa.recipient
Without recipient and owner validation, an user or operator can set recipient to their own address, causing the 0xSettler to send all swapped funds to the beneficiary address instead of the strategy or vault.
function _verifyExecuteCalldata(bytes calldata data, address owner, ...) internal view {
(SlippageAndActions memory saa,) = abi.decode(data, (SlippageAndActions, bytes));
// Missing: owner and recepient checks
_verifyActions(saa.actions, owner, targetToken, maxSlippageBps);
}
function _verifyExecuteMetaTxnCalldata(bytes calldata data, address owner, ...) internal view {
(SlippageAndActions memory saa,,,) = abi.decode(data, (SlippageAndActions, bytes[], address, bytes));
// Missing: owner and recepient checks
_verifyActions(saa.actions, owner, targetToken, maxSlippageBps);
}
Impact
- Direct Fund Theft: User can set his address as
recepientin the calldata when he is calling force deallocate or malicous operator can do the same on nomral atomic dellocation. - Trust assumption violation: The verifier's entire purpose is to validate untrusted calldata; without
recipientandownerchecks it fails this core objective
Mitigation
- Add
recipientvalidation andownerin both verification functions_verifyExecuteCalldataand_verifyExecuteMetaTxnCalldata
Proof of Concept
Proof of Concept
Note! the following steps applied to
ZeroxSwapVerifier.t.sol
1.Paste the following test
function test_verifier_not_check_recepientAndOwner_are_legit () public {
address legitRecepient = makeAddr("Vault");
address legitOwner = owner;
console.log("Legit owner address: ", legitOwner);
console.log("Legit recepient address: ", legitRecepient);
console.log("Spender address (not legit): ", spender);
console.log("Owner address (not legit): ", spender);
bytes memory _calldata = _buildBasicSellToPoolCalldata(token, spender, 500);
console.log("Calldata built with spender as recepient");
console.log("verifying calldata...");
bool verified = ZeroXSwapVerifier.verifySwapCalldata(
_calldata,
spender,
address(token),
1000
);
assertTrue(verified);
console.log("Calldata verified successfully");
console.log("Calldata is verified even if sender is not legit owner or recepient");
console.log("Verifer does not check that owner and recepient are legit");
}
2.Run it via `forge test --mc ZeroXSwapVerifierTest --mt test_verifier_not_check_recepientAndOwner_are_legit -vvv
`
Logs
Logs:
Legit owner address: 0x0000000000000000000000000000000000000001
Legit recepient address: 0xA79237e8Ddb8dDa413a7231b6F5ad09c383d5993
Spender address (not legit): 0x0000000000000000000000000000000000000002
Owner address (not legit): 0x0000000000000000000000000000000000000002
Calldata built with spender as recepient
verifying calldata...
Calldata verified successfully
Calldata is verified even if sender is not legit owner or recepient
Verifer does not check that owner and recepient are legit
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 verifier decodes the swap calldata but only checks the sell token, slippage and action types, omitting any comparison of the owner and recipient fields against the expected strategy or vault addresses.
Impact
A user calling force deallocate, or a malicious operator during a normal atomic deallocation, could redirect the swapped output tokens to their own address, resulting in direct theft of funds.
What the attacker needed
Ability to supply 0x calldata; operator role or force deallocate access
The fix
The verifier should validate the recipient and owner fields in both verification functions before accepting the calldata.
How it was found
- Build swap calldata where the recipient is an address that is not the legitimate vault.
- Call the verifier with that calldata and the non-legitimate address as owner.
- Observe that the verifier returns true, showing the owner and recipient were never checked.
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 vault swaps one token for another by handing instructions to an outside exchange service. A checker is meant to inspect those instructions first, but it never looks at who should receive the swapped tokens. So whoever writes the instructions can name themselves as the receiver and take the money.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.