Skip to content
Business logic Audit finding Intermediate

Referrer can drain ReferralFeePoolV0

The claimRewardAsMochi function did not reduce the user's reward balance after a claim, allowing a referrer to repeatedly claim the same reward and drain the fee pool.

gzeon Follow

Originally disclosed on Code4rena

Submitted by gzeon

Impact

function claimRewardAsMochi in ReferralFeePoolV0.sol did not reduce user reward balance, allowing referrer to claim the same reward repeatedly and thus draining the fee pool.

Proof of Concept

Did not reduce user reward balance at L28-47 in ReferralFeePoolV0.sol

Recommended Mitigation Steps

Add the following lines

rewards -= reward[msg.sender]; reward[msg.sender] = 0;

ryuheimat (Mochi) confirmed

The original report as published on Code4rena, by gzeon. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the function updated no state to mark the reward as claimed, so the balance remained unchanged after each payout.

Impact

A referrer could claim the same reward repeatedly and drain the entire fee pool.

What the attacker needed

Be a referrer with a reward balance

The fix

The function should subtract the claimed reward from the user's balance and set it to zero before or after transferring funds.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract function that pays out rewards forgot to subtract the paid amount from the user's balance. So the same reward could be claimed over and over, emptying the pool that holds funds for all referrers.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by gzeon

View all

46 more disclosed reports, best first.

More from Mochi contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.