The RToken contract scales token amounts in both the transfer and transferFrom functions and again within the internal _update function. This double scaling causes transferred amounts to be incorrectly calculated, allowing users to end up with more tokens than intended, potentially compromising the token’s economic integrity.
transfer function:
Scales the amount using getNormalizedIncome().
transferFrom function:
Scales the amount using _liquidityIndex.
_update function:
Scales the amount again regardless of prior scaling in the transfer functions.
First scaling: Applied in transfer and transferFrom.
Second scaling: Reapplied in _update, leading to the amount being scaled twice.
Double scaling leads to token holders receiving disproportionately higher or lower token amounts depending on scaling factors.
Users can exploit this to inflate their token balances, draining protocol reserves.
Manual code review.
Ensure scaling is applied only once during transfers:
transfer and transferFromLet _update handle all scaling to maintain consistency:
_updateIf scaling should be handled in transfer functions, bypass scaling in _update:
By adopting one consistent scaling approach, the protocol prevents unintended inflation or deflation of token balances.
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.