31521 - [SC - Medium] Early return in RewardsDistributorclaim can cau...
Submitted on May 21st 2024 at 00:52:07 UTC by @Django for Boost | Alchemix
Report ID: #31521
Report type: Smart Contract
Report severity: Medium
Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/RewardsDistributor.sol
Impacts:
Permanent freezing of funds
Description
Brief/Intro
A user can lose ETH that they've sent to RewardsDistributor
to compound their ALCX rewards. This can occur if a user accidently attempts to claim their reward multiple times. While the impact is severe, its likelihood is low, leading to medium severity.
Vulnerability Details
A user is able to compound their rewards by sending ETH directly with the claim()
call which will add liquidity to the WETH/ALCX pool. However, if their transaction gets stuck and they attempt to send another transaction, the RewardsDistributor contract will swallow the ETH and neither call will revert.
This is due to the fact that the function returns early if the user has no ALCX rewards.
As seen above, if the user wants to compound their rewards, they send the proper amount of ETH (or in excess) which bundles the ETH and ALCX and stakes the resulting BPT in the VotingEscrow contract on behalf of the user.
If the user sends two transactions with positive ETH values attached, the early return statement if (alcxAmount == 0) return alcxAmount;
will trigger and the user's ETH will not be refunded, nor will it even be checked for proper amount.
Impact Details
Users' ETH can be stuck in the RewardDistributor
Recommendation
Add this clause to check msg.value
.
Output from POC
Proof of Concept
Last updated