RebateFi Hook

First Flight #53
Beginner FriendlyDeFi
100 EXP
View results
Submission Details
Impact: low
Likelihood: medium
Invalid

Missing Fee Bounds Validation in `ChangeFee`

Description:
The ChangeFee function allows setting buy and sell fees to any value, even excessively high ones, with no validation.

Impact:
The owner could set fees to extreme values (e.g., 100%), rendering trading impossible or capturing exorbitant protocol revenue, harming users.

Proof of Concept: TODO add test
Test could set fee to an unreasonable value:

function test_FeeBoundsValidation() public {
uint24 maxFee = 1000000; // Over maximum allowed fee (100%)
rebateHook.ChangeFee(true, maxFee, false, 0);
(uint24 buyFee, ) = rebateHook.getFeeConfig();
assertEq(buyFee, maxFee);
}

Mitigation:
Enforce max fee values, e.g., no more than 10% (100,000 in Uniswap V4 fee units).

+ uint24 public constant MAX_FEE = 100000; // 10%
function ChangeFee(
bool _isBuyFee,
uint24 _buyFee,
bool _isSellFee,
uint24 _sellFee
) external onlyOwner {
- if(_isBuyFee) buyFee = _buyFee;
+ if(_isBuyFee) {
+ require(_buyFee <= MAX_FEE, "Buy fee exceeds maximum");
+ buyFee = _buyFee;
+ }
- if(_isSellFee) sellFee = _sellFee;
+ if(_isSellFee) {
+ require(_sellFee <= MAX_FEE, "Sell fee exceeds maximum");
+ sellFee = _sellFee;
+ }
}
Updates

Lead Judging Commences

chaossr Lead Judge 11 days ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!