Core Contracts

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

DebtToken::totalSupply returns incorrect value

Vulnerability Details

super.totalSupply() function returns scaledSupply, the external totalSupply function is supposed to return actual amount by multiplying this scaledSupply to usageIndex but instead it is dividing by it, reducing the value further.

Impact

This totalSupply is used inside the LendingPool when borrowing or repaying to calculate reserve.totalUsage. This totalUsage is used to calculate liquidity and utitlizationRate in ReserveLibrary, and these are critical variables so wrong value of totalSupply will cause a lot of damage.

Tools Used

Manual Review

Recommendations

return scaledSupply.rayDiv(ILendingPool(_reservePool).getNormalizedDebt()); // replace this with the below line
return scaledSupply.rayMul(ILendingPool(_reservePool).getNormalizedDebt());
Updates

Lead Judging Commences

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

DebtToken::totalSupply incorrectly uses rayDiv instead of rayMul, severely under-reporting total debt and causing lending protocol accounting errors

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

DebtToken::totalSupply incorrectly uses rayDiv instead of rayMul, severely under-reporting total debt and causing lending protocol accounting errors

Support

FAQs

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

Give us feedback!