Skip to content
Business logic Audit finding Intermediate

If The Staking Token Exists In Both StakingRewards.sol And ConvexStakingWrapper.sol Then It Will Be Possible To Continue Claiming Concur Rewards After The Shelter Has Been Activated

The shelter mechanism in ConvexStakingWrapper.sol lets the owner protect depositor assets, but it does not wipe the depositor's balance recorded in MasterChef.sol. A user can withdraw their staking tokens after the grace period and deposit the same tokens into StakingRewards.sol, so they keep earning Concur rewards for both the old sheltered balance and the new deposit, effectively doubling their rewards.

leastwood Follow

Originally disclosed on Code4rena

Submitted by leastwood

Staking tokens are used to deposit into the StakingRewards.sol and ConvexStakingWrapper.sol contracts. Once deposited, the user is entitled to Concur rewards in proportion to their staked balance and the underlying pool’s allocPoint in the MasterChef.sol contract.

The Shelter.sol mechanism allows the owner of the ConvexStakingWrapper.sol to react to emergency events and protect depositor’s assets. The staking tokens can be withdrawn after the grace period has passed. However, these staking tokens can be deposited into the StakingRewards.sol contract to continue receiving Concur rewards not only for StakingRewards.sol but also for their ConvexStakingWrapper.sol deposited balance which has not been wiped. As a result, users are able to effectively claim double the amount of Concur rewards they should be receiving.

Proof of Concept

MasterChef.sol

StakingRewards.sol

ConvexStakingWrapper.sol

Recommended Mitigation Steps

Ensure that staking tokens cannot be deposited in both the StakingRewards.sol and ConvexStakingWrapper.sol contracts. If this is intended behaviour, it may be worthwhile to ensure that the sheltered users have their deposited balance wiped from the MasterChef.sol contract upon being sheltered.

leekt (Concur) confirmed

Alex the Entreprenerd (judge) decreased severity to Medium and commented:

The warden has shown that because the shelter mechanism doesn’t wipe the balance in the contract, those same tokens can be used to further break the accounting of the contract, with the goal of extracting further rewards.

While I believe the wardens work is commendable and have considered High Severity because the accounting of the protocol has been broken, I believe Medium Severity to be more appropriate because the finding:

  • Is contingent on the Shelter being used
  • There must be more rewards in the StakingRewardsContract
  • The impact is limited to the additional rewards and nothing else

The original report as published on Code4rena, by leastwood. 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

Root cause

Likely the shelter mechanism does not clear the depositor's staked balance in MasterChef.sol, so the same tokens can be counted in both StakingRewards.sol and ConvexStakingWrapper.sol at once.

Impact

A user could claim roughly double the Concur rewards they are entitled to, but only if the shelter is used and the StakingRewards contract still holds enough rewards to pay out.

What the attacker needed

Shelter mechanism is activated; grace period has passed; StakingRewards holds extra rewards

The fix

Staking tokens should not be depositable in both StakingRewards.sol and ConvexStakingWrapper.sol at the same time, or sheltered users should have their deposited balance wiped from MasterChef.sol.

How it was found

  1. Deposit staking tokens into ConvexStakingWrapper.sol to earn Concur rewards.
  2. The owner activates the shelter mechanism to protect depositor assets.
  3. Wait for the grace period to pass and withdraw the staking tokens.
  4. Deposit the same tokens into StakingRewards.sol.
  5. Continue claiming rewards for both the new deposit and the un-wiped sheltered balance.

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.

A staking token is a receipt for money you put into a contract. This protocol has two places where you can stake the same token, and each one pays out rewards. When the emergency shelter is switched on, the contract stops the old position but forgets to erase the record of how much you had staked. You can take your tokens back and stake them again in the other contract, and the system still pays you for the old position too, so you get paid twice.

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 leastwood

View all

70 more disclosed reports, best first.

More from Concur Finance contest

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.