The _mint() and _burn() functions in both RToken and DebtToken convert amount from uint256 to uint128 using .toUint128().
If amount > uint128.max, this causes a silent truncation, potentially leading to incorrect balance tracking.
This happens in ReserveLibrary#updateInterestRatesAndLiquidity(), where liquidityAdded and liquidityTaken are converted.
While such large values are unlikely in normal use, it's still a potential overflow risk that could impact high-value protocols.
Current _mint() and _burn() Implementation.
If amountToMint > uint128.max, it gets silently reduced, meaning:
User receives a lower balance than expected.
Supply tracking becomes inaccurate.
If a large institution deposits a massive amount (e.g., 2^130 units), the amount overflows, leading to incorrectly minted RTokens.
If a massive repayment occurs using DebtToken#burn(), the burned amount may be lower than expected, leaving debt under-accounted.
Actually, the mint() and burn() are defined as follows:
User lose funds in deposit and get profit in withdraw.
manual
Don't use conversion.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.