Skip to content
Business logic Audit finding Intermediate

cancelPromotion is too rigorous

The cancelPromotion function deletes the entire promotion record, so users can no longer claim rewards from previous epochs and unclaimed tokens remain locked in the contract.

gpersoon Follow

Originally disclosed on Code4rena

Submitted by gpersoon, also found by 0x0x0x, gzeon, harleythedog, hubble, and kenzo

Impact

When you cancel a promotion with cancelPromotion() then the promotion is complete deleted. This means no-one can claim any rewards anymore, because \_promotions\[\_promotionId] no longer exists.

It also means all the unclaimed tokens (of the previous epochs) will stay locked in the contract.

Proof of Concept

https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L119-L138

function cancelPromotion(uint256 _promotionId, address _to) ... {
    ...
    uint256 _remainingRewards = _getRemainingRewards(_promotion);
    delete _promotions[_promotionId];

Recommended Mitigation Steps

In the function cancelPromotion() lower the numberOfEpochs or set a state variable, to allow user to claim their rewards.

PierrickGT (PoolTogether) confirmed

The original report as published on Code4rena, by gpersoon. 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 cancelPromotion function deletes the entire promotion data structure instead of marking it as cancelled or adjusting the number of epochs, which removes the information needed to claim past rewards.

Impact

Users lose access to unclaimed rewards from previous epochs, and those tokens remain permanently locked in the contract.

What the attacker needed

Promotion must be cancelled by owner

The fix

The cancelPromotion function should be modified to lower the numberOfEpochs or set a state variable so that users can still claim their rewards.

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 lets people earn rewards over time. If the owner cancels the promotion, the contract erases all record of it, so people who already earned rewards cannot collect them and their tokens are stuck forever.

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 gpersoon

View all

47 more disclosed reports, best first.

More from PoolTogether

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.