Skip to content
Business logic Audit finding Intermediate

When users transfer GiantLP, some rewards may be lost

When a user transfers GiantLP tokens, the contract attempts to distribute rewards but does not claim the latest rewards from StakingFundsVault first, so the calculated reward per share is lower and the user loses some rewards.

cccz Follow

Originally disclosed on Code4rena

Submitted by cccz

GiantMevAndFeesPool.beforeTokenTransfer will try to distribute the user’s current rewards to the user when transferring GaintLP, but since beforeTokenTransfer will not call StakingFundsVault.claimRewards to claim the latest rewards, thus making the calculated accumulatedETHPerLPShare smaller and causing the user to lose some rewards.

Proof of Concept

https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/GiantMevAndFeesPool.sol#L146-L148

Recommended Mitigation Steps

Consider claiming the latest rewards from StakingFundsVault before the GiantMevAndFeesPool.beforeTokenTransfer calls updateAccumulatedETHPerLP()

vince0656 (Stakehouse) acknowledged and commented:

So the nuance here is that due to contract limitations, users should be encouraged for this specific case to claim rewards before transferring tokens due to the requirement of claim params that the contract wouldn’t readily have when executing a transfer. We can document this limitation in detail and encourage users to always claim before transferring the tokens.

LSDan (judge) commented:

I think medium is appropriate for this issue given that we have a loss of funds if the user performs actions out of order.


The original report as published on Code4rena, by cccz. 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 transfer hook updates the accumulated reward per share without first claiming pending rewards from the staking vault, so the calculation uses stale data.

Impact

A user who transfers GiantLP tokens may lose some of their earned rewards because the contract does not claim the latest rewards before calculating the payout.

What the attacker needed

User holds GiantLP tokens with pending rewards; user transfers GiantLP tokens

The fix

The contract should claim the latest rewards from StakingFundsVault before updating the accumulated reward per share during a transfer, or users should be clearly instructed to claim rewards before transferring.

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.

This is a smart contract bug where transferring a token triggers a reward payout, but the contract forgets to first collect the newest rewards from another contract. Because of that, the reward calculation uses outdated numbers, so the user gets less than they should. In short, the order of operations is wrong, and the user loses money.

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 cccz

View all

104 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.