`CurveLPStaking` Curve's gauge rewards cannot be claimed
The CurveLPStakingController contract only supports deposit and withdraw functions that do not claim rewards, and it lacks a claim_rewards function. As a result, users cannot claim their Curve gauge rewards.
Source: https://github.com/sherlock-audit/2022-08-sentiment-judging/tree/main/502-H
Found by
WATCHPUG
Summary
Note: This issue is a part of the extra scope added by Sentiment AFTER the audit contest. This scope was only reviewed by WatchPug and relates to these three PRs:
Curve's gauge rewards cannot be claimed.
Vulnerability Detail
The sole goal of CurveLPStakingController is to stake and earn rewards from Curve's gauge system.
However, it doesn't support claim_rewards(), and both deposit() or withdraw() are using the default value (false) for _claim_rewards parameter.
Impact
Curve's gauge rewards cannot be claimed.
Code Snippet
/// @notice deposit(uint256)
bytes4 constant DEPOSIT = 0xb6b55f25;
/// @notice withdraw(uint256)
bytes4 constant WITHDRAW = 0x2e1a7d4d;
Tool used
Manual Review
Recommendation
Consider supporting claim_rewards(address,address) or using deposit(uint256,address,bool) and withdraw(uint256,address,bool) to support claim rewards when deposit() or withdraw().
Sentiment Team
Fixed controller as recommended to claim gauge rewards and moved gauge token oracle into a separate contract instead. PR here.
Lead Senior Watson
Confirmed fix.
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
The controller contract does not implement a function to claim rewards and calls deposit and withdraw with the reward-claiming flag set to false.
What the attacker needed
Access to the controller contract
The fix
The controller was fixed to support claiming gauge rewards, and the gauge token oracle was moved to a separate 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.
This is a smart contract that lets people stake tokens to earn rewards. The contract can put tokens in and take them out, but it never asks the reward system to pay out the earnings. So the rewards stay stuck.
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.