LiquidationPool.distributeAssets()
might not fully transfer all tokens approved by LiquidationPoolManager
, resulting in a non-zero allowance. If non-standard tokens, such as USDT, are used as collateral for the vaults, this could potentially lead to DoS of liquidations.
During LiquidationPool.distributeAssets()
, funds designated as rewards for stakers are moved from LiquidationPoolManager
to the LiquidationPool
contract. In order to do so, LiquidationPoolManager
grants approval for its balances of all accepted ERC20 tokens to the LiquidationPool
contract. However, in certain situations, not all of this allowance is utilized by LiquidationPool.distributeAssets()
, resulting in non-zero allowances for specific tokens.
The code snippet below, extracted from the LiquidationPool.distributeAssets()
function, illustrates the section where the token rewards' share (_portion
) for each staker is calculated. If the _portion
value in euros exceeds the staker's current EURO position, it is proportionally reduced.
As a consequence of this reduction, not all of the balance approved by LiquidationPoolManager
is spent. While this might not pose an issue in most cases, certain non-standard ERC20 tokens, like USDT, only permit approving non-zero amounts if the current allowance is zero, reverting otherwise.
Therefore, if USDT or a similar token with such behavior is utilized as collateral, it could potentially result in a DoS situation for liquidations. This is because once one LiquidationPoolManager.runLiquidation()
operation leaves an unspent allowance, subsequent calls to LiquidationPoolManager.runLiquidation()
will fail when attempting to increase the allowance, leading to a revert.
All further liquidations will revert, unless the problematic token is removed from the accepted token list.
Manual Review.
Consider setting all the allowances to zero at the end of LiquidationPoolManager.runLiquidation()
, as shown below.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.