Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Invalid

`RToken` mints tokens without discounting interest

Vulnerability Details

At RToken::mint(), the token amount passed to _mint() is a normal token amount, this is not correct. It must be the scaled amount to properly account for interest.

For example when user does LendinPool::deposit() we see that the mint amount parameters is in token decimals, see deposit logic here, which calls reserve library here without altering the amount arg. Which will be just minted on RToken here.

Proof Of Concept

Why should it be the scaled amount? The AAVE book explains it pretty well, as RToken is a very similar re-creation to AAVE's aToken you can read here.

Summed up, when withdrawing the amount of balance of a user is multiplied by the current index, which accrues for all historical interest, yet we don't want that, we want to account only for the interest accrued since user deposited, thus when he deposits we discount the index by dividing it.

You can also check AAVE aToken code to see it should be the scaled amount, here. The contract just linked is inherited by aToken, see here.

Impact

Users are minted a higher amount than they should. This is just incorrect and would make all depositors to instantly accrue all interest since the beginning of the protocol.

Recommendations

You have to mint the scaledAmount. Which is already calculated a few lines above here.

Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

RToken::mint calculates balanceIncrease (interest accrued since last interaction) but never mints it, causing users to lose earned interest between deposits

The balanceIncrease is the interest that has already accrued on the user's existing scaledBalance since their last interaction. It's not something you mint as new tokens in the _mint function.

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

RToken::mint calculates balanceIncrease (interest accrued since last interaction) but never mints it, causing users to lose earned interest between deposits

The balanceIncrease is the interest that has already accrued on the user's existing scaledBalance since their last interaction. It's not something you mint as new tokens in the _mint function.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.