Skip to content
Business logic Audit finding Intermediate

Any user being the first to claim rewards from GiantMevAndFeesPool can unexepectedly collect them all

The first user to claim rewards from GiantMevAndFeesPool can collect all previously generated rewards, regardless of amount or whether they participated in generating them. This is due to a flaw in how accumulated rewards per LP share and claimed amounts are tracked.

clems4ever Follow

Originally disclosed on Code4rena

Submitted by clems4ever

https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/SyndicateRewardsProcessor.sol#L85 https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/SyndicateRewardsProcessor.sol#L61 https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/GiantMevAndFeesPool.sol#L203

Any user being the first to claim rewards from GiantMevAndFeesPool, can get all the previously generated rewards whatever the amount and even if he did not participate to generate those rewards…

Proof of Concept

https://gist.github.com/clems4ever/c9fe06ce454ff6c4124f4bd29d3598de

Copy paste it in the test suite and run it.

Tools Used

forge test

Recommended Mitigation Steps

Rework the way accumulatedETHPerLPShare and claimed is used. There are multiple bugs due to the interaction between those variables as you will see in my other reports.

vince0656 (Stakehouse) confirmed


The original report as published on Code4rena, by clems4ever. 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 interaction between accumulatedETHPerLPShare and claimed variables allows the first claimant to receive all accumulated rewards because the claimed amount is not properly initialised or updated per user.

Impact

Any user who is first to claim can steal all previously generated rewards, regardless of their participation.

What the attacker needed

Be the first to claim rewards

The fix

The way accumulatedETHPerLPShare and claimed are used should be reworked to correctly track and distribute rewards per user.

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.

In a rewards pool, users should only get rewards proportional to their share. Here, the first person to claim can take everything because the contract incorrectly calculates how much each person has earned. This means someone who just joined could steal all the rewards that others earned over time.

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 clems4ever

View all

8 more disclosed reports, best first.

More from LSD Network - Stakehouse 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.