Skip to content
Business logic Audit finding Intermediate

Unused debt is not send to Reward Claimer

When a user claims rewards and the Zapper converts them into a chosen token, any leftover tokens from the swap are returned to the StakeV2 contract rather than forwarded to the user. The user therefore loses the unused portion of their reward, which stays stuck in the contract.

Oxgritty Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#41907 [SC-High] Unused debt is not send to Reward Claimer

Submitted on Mar 19th 2025 at 10:03:41 UTC by @Oxgritty for Audit Comp | Yeet

Description

Brief/Intro

  • When a user calls claimRewards(claimRewardsInNative/ claimRewardsInToken0/ claimRewardsInToken1/ claimRewardsInToken) function, his reward is converted into his choice of token, during this swapping the amount of token which was not used will be send to StakeV2.sol instead of the user.

Vulnerability Details

  • When a user calls one of these functions(claimRewardsInNative/ claimRewardsInToken0/ claimRewardsInToken1/ claimRewardsInToken) to claim rewards and inside these functions we call a relevant zapOut function(like Zapper::zapOutNative for StakeV2::claimRewardsInNative or Zapper::zapOutToToken0 for StakingV2::claimRewardsInToken0) in Zapper.sol, Zapper.sol pays back the amount of unused debt to StakeV2.sol and StakeV2 does not send it back to the user.

Impact Details

  • Reward Claimer loses unused debt, as it is transferred to StakeV2.sol

References

This issue is present in all 4 claimRewards function:

  1. claimRewardsInNative
    After calling Zapper::zapInNative, we should send unused debt back to the user, but we are not doing it.
  • Same problem with these other 3 functions as well
  1. claimRewardsInToken0
  2. claimRewardsInToken1
  3. claimRewardsInToken

Proof of Concept

Proof of Concept

Step 0: Assumptions we are making

  • Bob has rewards of 50e18 vaultShares that he wants to claim in Native Token(BERA) using StakeV2::claimRewardsInNative
  • zapOutNative will turn 50e18 worth of vaultShares into the following Balances
    1. 45e18 (BERA)
    2. 2e18 (Token0)
    3. 3e18 (Token1)

Step 1: Calling StakeV2::claimRewardsInNative

  • Bob calls StakeV2::claimRewardsInNative with amountToWithdraw=50e18 and function is successfully executed.

Step 2: Checking Balances:

  • For StakeV2
    1. Token0.balanceOf(address(StakeV2)) = 2e18
    2. Token1.balanceOf(address(StakeV2)) = 3e18
    3. BERA.balanceOf(address(StakeV2)) = 0
  • For Bob
    1. Token0.balanceOf(address(Bob)) = 0
    2. Token1.balanceOf(address(Bob)) = 0
    3. BERA.balanceOf(address(Bob)) = 45e18

The original report as published on Immunefi, by Oxgritty. 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 claimRewards functions call the Zapper swap helpers but never forward the leftover tokens returned to StakeV2 on to the user.

Impact

The reward claimer loses the unused portion of their reward, which is transferred to and stuck in the StakeV2 contract.

What the attacker needed

User has claimable rewards; user claims in a converted token

How it was found

  1. Bob calls claimRewardsInNative with an amount of vault shares to withdraw.
  2. The Zapper converts the shares and returns part of the value as the native token and part as Token0 and Token1.
  3. Bob receives only the native token portion, while Token0 and Token1 remain in the StakeV2 contract.

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 user earns rewards and asks the contract to pay them out in a particular token. The helper contract that does the swap ends up with some leftover tokens, and instead of passing them to the user it leaves them in the main contract. So the user gets less than they should, and the remainder is stranded.

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 Oxgritty

View all

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