Skip to content
Business logic Audit finding Beginner

Stakers lose their commission if they unstake as they cannot claim their pending rewards anymore after unstaking

The claimCommission function is restricted to current stakers, so once a staker unstakes or is removed, they can no longer claim their previously accrued commissions. This results in a permanent loss of unclaimed rewards.

0xStalin Follow with mstpr-brainbot, n4nika and 4 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-08-morphl2-judging/issues/168

Found by

0xStalin, mstpr-brainbot, n4nika, p0wd3r, sammy, underdog, zraxx

Summary

Once a staker unstakes or gets removed, they permanently lose access to all their accrued commissions.

This is a problem as it can either happen mistakenly or if the staker gets removed by an admin or slashed. However even in that case, they should still be able to claim their previously accrued rewards since they did not act negatively during that period.

Root Cause

L2Staking.sol::claimCommission has the onlyStaker modifier, making it only callable by stakers.

Internal pre-conditions

None

External pre-conditions

None

Attack Path

Issue path in this case

  • Staker stakes and accrues commissions over a few epochs
  • Now either the staker unstakes or gets removed forcibly by the admin
  • The staker has now lost access to all previously accrued rewards

Impact

Loss of unclaimed rewards

PoC

No response

Mitigation

Consider removing the onlyStaker modifier and allow anyone to call it. This should not be a problem since normal users do not have any claimable commission anyways except if they were a staker before.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/morph-l2/morph/pull/516

The original report as published on Sherlock, by 0xStalin. 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

Impact

Stakers permanently lose unclaimed rewards if they unstake or are removed.

What the attacker needed

Staker has accrued commissions; staker unstakes or is removed

The fix

The protocol team fixed this issue by removing the onlyStaker modifier, allowing anyone to call claimCommission.

How it was found

  1. Staker stakes and accrues commissions over a few epochs
  2. Staker unstakes or gets removed forcibly by the admin
  3. Staker loses access to all previously accrued rewards

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 a staking system, people lock tokens and earn rewards called commissions. The function to collect these rewards only works while you are still staking. If you stop staking or are removed, you cannot collect what you already earned, so that money is lost.

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 0xStalin

View all

20 more disclosed reports, best first.

More from MorphL2

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.