MrCrowNFT - Users not be able to claim incentives with referrer address if `(payload_.referralFee + BoostCore.sol::referralFee) > FEE_DENOMINATOR` #407
Users not be able to claim incentives with referrer address if (payload_.referralFee + BoostCore.sol::referralFee) > FEE_DENOMINATOR
Summary
When creating a boost, the creators payload (decoded from input data), holds a `payload.referralFeewhich is added toBoostCore.sol::referralFeeto defineboost.referralFee. According toREADME.md`BoostCore.sol::referralFee = Between 0 - FEE_DENOMINATOR (FEEDENOMINATOR=100%). The main issue resides in the fact if `(payload.referralFee + BoostCore.sol::referralFee) > FEE_DENOMINATOR,BoostCore.sol::claimIncentive` will underflow revert when calling with referrer address for the created boost.
Root Cause
In BoostCore.sol::122 payload_.protocolFee is added to protocolFee without checking if it exceeds FEE_DENOMINATOR.
MrCrowNFT
Medium
Users not be able to claim incentives with referrer address if
(payload_.referralFee + BoostCore.sol::referralFee) > FEE_DENOMINATOR
Summary
When creating a boost, the creators payload (decoded from input data), holds a `payload.referralFee
which is added to
BoostCore.sol::referralFeeto define
boost.referralFee. According to
README.md`BoostCore.sol::referralFee = Between 0 - FEE_DENOMINATOR
(FEEDENOMINATOR=100%). The main issue resides in the fact if `(payload.referralFee + BoostCore.sol::referralFee) > FEE_DENOMINATOR,
BoostCore.sol::claimIncentive` will underflow revert when calling with referrer address for the created boost.Root Cause
BoostCore.sol::122
payload_.protocolFee is added to protocolFee without checking if it exceeds FEE_DENOMINATOR.BoostCore.sol::_routeClaimFee
when a referrer address is included and if(payload_.referralFee + BoostCore.sol::referralFee) > FEE_DENOMINATOR
,referralShare
will be greater thannetFee
, making the function revert due to underflow. https://github.com/sherlock-audit/2024-06-boost-aa-wallet/blob/main/boost-protocol/packages/evm/contracts/BoostCore.sol#L305-L314Internal pre-conditions
No response
External pre-conditions
claimIncentive
with a referral address.Attack Path
No response
Impact
PoC
You may add the following code to
BoostCore.t.sol
for testingMitigation
Add a maximum referral fee check in
BoostCore.sol::createBoost