transferFrom
function in RToken contract is defined as follows:
The problem is that _liquidityIndex
for scaling is incorrect, given that this variable's value is set to RAY
in constructor, and cannot be modified after that. This means dividing by _liquidityIndex
using rayDiv
won't apply any scaling.
If the contract is deployed as it is right now, there are no consequence given that _update
function applies the scaling:
But this means that if _liquidityIndex
indeed returns the right index, we will have a double division scaling which will ultimately lead to less funds actually being transferred than expected, leading to incorrect assumptions especially in case of integration of the RAAC protocol with other protocols.
The impact of this vulnerability can be considered as medium.
Manual review
Ensure that only one division scaling is applied:
Use lending pool getNormalizedIncome
call like in transfer
function (supposing that this function is correctly implemented) to effectively get the scaled amount to transfer, and remove the scaling in _update
function.
Or remove scaling in transfer
and transferFrom
functions and only apply the scaling in _update
function (probably the better option.
Note that currently, getNormalizedIncome
in LendingPool contract is also wrongly implemented, returns the non normalised liquidity index (index at last update). This is another issue.
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.