Skip to content
Business logic Audit finding Intermediate

Fee on transfer tokens do not work within the protocol

The protocol assumes that token transfers always deliver the full amount, but fee-on-transfer tokens deduct a fee, so the protocol's internal accounting becomes incorrect. An attacker could exploit this to cause the protocol to misaccount balances, potentially leading to loss of funds or incorrect share calculations.

anon Follow

Originally disclosed on Code4rena

Submitted by anon.

Fee on transfer tokens transfer less tokens in than what would be expect. This means that the protocol request incorrect amounts when dealing with these tokens.

https://github.com/code-423n4/2021-10-defiprotocol/blob/7ca848f2779e2e64ed0b4756c02f0137ecd73e50/contracts/contracts/Basket.sol#L256

The protocol should use stored token balances instead of transfer for calculating amounts.

frank-beard (Kuiper) acknowledged

Alex the Entreprenerd (judge) commented:

I agree with the finding and the severity. Given a feeOnTransferToken, the accounting of the protocol will break.

because this is dependent on an external condition (using feeOnTransferToken) this is a medium severity finding

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

Likely the protocol calculates token amounts based on the transfer amount rather than checking the actual balance change, so it does not account for transfer fees.

Impact

The protocol's accounting could become incorrect when fee-on-transfer tokens are used, potentially leading to loss of funds or incorrect share calculations.

What the attacker needed

Fee-on-transfer token used

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 protocol assumes the full amount arrives, so its records of how many tokens it holds become wrong. That could let someone take more than they should or break the system's balance tracking.

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 anon

View all

10 more disclosed reports, best first.

More from Kuiper 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.