Skip to content
Business logic Audit finding Intermediate

Can deposit native token for free and steal funds

The depositErc20 function allowed the native token address to be used as an ERC20 token, and because the native token address is an externally owned account, the safeTransferFrom call succeeded without transferring any funds. An attacker could deposit infinite native tokens for free and receive real native funds on the destination chain.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel, also found by CertoraInc

LiquidityPool.sol#L151

The depositErc20 function allows setting tokenAddress = NATIVE and does not throw an error. No matter the amount chosen, the SafeERC20Upgradeable.safeTransferFrom(IERC20Upgradeable(tokenAddress), sender, address(this), amount); call will not revert because it performs a low-level call to NATIVE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, which is an EOA, and the low-level calls to EOAs always succeed. Because the safe* version is used, the EOA not returning any data does not revert either.

This allows an attacker to deposit infinite native tokens by not paying anything. The contract will emit the same Deposit event as a real depositNative call and the attacker receives the native funds on the other chain.

Recommended Mitigation Steps

Check tokenAddress != NATIVE in depositErc20.

ankurdubey521 (Biconomy) confirmed and commented:

HP-25: C4 Audit Fixes, Dynamic Fee Changes bcnmy/hyphen-contract#42

pauliax (judge) commented:

Great find, definitely deserves a severity of high.


The original report as published on Code4rena, by cmichel. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 depositErc20 function did not reject the native token address, and the safeTransferFrom call to that address (an EOA) always succeeds without transferring funds.

What the attacker needed

None

The fix

The depositErc20 function should check that tokenAddress is not the native token address.

How it was found

  1. Call depositErc20 with tokenAddress set to the native token address and any amount.
  2. The safeTransferFrom call to the native token address succeeds without transferring funds.
  3. The contract emits a Deposit event as if a real deposit occurred.
  4. The attacker receives native funds on the other chain.

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 smart contract let people deposit a special 'native token' address as if it were a regular token. But that address is just a normal account, so the transfer check always passed without moving any money. The attacker could pretend to deposit tokens and get real funds on another chain.

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 cmichel

View all

196 more disclosed reports, best first.

More from Biconomy - Smart Contract Wallet contest

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.