Interest accrued could be zero for small decimal tokens #10
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
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
Lines of code
https://github.com/sublime-finance/sublime-v1/blob/46536a6d25df4264c1b217bd3232af30355dcb95/contracts/PooledCreditLine/PooledCreditLine.sol#L1215-L1221
Vulnerability details
Details & Impact
Interest is calculated as
It is possible for the calculated interest to be zero for principal tokens with small decimals, such as EURS (2 decimals). Accumulated interest can therefore be zero by borrowing / repaying tiny amounts frequently.
Proof of Concept
Assuming a borrow interest rate of 5% (
5e17
) and principal borrow amount of10_000
EURS (10_000 * 1e2 = 1_000_000
), the interest rate calculated would be 0 if principal updates are made every minute (around 63s).While plausible, this method of interest evasion isn’t as economical for tokens of larger decimals like USDC and USDT (6 decimals).
Recommended Mitigation Steps
Take caution when allowing an asset to be borrowed. Alternatively, scale the principal amount to precision (1e18) amounts.
The text was updated successfully, but these errors were encountered: