Skip to content
Business logic Audit finding Intermediate

Bonding doesn’t work with fee-on transfer tokens

The bonding contract assumes that the full amount of a fee-on-transfer token is received, so the balance check fails and the transaction reverts. An attacker could not exploit this to steal funds, but it prevents bonding with such tokens.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

Certain ERC20 tokens make modifications to their ERC20’s transfer or balanceOf functions. One type of these tokens is deflationary tokens that charge a certain fee for every transfer() or transferFrom().

Impact

The Bonding._bond() function will revert in the _balanceCheck when transferring a fee-on-transfer token as it assumes the entire amount was received.

Recommended Mitigation Steps

To support fee-on-transfer tokens, measure the asset change right before and after the asset-transferring calls and use the difference as the actual bonded amount.

0xScotch (sponsor) confirmed

Alex the Entreprenerd (judge) commented:

Agree with the finding, the check will revert on a token that takes fees as the system assumes that amount is the amount that will be received

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 contract assumes that the transferred amount equals the received amount, without measuring the actual balance change.

Impact

Bonding with fee-on-transfer tokens is impossible because the transaction reverts; no theft or loss of funds is described.

What the attacker needed

Fee-on-transfer token

The fix

The contract should measure the balance before and after the transfer and use the difference as the actual bonded amount.

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.

Some tokens take a small fee when they are transferred, so the receiver gets less than the sender sent. This contract checks that the full amount arrived, so the check fails and the whole bonding attempt is cancelled. It is a compatibility bug, not a way to steal money.

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 Malt Protocol - Versus 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.