Core Contracts

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

Incorrect obligations calculation on `claculateDustAmount()`

Vulnerability Details

At RToken::calculateDustAmount(), totalRealBalance calculation is wrong. This is because rayMul() is multiplied 2 times.

It should only be applied once.

Proof Of Concept

  • One of the mulDiv() is applied in the very same function here.

  • But the amount being multiplied comes from a totalSupply() call, which also multiplied, here is the call. And here is the totalsupply logic that also multiplies.

Impact

Incorrect dust calculations. Accounting some dust as obligations to the lenders.

This is because if there is some dust amount, it is calculated from the total supply times the liquidity index, and this is multiplied twice, thus calculating more obligations than the real ones.

Then the obligations are substracted in the return value of the function here. And here you can see that calculate dust amounts function is used when transferring the dust out.

Recommendations

Only apply rayMul() once on the totalRealBalance calculation.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RToken::calculateDustAmount incorrectly applies liquidity index, severely under-reporting dust amounts and permanently trapping crvUSD in contract

Support

FAQs

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

Give us feedback!