Skip to content
Business logic Audit finding Intermediate

Rebasing tokens go to the pool owner, or remain locked in the various contracts

The contracts assume token balances stay constant, so when rebasing tokens increase in value, the extra rewards go to the pool owner or become locked. Users therefore miss out on rewards they expected to receive.

IllIllI Follow

Originally disclosed on Code4rena

Submitted by IllIllI

Rebasing tokens are tokens that have each holder’s balanceof() increase over time. Aave aTokens are an example of such tokens.

Impact

Users expect that when they deposit tokens to a pool, that they get back all rewards earned, not just a flat rate. With the contracts of this project, deposited tokens will grow in value, but the value in excess of the pre-calculated getMaximumRewards()/deposited amounts go solely to the owner/creator, or will remain locked in the contract

Proof of Concept

In the case of pools, the owner can withdraw the excess rebasing reward tokens by calling withdrawExcessRewards(), but is unable to withdraw excess deposited rebasing tokens. The Merkle-tree-related contracts have no way to withdraw any excess rebasing tokens.

All parts of the code assume that the value stated is the balance that is available to withdraw. It stores the values…

(Note: see submission for full Proof of Concept)

Recommended Mitigation Steps

Provide a function for the pool owner to withdraw excess deposited tokens and repay any associated taxes. In the case of the Merkle trees though, pro rata share amounts need to be calculated and tracked and updated with every withdrawal, which will require drastic changes to the code, making it much more expensive.

illuzen (FactoryDAO) acknowledged, disagreed with severity and commented:

Valid, but i think we will just not support rebasing tokens

illuzen (FactoryDAO) resolved:

https://github.com/code-423n4/2022-05-factorydao/pull/3

Justin Goro (judge) commented:

Severity maintained.

0xleastwood (warden) commented:

Not supporting rebasing tokens is equivalent to not supporting fee-on-transfer tokens. Maybe we could group all non-standard ERC20 issues together?

IllIllI000 (warden) commented:

They are slightly different: Fee-on-transfer tokens cause things to revert which will either prevent the token from being used, or will cause deposited funds to be locked. With rebasing tokens, a user misses out on new rewards, rather than losing deposited capital

ksk2345 (warden) commented:

If a sponsor mentions that they will not be supporting rebase tokens, then its judged as invalid. Refer : https://github.com/code-423n4/2022-04-backed-findings/issues/105 I think we need a general consensus in C4 org rulebook how to treat this token and having some consistent judgement.

Justin Goro (judge) commented:

The sponsor acknowledged the validity and referenced this in a PR so it’s sitting somewhere between acknowledged and confirmed. In other words, the sponsor is not averse to lending a helping hand to rebase tokens but will not explicitly encourage the use of them. This is similar to how a standard CFMM allows for rebase tokens to exist and function but not without side effects, similar to the PR which does not close all holes against rebase tokens.


The original report as published on Code4rena, by IllIllI. 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 contracts store fixed deposit amounts and do not track or distribute the extra balance that rebasing tokens generate.

Impact

Users lose the additional rewards from rebasing tokens; the excess goes to the pool owner or remains locked, and the project later chose not to support such tokens.

What the attacker needed

Rebasing tokens are used; pool or Merkle-tree contracts involved

The fix

The project resolved this by deciding not to support rebasing tokens, as shown in the linked pull request.

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 automatically increase each holder's balance over time, like a savings account that pays interest. This project's code assumes balances never change, so when they do, the extra tokens are not given to users but are kept by the owner or stuck in the contract.

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 IllIllI

View all

119 more disclosed reports, best first.

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