Skip to content
Business logic Audit finding Intermediate

[WP-M1] getRewards() can be triggered by external parties which will result in the rewards not be tracking properly by the system

The reward claim function can be called by anyone, not just the account owner. If a third party repeatedly claims rewards on behalf of the victim, the reward tokens are never added to the victim's asset list, so the system undercounts their assets and may wrongly liquidate the account.

WatchPug Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-12-sentiment-judging/issues/15

Found by

WATCHPUG

Summary

ConvexRewardPool#getReward(address) can be called by any address besides the owner themself.

Vulnerability Detail

The reward tokens will only be added to the assets list when getReward() is called.

If there is a third party that is "helping" the account to call getReward() from time to time, by keeping the value of unclaimed rewards low, the account owner may not have the motivation to take the initiative to call getReward() via the AccountManager.

As a result, the reward tokens may never get added to the account's assets list.

Impact

If the helper/attacker continuously claims the rewards on behalf of the victim, the rewards will not be accounted for in the victim's total assets.

As a result, the victim's account can be liquidated while actual there are enough assets in their account, it is just that these are not accounted for.

Code Snippet

https://github.com/sentimentxyz/controller/blob/507274a0803ceaa3cbbaf2a696e2458e18437b2f/src/convex/ConvexBoosterController.sol#L31-L46

https://arbiscan.io/address/0x63F00F688086F0109d586501E783e33f2C950e78

Tool used

Manual Review

Recommendation

Consider adding all the reward tokens to the account's assets list in ConvexBoosterController.sol#canDeposit().

Discussion

r0ohafza

fix: https://github.com/sentimentxyz/controller/pull/54

jacksanford1

From WatchPug on Discord:

The fix to #15 LGTM!

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

Likely the reward tokens are only added to the account's asset list when the owner calls getReward(), but the function is publicly callable, so third parties can claim rewards without updating the asset list.

Impact

If an attacker continuously claims rewards on behalf of the victim, the victim's account could be liquidated even though it holds enough assets, because those rewards are not counted.

What the attacker needed

Attacker can call getReward() on behalf of victim; victim has unclaimed rewards

The fix

The reward tokens should be added to the account's asset list when the deposit is first made, rather than waiting for a claim.

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.

In this system, rewards earned from staking are only counted as part of your assets when you personally trigger a claim. But the claim function can be called by anyone. So an attacker can keep claiming your rewards for you, and because you never trigger the claim yourself, the system never records those rewards as yours. This makes your account look poorer than it is, which could lead to it being liquidated.

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.