Skip to content
Business logic Audit finding Intermediate

Deposits don’t work with fee-on transfer tokens

The commit function records the full amount of a deposit, but fee-on-transfer tokens cause fewer tokens to actually arrive, creating an inconsistency between the recorded commitment and the pool's actual balance. An attacker could exploit this to extract value from the protocol.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel.

There are ERC20 tokens that may make certain customizations to their ERC20 contracts. One type of these tokens is deflationary tokens that charge a certain fee for every transfer() or transferFrom(). Others are rebasing tokens that increase in value over time like Aave’s aTokens (balanceOf changes over time).

Impact

The PoolCommiter.commit() function will store the entire amount in the commitment but with fee-on-transfer tokens, fewer tokens will be transferred which leads to inconsistencies with the pool.longBalance() and in uncommit.

Recommended Mitigation Steps

One possible mitigation is to measure the asset change right before and after the asset-transferring routines

rogue developer (Tracer) disputed:

Only governance (a multisig) can deploy markets, and has complete say over what markets can be deployed (see the onlyGov modifier in PoolFactory.sol#deployPool). Because new markets being deployed would be done via proposal to the DAO, which include the collateral token being used in a proposed market, markets with fee-on transfer tokens like Aave’s aTokens just won’t be deployed. I think this is a fairly safe assumption to make and thus we’re making it out of scope. In any case, the chances of this happening and slipping past everyone who votes in the proposals and not being noticed extremely soon after a market is deployed are extremely low.

Alex the Entreprenerd (judge) commented:

I think this is a valid finding, the warden has shown a way to tamper with the protocol, extracting value (as such medium severity)

In terms of mitigation, not using feeOnTransfer or rebasing tokens is completely legitimate.

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

Likely the deposit logic assumes the full amount is transferred without accounting for tokens that deduct a fee on transfer.

Impact

An attacker could tamper with the protocol and extract value, though the project argued that only governance-approved tokens are used and such tokens would not be deployed.

What the attacker needed

A fee-on-transfer token is used as collateral; governance approves such a token

The fix

The recommended mitigation is to measure the actual asset change before and after transfers, or to avoid using fee-on-transfer or rebasing tokens.

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 digital tokens take a small fee when they are sent, so the receiver gets less than the sender intended. This report says that a deposit function recorded the full amount even though fewer tokens arrived, which could let someone take advantage of the mismatch. The project argued that such tokens would never be used, but the judge still considered it a valid issue.

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 Tracer 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.