DFX Finance
DFX Finance did not handle fee-on-transfer tokens, so when such a token was swapped for USDC, the fee was paid by liquidity providers, gradually draining the pool. Also, USDC's upgradability could introduce similar issues if its behaviour changed.
beirao.xyz
Published on beirao.xyz
Smart contract auditors know this fact: unsupported Fee on Transfer (FoT) tokens are some of the simplest and most frequent bugs. On Code4Arena, you gain $1 for reporting this bug.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
Liquidity providers gradually lose funds when fee-on-transfer tokens are swapped, and the pool may become unbalanced and unusable; also, an upgrade to USDC could break the protocol for all curves.
What the attacker needed
A fee-on-transfer token is used in a curve; the token has a transfer fee
The fix
The protocol should check the actual amount received after transfers and use that for swaps and deposits, and consider freezing interactions if USDC is upgraded.
How it was found
- Create a custom fee-on-transfer token and a test file.
- Configure the token with a 10% transfer fee and an oracle ratio of 1:10.
- Perform a swap from the fee-on-transfer token to USDC and observe that the trader receives nearly the full expected USDC while the pool's token balance increases by less than the amount sent.
- Perform a swap back from USDC to the fee-on-transfer token and observe the pool's balances.
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 write-up has not been written yet. The Original tab links to the source.
Some tokens take a small fee when they are transferred, so the amount received is less than the amount sent. DFX's swap logic assumed the full amount arrived, which meant the pool's balance became incorrect and liquidity providers lost money over time. The report also warned that USDC can be upgraded to change its rules, which could break the system.
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.