Skip to content
DoS Audit finding Intermediate

Some ERC20 can revert on a zero value transfer

Some ERC20 tokens revert when a zero-value transfer is attempted, and the contract calls safeTransfer or safeTransferFrom without checking for a zero amount. An attacker could cause transactions to revert by triggering a zero-value transfer, potentially blocking liquidations or other operations.

DadeKuma Follow

Originally disclosed on Code4rena

Submitted by DadeKuma

Note: This finding was reported via the winning Automated Findings report. It was declared out of scope for the audit, but is being included here for completeness.

728, 946, 226, 272, 88, 91, 872, 85, 98, 167

Vulnerability details

Not all ERC20 implementations are totally compliant, and some (e.g. LEND) may fail while transferring a zero amount.

File: src/V3Vault.sol

728: 		            SafeERC20.safeTransferFrom(IERC20(asset), msg.sender, address(this), state.liquidatorCost);

946: 		        SafeERC20.safeTransfer(IERC20(asset), receiver, assets);
File: src/automators/Automator.sol

226: 		            SafeERC20.safeTransfer(token, to, amount);
File: src/transformers/AutoCompound.sol

272: 		        SafeERC20.safeTransfer(IERC20(token), to, amount);
File: src/transformers/LeverageTransformer.sol

88: 		            SafeERC20.safeTransfer(IERC20(token0), params.recipient, amount0 - added0);

91: 		            SafeERC20.safeTransfer(IERC20(token1), params.recipient, amount1 - added1);
File: src/transformers/V3Utils.sol

872: 		            SafeERC20.safeTransfer(token, to, amount);
File: src/utils/FlashloanLiquidator.sol

85: 		        SafeERC20.safeTransfer(data.asset, msg.sender, data.liquidationCost + (fee0 + fee1));
File: src/utils/Swapper.sol

98: 		                SafeERC20.safeTransfer(params.tokenIn, universalRouter, params.amountIn);

167: 		        SafeERC20.safeTransfer(IERC20(tokenIn), msg.sender, amountToPay);

kalinbas (Revert) confirmed

Revert mitigated:

Fixed here.

Status: Mitigation Confirmed. Full details in reports from thank_you, b0g0 and ktg.


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

Impact

Transactions that involve a zero-value transfer with a non-compliant token could revert, potentially blocking liquidations or other contract functions.

What the attacker needed

A non-compliant ERC20 token that reverts on zero transfer; a zero-value transfer occurs in the contract

The fix

The issue was fixed by adding checks to avoid zero-value transfers, as indicated by the mitigation link.

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.

ERC20 tokens are a standard for cryptocurrencies on Ethereum, but not all follow the rules perfectly. Some tokens will reject a transfer of zero tokens, which normally should be allowed. If a smart contract tries to send zero tokens to such a token, the whole transaction fails, which could stop important actions like liquidations.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by DadeKuma

View all

19 more disclosed reports, best first.

More from Revert Lend

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.