The convertAccumulatedFeesToWeth()
function lacks a validation check for zero output
tokens after performing swaps, unlike similar functions in the codebase. This oversight could lead to loss of accumulated fees if a swap results in zero WETH
output due to extreme slippage
or market manipulation.
In convertMarketsCreditDepositsToUsdc()
, there's an explicit check to ensure non-zero output from swaps:
However, in convertAccumulatedFeesToWeth()
, this check is missing:
Issue Scenario:
A market accumulates significant fees in a collateral token
A keeper
calls convertAccumulatedFeesToWeth()
to convert these fees to WETH
Due to extreme slippage or market manipulation, the swap returns 0 WETH
Without validation, the function proceeds to distribute 0 WETH
The original fee tokens are lost without receiving any WETH
in return.
This is because the subsequent internal function calls do not perform zero-amount checks and therefore do not revert/fail for such.
These include _handleWethRewardDistribution()
which finally calls market.receiveWethReward()
which adds the received weth rewards to the stored values of pending protocol weth rewards and vaults' total weth reward.
Loss of accumulated fees if swaps result in zero output
Manual Review
Add a zero output
validation check after the swap execution:
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.