The ChangeFee function allows the contract owner to update the buyFee and sellFee state variables. However, the function lacks input validation to ensure the new fee values are within a reasonable or mathematically valid range.
The uint24 data type used for fees has a maximum value of 16,777,215. In the context of Uniswap V4 (and most DeFi protocols), fees are typically denominated in pips (where 1,000,000 equals 100%).
Impact:
Denial of Service (DoS): If the fee is set > 100%, the PoolManager or the Hook logic will attempt to deduct more tokens than the user provided. This will cause the transaction to revert due to underflow or insufficient balance errors, rendering the pool unusable
Griefing: A malicious or compromised owner key could front-run a large swap by setting the fee to 100%, effectively confiscating the user's entire input for zero output (depending on how the fee revenue is routed).
The following Foundry test demonstrates that the owner can set an invalid fee (200%), causing subsequent swaps to revert.
Introduce a constant representing the maximum allowable fee (e.g., 10% or 100,000 pips) and require that any new fee set via ChangeFee falls within this limit.
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.