Cross-Vault Reward Arbitrage in StakeV2 Allows Yield Theft
The StakeV2 contract does not track which vault a user's reward shares came from, so a user can claim shares from any whitelisted vault. An attacker can earn shares in a low-value vault and then claim the same number of shares from a high-value vault, stealing yield from other stakers.
- Disclosed after under an hour
#41639 [SC-Insight] Cross-Vault Reward Arbitrage in StakeV2 Allows Yield Theft
Submitted on Mar 17th 2025 at 07:55:55 UTC by @DoD4uFN for Audit Comp | Yeet
- Report ID: #41639
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/StakeV2.sol
- Impacts:
- Theft of unclaimed yield
Description
Brief/Intro
The StakeV2 contract allows users to claim staking rewards in the form of shares from different MoneyBrinter vaults. However, due to improper tracking of reward distributions, users can claim rewards from any whitelisted vault, regardless of which vault was used for their reward distribution. This enables users to exchange lower-value shares for higher-value shares, effectively stealing yield from other stakers.
Vulnerability Details
In StakeV2, when the manager calls executeRewardDistributionYeet, the Zapper contract performs a series of operations to convert YEET tokens into vault shares, which are then allocated as rewards to stakers. However, the contract does not properly associate users’ earned rewards with the specific MoneyBrinter vault from which they originated.
- The
_handleVaultSharesfunction updates the total vault shares but does not track which vault the shares belong to. - The
_verifyAndPrepareClaimfunction allows users to withdraw their earned shares from any whitelistedMoneyBrintervault, without verifying that their rewards originated from that specific vault. - As a result, a user who earned shares from a vault with a lower share price can claim shares from a vault with a higher share price, effectively gaining more value than they are entitled to.
Example Scenario:
- A user stakes
YEETand earns 10 shares in Vault A, where each share is worth $5 (total $50). - The user calls
claimRewardsInNative, but instead of withdrawing from Vault A, they specify Vault B, where each share is worth $10. - The contract does not verify the vault mismatch and allows the user to withdraw 10 shares from Vault B, giving them $100 instead of $50.
- This results in a net loss of $50 to the protocol and other stakers.
The issue stems from the lack of vault-specific reward tracking in _handleVaultShares and _verifyAndPrepareClaim, allowing a user to arbitrage reward shares across different vaults.
Impact Details
This vulnerability allows users to unfairly claim higher-value rewards at the expense of other stakers, leading to direct yield loss to the honest stakers. Depending on the total TVL of the protocol, the impact could lead to significant fund misallocations.
References
StakeV2.sol:executeRewardDistributionYeetStakeV2.sol:_handleVaultSharesStakeV2.sol:claimRewardsInNativeStakeV2.sol:_verifyAndPrepareClaim
Recommended Fix
- Track rewards on a per-vault basis to ensure users can only claim from the vault where their rewards originated.
- Modify
_handleVaultSharesto store vault-specific reward information. - Update
_verifyAndPrepareClaimto enforce reward claims from the correct vault.
Proof of Concept
Proof of Concept
- Manager distributes rewards into a high-value
MoneyBrintervault. - User stakes tokens.
- Manager distributes rewards into a low-value
MoneyBrintervault. - User earns shares of the low-value vault.
- User claims rewards but specifies a high-value
MoneyBrintervault. - Contract fails to validate vault-specific rewards and allows the user to claim overvalued shares.
- User profits by swapping low-value shares for high-value ones, stealing yield from other stakers.
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 contract does not associate earned reward shares with the specific vault they originated from, allowing claims from any whitelisted vault.
Impact
Users could unfairly claim higher-value rewards at the expense of other stakers, leading to direct yield loss to honest stakers.
What the attacker needed
Whitelisted vaults with different share values; user stakes tokens; manager distributes rewards
The fix
The contract should track rewards on a per-vault basis so users can only claim from the vault where their rewards originated.
How it was found
- Manager distributes rewards into a high-value vault.
- User stakes tokens.
- Manager distributes rewards into a low-value vault.
- User earns shares of the low-value vault.
- User claims rewards but specifies a high-value vault.
- Contract fails to validate vault-specific rewards and allows the user to claim overvalued shares.
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.
Staking rewards are paid in shares from different vaults, and each vault's shares have a different value. The contract forgets to remember which vault your shares came from, so you can ask for shares from a more valuable vault instead. This lets you take more value than you earned, at the expense of other people staking.
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.