Skip to content
DoS Audit finding Intermediate

Honest users could be permanently DOS’d from withdrawing their vested tokens/rewards

The claim function in ChefIncentivesController allows anyone to vest tokens for any user, and each call adds an entry to the user's earnings array. An attacker can call this daily to bloat the array, causing the user's withdrawal to run out of gas and revert, permanently blocking access to vested tokens.

Bauchibred Follow

Originally disclosed on Code4rena

Submitted by Bauchibred

Proof of Concept

ChefIncentivesController#Claim() is a public function and callable by anyone. When claiming, there is a need to vest the tokens, now this vesting directly vests to the multifeedistributor.

In MultiFeeDistribution#vestTokens(), there is a logic to only allow pushing a new entry for a user to his _userEarnings array once in a day. These rewards are then kept, and then after the vesting period a user can claim their rewards, where the _userEarnings array would be looped through.

Now from the links to the necessary functions attached, we can see that there is no minimum claimants to be made, asides the check that RDNT must be > 0, however as little as 1 is allowed.

For active users that could earn even if little rewards per day, this then allows a malicious user to cause a permanent DOS to claiming their vested tokens, since all the attacker has to do, is once a day for as long as the vesting duration query, which could in valid scenarios be quite lengthy query ChefIncentivesController#Claim() while passing the user’s address. Then, when the user comes to withdraw their vested tokens, the loop OOG’s and then reverts due to the amount of entries in the _userEarnings array .

Impact

Potential permanent DOS to honest users (or force the users to incur losses since some tech savvy users can notice this griefing attempt, but to stop this they’d have to withdraw early which forces them to incur losses, since even if the vesting duration reduces there is no other method for the user to withdraw their tokens and it’s stuck in the protocol. Alternatively, if the user leaves the claiming of their tokens even after the vesting period and does not immediately withdraw; the chances of this happening heavily increases since with each day an entry to the _userEarnings array can be made.

Recommended Mitigation Steps

Consider introducing some access control to ChefIncentivesController#Claim() and only allow the users call this for themselves.

Assessed type

DoS

amarcu (LoopFi) confirmed and commented:

This is a grieve attack on rewards, the user funds are not at risk.

Koolex (judge) decreased severity to Medium

0xAlix2 (warden) commented:

@Koolex - I respectfully believe that this is invalid, as vesting tokens is only doable by minters, here, that are assigned by the contract owner, i.e., trusted. Moreover, a user is allowed to call claim on a certain number of reward tokens, so even if DOS exists (it doesn’t but assuming minters are malicious) a user can still claim their rewards.

Bauchibred (warden) commented:

I do not understand the sponsors claim above to downgrade the severity of this report. Afaik, in the scope of this audit rewards are to be considered as users funds. This attack case has a simple path, a malicious user griefs users from their rewards by constantly calling ChefIncentivesController#Claim() so they are forced to incur losses.

This directly puts their assets at risk as they can’t access it as expected and why I submitted as High. Since the viable option for the users, which in my opinion, still points this to high is for them to withdraw early and incur losses.

Also I think @0xAlix2 seems to see the bug case as been backed by a malicious minter; however, their claim actually shows how vesting the tokens every day would be what a non-malicious minter would do; since if users are active and earn rewards for that day then there should be no reason why their tokens are not vested for the day which is what he’s suggesting. If that’s done, then this just breaks the logic as users are not being given their rewards, no?

Koolex (judge) commented:

Thank you everyone for your input. Given the input above, I believe this is valid and stays as-is.


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

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

Impact

Honest users could be permanently blocked from withdrawing their vested tokens, or forced to withdraw early and incur losses; user principal funds are not at risk according to the sponsor.

What the attacker needed

Attacker can call the public claim function; victim has vested rewards; attacker calls daily for vesting duration

How it was found

  1. Attacker calls ChefIncentivesController#Claim() with the victim's address once per day.
  2. Each call adds a new entry to the victim's _userEarnings array.
  3. After enough entries, the victim's withdrawal transaction runs out of gas and reverts.

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 bug where a public function lets anyone add small reward entries to another user's account. Over time, these entries pile up, and when the victim tries to withdraw, the system runs out of gas trying to process them all, so the withdrawal fails. The attacker doesn't steal funds but can block the victim from accessing their rewards.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by Bauchibred

View all

22 more disclosed reports, best first.

More from LoopFi

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.