Expected interaction with claimFees will revert #326
Labels
bug
Something isn't working
duplicate-45
grade-a
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_34_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/src/V3FactoryOwner.sol#L193
Vulnerability details
MED: Expected interaction with claimFees will revert
LOC: https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/src/V3FactoryOwner.sol#L193
Description
Users are expected to call
claimFees()
to get fees in exchange for supplied WETH. The inputs(amount0Requested, amount1Requested)
are passed to the Pool.If less than the supplied amounts is actually pulled from the Pool, the contract reverts (to protect from executing a losing operation after frontrunning, for example).
The issue is an edge case of
collectProtocol()
is not accounted for.If
amount0Requested
is the entire token0 fees,amount0
is reduced by 1 before returning (to prevent clearing the slot). But since the fee amount exists in the Pool, it is expected that users will passamount0Requested = rotocolFees.token0
and similarly foramount1
. As a result, the protocol is likely to revert when used in a completely reasonable way by integrators.Note that since the protocol is deployed in Mainnet, the revert represents a non-negligible value loss of gas by the sender.
Impact
Users of
claimFees()
are likely to experience reverts and hence a loss of gas.Tools Used
Manual audit
Recommended Mitigation Steps
Relax the check below:
If the amount is 1 wei less than the requested amount,
claimFees()
execution should be considered valid.Assessed type
Context
The text was updated successfully, but these errors were encountered: