We manage your security to weather the AI storm →

← Resource Hub

Arbitrary Call Vulnerability in Swap Routers

By Daniel GelfandPublished 5 min read

Part of our guide to smart contract vulnerabilities

Arbitrary Call Vulnerability in Swap Routers

Quick answer. An arbitrary call vulnerability arises when a router fails to check that a call matches the owner’s authorized trade. The token still recognizes the router as the approved spender, so an attacker can draw on the allowance without the owner signing again.

Watch: Arbitrary Call Vulnerability in Swap Routers 1:27
Video transcript

A swap router can move funds without a new wallet signature if it fails to check what the owner authorized for that trade.

When the router calls the token contract, the token sees the router as the approved spender. It cannot tell which trade the wallet owner agreed to.

The Socket and Li Fi incidents affected wallets that had already approved their contracts. Matcha Meta said users affected by the SwapNet incident had approved SwapNet directly.

A finite approval limits how much the router can move, but a partial fill can leave some allowance behind. Even an empty token balance does not erase it.

Give standing approvals to a spender that checks the trade and releases only the input it needs. Keep flexible routing in a separate executor with no standing wallet approvals.

Verify who pays, which token they spend, how much can be taken, and who gets the output. Enforce the cap across the batch and authenticate callbacks against the expected caller and active trade.

Test that one user's trade leaves another approved wallet's balance and allowance unchanged. Before enabling new routes, confirm the deployed code and configuration match what you reviewed.

Read the full guide for more release checks, or talk to Guardian about including spender contracts, adapters, and callback paths in your audit.

How the Call Works

An ERC-20 approval gives a spender address permission to move a particular token from the owner’s wallet. It does not move the tokens upfront.[1]

The token tracks how much the spender can still move. The allowance says nothing about which swap the owner intended or where the output should go.

With an ordinary external CALL, the contract receiving the call sees the router as the immediate caller. This is why the router’s identity matters.[2, 3]

If the router forwards instructions without enforcing the trade’s terms, that call can carry spending authority the requester does not have on their own.

This is a spending authorization failure and does not require reentrancy. Our external call guide covers reentrancy, gas griefing and return data.

DELEGATECALL is different. It runs another contract’s code in the router’s address and storage context, preserving the message sender and value of the current call.

Three Router Approval Exploits

Socket (January 16, 2024): A new swap route in SocketGateway did not fully validate its inputs. The losses came from wallets that had approved the gateway on Ethereum.[4, 5]

Socket said wallets with unlimited approvals were affected. Revoke.cash puts the gross theft at about $3.3 million.

Socket disabled the route and announced on January 17 that bridging had resumed on Bungee and most partner frontends.

On January 23, Socket announced the recovery of 1,032 ETH.[6]

LI.FI (July 16, 2024): A newly deployed facet, or contract module, omitted the destination and function checks used by other facets.[7, 8]

LI.FI’s July 18 report estimated about $11.6 million stolen from 153 wallets on Ethereum and Arbitrum. It said only unlimited approvals were affected.

LI.FI reported disabling the facet across all chains. Users had approved the existing LI.FI contract, not the facet.[1]

SwapNet (January 25, 2026): The attack began on Base. Matcha Meta’s postmortem, updated January 29, reports $13.43 million in losses across 18 users.[9, 10]

Affected Matcha Meta users had opted out of the default One-Time Approval flow and approved SwapNet directly. Matcha Meta said users who kept the default were unaffected by this incident.[11]

CertiK’s post-incident assessment attributed the theft to an arbitrary call in SwapNet.

SwapNet paused its contracts on Base, then on other chains. Matcha Meta removed SwapNet from routing and disabled the option to turn off One-Time Approval.

Why Approvals Amplify Losses

A router can have little or no inventory of its own and still have permission over tokens in many wallets. Its holdings alone cannot show the exposure.[1, 2]

For a standard token, the remaining allowance and the wallet’s available balance bound what the spender can move. Unlimited approvals remove the meaningful amount cap.[12]

A finite approval limits the amount but does not make it single use. A partial fill can leave a remainder, and a canceled trade can leave the approval untouched.

Matcha Meta warned that unused exact approvals granted directly to SwapNet were also exposed. The reported tally does not say whether those approvals accounted for any losses.[10, 13]

In Matcha Meta’s product documentation, One-Time Approval means approving a shared contract rather than each aggregator. The name does not tell you when the wallet’s underlying allowance ends.[14]

An empty token balance does not erase an allowance. Any remaining allowance can apply when the wallet receives more of the same token.

Keep Spending Under Control

Put standing wallet approvals on a narrowly scoped spender. Give it one job: verify the user’s trade authorization and release only the input that trade needs.

Keep flexible routing in a separate executor. Give it no standing wallet approvals, no persistent token inventory and no authority over unrelated funds.

Prefer adapters with explicit operations over forwarding opaque instructions. Where execution stays flexible, check the actual destination, permitted operation and arguments onchain.

Bind the payer, input token, maximum debit and output recipient to the user’s trade. Treat the route returned by a quote service as input, not authorization.

If a relayer submits a trade, verify the payer’s authorization separately from the identity of the transaction sender.

A minimum output sets a floor on what the trade must deliver. It does not establish whose wallet should pay or who gets the output.

Authenticate swap callbacks against both the expected caller and the active trade. Clear the active trade context when execution finishes.

Apply the same spending policy at every entry point. In a batch or multi-hop trade, enforce the debit cap across all steps, not separately at each step.

Return any unspent input to the authorized refund recipient. Keep the executor’s temporary trade funds separate from balances belonging to other users.

Test the Deployed Router

In your tests, both users approve the router, but only one authorizes the trade. Assert that the other user’s input-token balance and allowance do not decrease.

Check the trader’s total debit, output recipient and refund recipient across direct, batched and callback-based routes.

An allowance follows the spender address, not its code version. Adding a facet behind that address does not reset permissions users granted before the change.[1, 8]

Treat route additions, adapter upgrades and allowlist changes as changes to spending authority. Compare deployed code and router configuration with the reviewed release before enabling new routes.

Pausing a spender or removing a route from the interface does not reset allowances on token contracts. Track containment and permission cleanup separately.[12]

Put networks, spender addresses and affected tokens in your response plan. Give users that information when they need to check and revoke old approvals.

Guardian’s AMM and DEX audit covers standing approvals and callback caller checks in routers and multi-hop swaps.

  • List the approval target per network and integration mode in your deployment manifest.
  • Include failed settlements and partial fills in your release tests.
  • Confirm that the pause covers every deployed entry point you expect it to stop.
  • Keep a record of retired spender addresses for future user notices.

Review What Your Router Can Spend

If users give your router standing approvals, include the spender contracts, adapters and callback paths in the scope of a Guardian AMM and DEX audit.

Frequently Asked Questions

Does an ERC-2612 permit deadline expire the allowance?

No. The deadline limits when the signed permit can be submitted. Once the permit succeeds, it sets an ERC-20 allowance. That allowance can outlast the deadline on the signature.[1, 15]

Is the swap entry point always the spender?

No. In 0x Swap API v2, AllowanceHolder serves both roles in AllowanceHolder mode. In Permit2 mode, Permit2 receives the approval and Settler is the entry point. Use the allowance target identified by the API. Do not approve Settler.[16]

How do I verify that a revocation worked?

After the revocation confirms, check the remaining allowance on the token contract for your wallet and that spender on the relevant network. It should read zero for that pair.[1, 12]

Sources

  1. Ethereum Improvement Proposals: ERC-20: Token Standard
  2. Solidity: Solidity Security Considerations: Authorized Proxies
  3. Solidity: Introduction to Smart Contracts: Delegatecall and Libraries
  4. Revoke.cash: 2024 Socket Hack: Check If You're Affected
  5. crypto.news: Socket Cross-Chain Protocol Breached, $3.3M in Funds Stolen
  6. crypto.news: Socket Recovered 1,032 ETH Following Bridge Protocol Exploit
  7. LI.FI: Security Incident Report 16th July
  8. Ethereum Improvement Proposals: ERC-2535: Diamonds, Multi-Facet Proxy
  9. Revoke.cash: 2026 SwapNet Hack: Check If You're Affected
  10. HARD: SwapNet exploit steals US$13.43 million from 18 Matcha Meta users
  11. Cointelegraph: SwapNet Exploit Drains Up to $13.3M From Matcha Meta Users
  12. Ethereum.org: How to Revoke Smart Contract Access to Your Crypto Funds
  13. Cointribune: Token Approvals: They Stay Active Until You Revoke Them
  14. Matcha Meta: What Is Matcha Meta?
  15. Ethereum Improvement Proposals: ERC-2612: Permit Extension for EIP-20 Signed Approvals
  16. 0x: 0x Contracts: Settler, AllowanceHolder and Permit2
  17. ChainCatcher: Socket: Will Provide 100% Compensation to Affected Users of the Bungee Hack
  18. ChainCatcher: LI.FI: Has Launched a Voluntary Compensation Program
  19. LI.FI: LI.FI Update: July 2024
  20. Cryptonews: LiFi Protocol Releases Post-Mortem Report on Recent $11.6 Million Hack
  21. New York State Law Reporting Bureau: Kaplan v Circle Internet Group Inc., 2026 NY Slip Op 26202
  22. ChainCatcher: Matcha Meta: The SwapNet Security Incident Does Not Involve the 0x Core Contract
  23. Web3 is Going Just Great: $13.43 Million Stolen From Matcha Meta Users in SwapNet Exploit
  24. DL News: Hacker Swipes $13.5M From Matcha Meta Users as Protocol Reports Security Incident
  25. Yellow.com: SwapNet Loses $13.43M In Smart Contract Exploit
  26. AVOID.NET: Matcha Meta Investigation: Archive Metadata