Skip to content
Business logic Audit finding Intermediate

Balances of rebasing tokens aren't properly tracked

The protocol does not properly track balance changes for rebasing tokens while they are held in a borrower's account. As a result, the lender may miss out on gains such as airdrops that should have accrued to them.

Lambda Follow with JohnSmith, PwnPatrol and 4 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-08-sentiment-judging/tree/main/035-M

Found by

Lambda, JohnSmith, PwnPatrol, IllIllI, xiaoming90, ellahi, bytehat

Summary

Rebasing tokens are tokens where balanceOf() returns larger amounts over time, due to the addition of interest to each account, or due to airdrops

Vulnerability Detail

Sentiment doesn't properly track balance changes while rebasing tokens are in the borrower's account

Impact

The lender will miss out on gains that should have accrued to them while the asset was lent out. While market-based price corrections may be able to handle interest that is accrued to everyone, market approaches won't work when only subsets of token addresses are given rewards, e.g. an airdrop based on a snapshot of activity that happened prior to the token being lent.

Code Snippet

Lending tracks shares of the LToken: https://github.com/sherlock-audit/2022-08-sentiment/blob/main/protocol/src/tokens/LToken.sol#L140-L143

But repayment assumes that shares are equal to the same amount, regardless of which address held them, which is not true for airdrops: https://github.com/sherlock-audit/2022-08-sentiment/blob/main/protocol/src/tokens/LToken.sol#L160-L163

Rebasing tokens are supported, since Aave is a rebasing token: https://github.com/sherlock-audit/2022-08-sentiment/blob/main/controller/src/aave/AaveEthController.sol#L28

Tool used

Manual Review

Recommendation

Adjust share amounts when the account balance doesn't match the share conversion calculation when taking into account gains made by the borrower

Sentiment Team

We'll make sure to not interact with fee-on-transfer tokens. This can be ensured by the admins.

Lead Senior Watson

Note: The admins should not add rebasing/fee-on-transfer tokens to any allowed lists.

The original report as published on Sherlock, by Lambda. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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 assumes that a token share always equals a fixed amount, ignoring that rebasing tokens can change balances without changing shares.

Impact

The lender could miss out on gains that should have accrued to them while the asset was lent out, especially for airdrops that reward only specific addresses.

What the attacker needed

Rebasing token is supported; token is lent out

The fix

The protocol should adjust share amounts when the account balance does not match the share conversion calculation, or avoid supporting 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 tokens automatically increase everyone's balance over time, for example by paying interest or giving out free tokens (airdrops). This protocol lends such tokens but does not update the lender's share when the borrower's balance grows, so the lender loses out on those extra 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.

More by Lambda

View all

64 more disclosed reports, best first.

More from Sentiment Update #3

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.