Open c4-bot-5 opened 7 months ago
kalinbas (sponsor) confirmed
After referring to the original issue https://github.com/code-423n4/2024-03-revert-lend-findings/issues/324 , I am more inclined to label it as unmitigated rather than a mitigation error, therefore I am changing this issue to unmitigated.
Because their root causes are similar.
jhsagd76 marked the issue as unmitigated
Pls add the MR-M-12
label.
jhsagd76 marked the issue as satisfactory
Label added at request of judge.
Lines of code
https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol#L961
Vulnerability details
Vulnerability details
V3Vault
applies a global limit on the total amount of assets that can be deposited for borrowing. This limit is enforced through theglobalLendLimit
state variable, set by the contract owner.This is how the limit is applied in the
_deposit()
function:https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol#L961-L962
If you look closely you can see that
globalLendLimit
is compared against the total shares. This is wrong sinceglobalLendLimit
is measured in terms of assets, not shares. This can be further validated by looking at themaxDeposit()
&maxMint()
functions:https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol#L322
https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol#L306
In time as loan fees accrue the shares to assets ratio will increase, which means that fewer shares would equal greater amount of assets. As a result the global limit will be evaluated against a smaller amount (shares) than it actually should (assets)
Impact
Comparing global debt limit against shares leads to more assets being deposited for borrowing than it should be allowed, breaking important protocol invariant.
Recommended Mitigation
Compare the global lend limit in
_deposit
against the assets, not the shares:Assessed type
Invalid Validation