Incorrect Liquidity Check in Variable Pool Disrupts Borrowing Operations #275
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-218
🤖_10_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-06-size/blob/8850e25fb088898e9cf86f9be1c401ad155bea86/src/libraries/CapsLibrary.sol#L67-L73
https://github.com/code-423n4/2024-06-size/blob/8850e25fb088898e9cf86f9be1c401ad155bea86/src/Size.sol#L184
https://github.com/code-423n4/2024-06-size/blob/8850e25fb088898e9cf86f9be1c401ad155bea86/src/Size.sol#L194
https://github.com/code-423n4/2024-06-size/blob/8850e25fb088898e9cf86f9be1c401ad155bea86/src/Size.sol#L243
Vulnerability details
variablePool
is an AAVE V3 POOL. In thevalidateVariablePoolHasEnoughLiquidity
function, we check if the usdc.balanceOf(variablePool) is greater than or equal to the amount to be withdrawn. If this condition is not met, the function reverts.The issue is that this validation will always revert because the
variablePool
is always empty. ThevariablePool
does not hold the supplied tokens; instead he send it toaToken
contract of the supplied asset .Due to this incorrect assumption (that the variablePool holds the supplied tokens), borrowing is not possible, effectively breaking the entire system.
Impact
buyCreditMarket
,sellCreditMarket
, andliquidateWithReplacement
functions will always revert due to incorrect validation ofvariablePool
liquidity, effectively halting all borrowing and selling credits operations within the protocol.Proof of Concept
variablePool
does not hold the supplied tokens and when thevariablePool
balance is0
it doesn't mean it not possible to withdraw. The test uses the realAAVE V3 POOL
on the mainnet and the realUSDC
address. Add this test here.forge test --mt test_forkPool -vvv
Tools Used
manual review
Recommended Mitigation Steps
atoken
instead ofvariablePool
:Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: