Closed c4-bot-7 closed 6 months ago
kalinbas (sponsor) confirmed
Please note that I marked this as a separate ticket. Both @b0g0 and @ktg9 also mention this unmitigated issue:
https://github.com/code-423n4/2024-04-revert-mitigation-findings/issues/46
https://github.com/code-423n4/2024-04-revert-mitigation-findings/issues/42
jhsagd76 marked the issue as satisfactory
jhsagd76 marked the issue as duplicate of #63
Lines of code
https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol?plain=1#L345 https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol?plain=1#L1384-L1390 https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol?plain=1#L1112
Vulnerability details
Lines of code
https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol?plain=1#L345
https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol?plain=1#L1384-L1390
https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol?plain=1#L1112
Vulnerability details
When V3Vault.maxWithdraw() is called, the V3Vault balance is retrieved from _getBalanceAndReserves(). This function will return the total assets owned by the vault. Further along in maxWithdraw(), the Vault will then convert these total assets (aka
balance
denominated as assets) into assets again via the _convertToAssets() function. This is not needed asbalance
is already in assets denomination.Impact
A larger amount of assets will be returned in maxWithdraw() since _convertToAssets() will make
balance
larger than it is since the exchange rate forshares -> assets
is typically greater than 1.Proof of Concept
The _convertToAssets() function is used when the ownerAssetBalance is greater than or equal to balance. The balance is in assets, as it comes from _getBalanceAndReserves(), which gets the balance from totalAssets(), showing the token's total balance.
Tools Used
Manual review
Recommended Mitigation Steps
Return the balance when the balance can't cover the owner's balance:
Assessed type
Math logic
Assessed type
Math