Platform: Code4rena
Start Date: 04/03/2024
Pot Size: $88,500 USDC
Total HM: 31
Participants: 105
Period: 11 days
Judge: ronnyx2017
Total Solo HM: 7
Id: 342
League: ETH
Rank: 55/105
Findings: 1
Award: $92.11
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Aymen0909
Also found by: KupiaSec, Topmark, befree3x, kennedy1030, linmiaomiao, pynschon
92.1136 USDC - $92.11
V3Vault::_deposit
use a wrong condition to check for the Global Lend LimitVulnerability Details
In the V3Vault::_deposit
function, the following condition is used to check if the total supply of the Vault does not exceed the global lend limit.
.... if (totalSupply() > globalLendLimit) { revert GlobalLendLimit(); } ....
However, globalLendLimit
represents the total value that can be lent out in terms of underlying assets, while totalSupply()
returns the total number of pool tokens (i.e. rTokens). As a result, this comparison is incorrect as they are not using the same unit of value.
Impact
As mentioned in the white paper, Section 2.1:
Initially, rTokens will have a 1-to-1 exchange rate with the deposited asset, but over time, as interest accrues, their value appreciates, yielding more than 1-to-1 upon redemption
As a result, there will be a difference in value between the rTokens and the underlying asset when there are more and more exchanges. This may in some cases allow a user to deposit assets even if it breaks the global lend limit safeguard.
Tools Used
Manual review.
Recommended Mitigation Steps
It's recommended to convert the total supply of shares (i.e. rTokens) back into the underlying assets, reflecting the current value of those shares within the vault before comparing it with the global lend limit.
Please consider to make the following change to the function _deposit
:
.... - if (totalSupply() > globalLendLimit) { - revert GlobalLendLimit(); - } + if (_convertToAssets(totalSupply(), newLendExchangeRateX96, Math.Rounding.Up) >= globalLendLimit) { + revert GlobalLendLimit(); + } ....
Invalid Validation
#0 - c4-pre-sort
2024-03-18T19:02:43Z
0xEVom marked the issue as sufficient quality report
#1 - c4-pre-sort
2024-03-18T19:03:51Z
0xEVom marked the issue as duplicate of #324
#2 - c4-judge
2024-03-31T15:35:18Z
jhsagd76 marked the issue as satisfactory