Skip to content
Business logic Audit finding Intermediate

User rewards incorrectly transferred to StakeV2 instead of claimant

When users claim rewards via functions like claimRewardsInToken0, any leftover token1 after swapping is sent to the StakeV2 contract instead of the user. This causes users to lose a portion of their rewards.

Ragnarok Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#42189 [SC-High] User rewards incorrectly transferred to `StakeV2` instead of claimant

Submitted on Mar 21st 2025 at 15:39:46 UTC by @Ragnarok for Audit Comp | Yeet

Description

Brief/Intro

Users may lose rewards when claiming them due to a portion of the rewards being transferred to the StakeV2 contract instead of the user.

Vulnerability Details

When users claim rewards, they can call one of the following functions: claimRewardsInToken0, claimRewardsInToken1, claimRewardsInNative, or claimRewardsInToken.

In particular, the StakeV2::claimRewardsInToken0 function calls Zapper::zapOutToToken0, which swaps token1 for token0, then transfers all token0 to the user (receiver parameter). However, any remaining token1 is sent to the StakeV2 contract (msg.sender in the context of zapOutToToken0) instead of the user.

This behavior is incorrect because the remaining token1 is part of the user's rewards and should be transferred to them. A similar issue occurs in other reward-claiming functions.

StakeV2::claimRewardsInToken0 function:

Solidity
function claimRewardsInToken0(
    uint256 amountToWithdraw,
    IZapper.SingleTokenSwap calldata swapData,
    IZapper.KodiakVaultUnstakingParams calldata unstakeParams,
    IZapper.VaultRedeemParams calldata redeemParams
) external nonReentrant {
    _updateRewards(msg.sender);

    IZapper.VaultRedeemParams memory updatedRedeemParams = _verifyAndPrepareClaim(amountToWithdraw, redeemParams);

    IERC20(redeemParams.vault).approve(address(zapper), amountToWithdraw);
    // @comment msg.sender receives back token0
    // @comment This contract receives back the remaining token1 (after swapping token1 to token0)
    // @audit The remaining token1 should be transferred to msg.sender
=>  uint256 receivedAmount = zapper.zapOutToToken0(msg.sender, swapData, unstakeParams, updatedRedeemParams);

    emit Claimed(msg.sender, receivedAmount);
}

Impact Details

Users may lose a portion of their rewards when claiming them, as some rewards are inadvertently sent to the StakeV2 contract instead of the user.

Proof of Concept

Proof of Concept

Consider the following scenario:

  1. The user calls StakeV2::claimRewardsInToken0 to claim rewards with swapData.inputAmount = 10 ether.
  2. After removeLiquidity, the actual received amount of token1 is 11 ether.
  3. The remaining 1 ether of token1 is incorrectly transferred to the StakeV2 contract instead of the user.

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

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 zapOutToToken0 function sends leftover token1 to msg.sender (the StakeV2 contract) rather than the original user.

Impact

Users may lose a portion of their rewards when claiming them.

What the attacker needed

User claims rewards via affected functions

How it was found

  1. The user calls StakeV2::claimRewardsInToken0 to claim rewards with swapData.inputAmount = 10 ether.
  2. After removeLiquidity, the actual received amount of token1 is 11 ether.
  3. The remaining 1 ether of token1 is incorrectly transferred to the StakeV2 contract instead of the 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.

When you claim rewards, the contract swaps one token for another. If there is extra of the original token left after the swap, it should go to you, but instead it goes to the contract itself. So you get less than you should.

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 Ragnarok

View all

2 more disclosed reports, best first.

More from Yeet

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.