Deposits/borrows deviate from intended implementation #271
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
🤖_15_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/README.md#L243-L249
Vulnerability details
Proof of Concept
First, per the readMe, we can see the below has been stated: https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/README.md#L243-L249
General Questions
totalSupply
to be not at all close to 2^128, arbitrary mint/burn must not be possible, andname
,symbol
anddecimals
must all return valid results (for name and symbol, either bytes32 or a string). Creating markets for rebasing tokens breaks the underlying interest rate model.This means that the amount of assets that can be borrowed in a market should be up to
type(uint128).max
.However whenever a lender calls
depositUpTo()
to deposit assets, the asset amount is scaled up and added toscaledTotalSupply
which is limited totoUint104
, see https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/market/WildcatMarket.sol#L55-L92As stated earlier on, this means that the maximum amount of assets that can be borrowed through a market is implicitly limited by
type(uint104).max * scaleFactor / 1e27
.When a market is first deployed, its
scaleFactor
is1e27
, which limits the maximum amount borrowable totype(uint104).max
contrary to what's been stated in the docs.Impact
Borrows can't be more than
type(uint104).max
assets.Recommended Mitigation Steps
Increase the precision of
scaleFactor
touint128
instead. Alternatively, if this is intended then update the docs.Assessed type
Context
The text was updated successfully, but these errors were encountered: