Skip to content
Business logic Audit finding Intermediate

OperationalStaking::_unstake Delegators can bypass 28 days unstaking cooldown when enough rewards have accumulated

Delegators could bypass the 28-day unstaking cooldown by unstaking shares instead of redeeming rewards, progressively converting their stake into immediately claimable rewards. This allowed them to derisk their position while still earning future rewards.

cergyk Follow with irresponsible and qmdddd

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-11-covalent-judging/issues/78

Found by

cergyk, irresponsible, qmdddd

Summary

When rewards are distributed, they are distributed evenly accross all of the shares held for a validator. However participants collecting rewards burn shares, and thus receive less rewards in subsequent rounds, compared to participants which have left rewards in the contract. This means that delegators can unstake instead of redeeming rewards, which will progressively replace the initial staked amount with claimable rewards.

Vulnerability Detail

We can see in the function redeemRewards that the equivalent amount of shares is burned to redeem: https://github.com/sherlock-audit/2023-11-covalent/blob/main/cqt-staking/contracts/OperationalStaking.sol#L616-L631

This means that by redeeming rewards a validator will receive less of the future rewards than the stake he invested.

Conversely, this means that delegators can progressively derisk their staking position by burning small quantity of shares from their stake (by calling unstake) instead of claiming rewards. When enough rewards accumulated, they have the equivalent of their initial amount in the contract, but it is less risky, since as rewards, they are not subject to the unstaking cooldown of 28 days and can be transferred out immediately.

Scenario

Alice is a validator staking 35 000 CQT. Bob delegates 35 000 CQT to Alice.

Shares distribution:

  • Alice owns 35 000e18 shares
  • Bob owns 35 000e18 shares

Owner distributes rewards to the tune of 70000 CQT (an exaggerated amount to make the point here)

Alice withdraws all her rewards, and burning half of her shares Bob unstakes all of his position, but does not redeem his rewards

Shares distribution:

  • Alice owns 17 500e18 shares
  • Bob owns 17 500e18 shares

Alice and Bob still have the same number of shares, and have the same claim to future rewards. However Bob's position has less risk compared to a normal delegator, since he can get all of his funds out anytime by calling redeemRewards, and does not have to wait a cooldown period.

Impact

Code Snippet

Tool used

Manual Review

Recommendation

Use a claimedRewards mapping to track already claimed rewards instead of burning shares when redeeming rewards

Discussion

sherlock-admin2

1 comment(s) were left on this issue during the judging contest.

takarez commented:

invalid: should provide a POC

noslav

fixed partially by prevent bypassing cooldown with redelegateUnstaked - sa78/sa68/sa76

rogarcia

PR: https://github.com/covalenthq/cqt-staking/pull/125 commit: https://github.com/covalenthq/cqt-staking/pull/125/commits/5bf8940c8d5642652b1987cc74cb2f6780b06b08

sherlock-admin

Escalate

issue #68 is not a duplicate of this issue at all and should be its own issue.

You've deleted an escalation for this issue.

sherlock-admin

The protocol team fixed this issue in PR/commit https://github.com/covalenthq/cqt-staking/pull/125/commits/5bf8940c8d5642652b1987cc74cb2f6780b06b08.

sherlock-admin

The Lead Senior Watson signed off on the fix.

The original report as published on Sherlock, by cergyk. 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 redemption mechanism burns shares, which reduces future rewards, so users can instead unstake to convert stake into rewards that are not subject to the cooldown.

Impact

Delegators could bypass the 28-day unstaking cooldown, gaining immediate access to funds that should have been locked, while still earning future rewards.

What the attacker needed

Be a delegator; accumulated rewards

The fix

The protocol team fixed this issue in PR/commit https://github.com/covalenthq/cqt-staking/pull/125/commits/[redacted].

How it was found

  1. Alice stakes 35,000 CQT and Bob delegates 35,000 CQT to Alice.
  2. Owner distributes 70,000 CQT in rewards.
  3. Alice withdraws all her rewards, burning half her shares.
  4. Bob unstakes all his position but does not redeem rewards.
  5. Both now have equal shares, but Bob can redeem rewards anytime without cooldown.

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.

When you stake cryptocurrency, you often have to wait a period before you can withdraw it. This report shows that by choosing to unstake instead of claiming earned rewards, a user could get their money out faster than intended, while still keeping the same share of future rewards.

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 cergyk

View all

29 more disclosed reports, best first.

More from Covalent

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.