CapsLibrary.validateVariablePoolHasEnoughLiquidity()
always revert
#35
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
🤖_primary
AI based primary recommendation
🤖_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#L60-L75
Vulnerability details
After a user attempts lending or borrowing, the function
CapsLibrary.validateVariablePoolHasEnoughLiquidity()
is called to ensure the Aave pool has enough liquidity for the current borrower to withdraw USDC. However, it checks the wrong address and reverts.Impact
No user can utilize the lending or borrowing functions until the contracts are upgraded to fix the issue.
No financial loss incurred to user.
Proof of Concept
In
SizeStorage
, the configurationvariablePool
points to the AAVE V3 main pool (0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2), which hold tokens.When
CapsLibrary
tries to get theunderlyingBorrowToken
(USDC) balance ofvariablePool
, it always returns 0, as shown below:This function is supposed to point to the Aave pool pair ETH/USDC, as seen in
DepositTokenLibrary.sol
:https://github.com/code-423n4/2024-06-size/blob/8850e25fb088898e9cf86f9be1c401ad155bea86/src/libraries/DepositTokenLibrary.sol#L55-L56
Because aEthUSDC contract holds the actual USDC for user withdrawals, not the main pool.
Tools Used
Recommended Mitigation Steps
Point to correct address
Assessed type
Error
The text was updated successfully, but these errors were encountered: