Incompatability with deflationary / fee-on-transfer tokens
The deposit function records the requested deposit amount rather than the actual tokens received, so for fee-on-transfer or deflationary tokens the recorded principal is higher than the real balance. This leads to incorrect interest calculations on the principal.
88mph
Originally disclosed on Code4rena
The DInterest.deposit function takes a depositAmount parameter but this parameter is not the actual transferred amount for fee-on-transfer / deflationary (or other rebasing) tokens.
The actual deposited amount might be lower than the specified depositAmount of the function parameter.
This would lead to wrong interest rate calculations on the principal.
Recommend transferring the tokens first and comparing pre-/after token balances to compute the actual deposited amount.
ZeframLou (88mph) acknowledged:
While this is true, we have no plans to support fee-on-transfer or rebasing tokens.
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 uses the user-supplied deposit amount instead of measuring the actual token balance change, so it does not account for transfer fees or rebasing.
Impact
Interest calculations on the principal could be wrong for fee-on-transfer or rebasing tokens, though the team stated it has no plans to support such tokens.
What the attacker needed
Fee-on-transfer or rebasing token used; deposit function called with such a token
The fix
The deposit function should transfer tokens first and compare the contract's balance before and after to determine the actual amount received.
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 assumes the full amount arrives and uses that number for later interest calculations, which makes the numbers wrong. The team said they do not plan to support such tokens.
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.