Open c4-submissions opened 1 year ago
minhquanym marked the issue as primary issue
minhquanym marked the issue as sufficient quality report
Consider QA
Agreed - this is a Low that we can flag up to borrowers deploying. Not interested in maintaining a token whitelist or blacklist, as it goes against the point that we don't intervene.
laurenceday marked the issue as disagree with severity
laurenceday (sponsor) acknowledged
MarioPoneder marked the issue as satisfactory
MarioPoneder marked issue #560 as primary and marked this issue as a duplicate of 560
stETH
to name a "central" example, are no novelty in the DeFi space anymore and users expect DeFi protocols to be compatible with them when no further notice is provided.MarioPoneder marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2023-10-wildcat/blob/main/src/market/WildcatMarket.sol#L56-L65
Vulnerability details
Bug Description
Some tokens (eg. AMPL), known as rebasing tokens, have dynamic balances. This means that the token balance of an address could increase or decrease over time.
However, markets in the protocol are unable to handle such changes in token balance. When lenders call
depositUpTo()
, the amount of assets they deposit is stored as a fixed amount inaccount.scaledBalance
:WildcatMarket.sol#L56-L65
Afterwards, when lenders want to withdraw their assets, the amount of assets that they can withdraw will be based off this value.
Therefore, since a lender's
scaledBalance
is fixed and does not change according to the underlying asset balance, lenders will lose funds if they deposit into a market with a rebasing token as the asset.For example, if AMPL is used as the market's asset, and AMPL rebases to increase the token balance of all its users, lenders in the market will still only be able to withdraw the original amount they deposited multiplied by the market's interest rate. The underlying increase in AMPL will not accrue to anyone, and is only accessible by the borrower by calling
borrow()
.Impact
If a market uses a rebasing tokens as its asset, lenders will lose funds when the asset token rebases.
Recommended Mitigation
Consider implementing a token blacklist in the protocol, such as in
WildcatArchController
, and adding all rebasing tokens to this blacklist.Additionally, consider documenting that markets are not compatible with rebasing tokens.
Assessed type
ERC20