balanceIncrease
is miscalculated due to an extra multiplication by index
.
DebtToken.sol
in function mint
: https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/tokens/DebtToken.sol#L136
so to calculate balanceIncrese
it substruct a scaledBalance * userIndex
from scaledBalance * index
but scaledBalance
is already multipled by index
because it was taken from balanceOf()
.
so what the function do is :
(scaledBalance×index×index)−(scaledBalance×index×oldIndex)
Which results in double multiplication by index
, and minting more tokens and the user will pay debt
Root Cause
balanceOf(onBehalfOf)
already includes a multiplication by index
.
Multiplying again results in an overestimated balanceIncrease
.
Over-minting of tokens
Incorrect user balances
Manual Review
use super.balanceOf()
, instead of balanceOf()
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.