Skip to content
Business logic Audit finding Intermediate

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

WatchPug Follow

Originally disclosed on Sherlock

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:

  1. Lending deposit cap
  2. Fee accrual modification
  3. CRV staking

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

https://github.com/sentimentxyz/controller/blob/be4a7c70ecef788ca9226b46ff108ddd9001b14e/src/curve/CurveLPStakingController.sol#L20-L24

Solidity
/// @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.

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

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.

More by WatchPug

View all

197 more disclosed reports, best first.

More from Sentiment Update #3

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.