Wrong liquidity checking lead to token being stuck #281
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
edited-by-warden
🤖_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-#L71
Vulnerability details
Vulnerability details
Function
validateVariablePoolHasEnoughLiquidity()
is used to check if pool have enough token or not:Notice that it use address
state.data.variablePool
, which havesupply()
function, that isPool
contract in aave docs:Look at aave's deposit workflow:
It call
executeSupply()
function inSupplyLogic
library:It can be seen that token is transfered to
reserveCache.aTokenAddress
address, not stay inpool
address, which lead to checking condition invalidateVariablePoolHasEnoughLiquidity
function wrong, token can be stuck due to wrong checking conditionImpact
As token stay in
reserveCache.aTokenAddress
address, which isAToken
contract link, this wrong checking condition can lead to unintended revert, and user's token can be stuck inside protocolTools Used
Manual review
Recommended Mitigation Steps
Replace
state.data.variablePool
address to AToken's address.Assessed type
Other
The text was updated successfully, but these errors were encountered: