Skip to content
Access control Audit finding Intermediate

Improper access control of claimAllForMember allows anyone to reduce the weight of a member

The claimAllForMember function in the Dao contract lacks access control, allowing anyone to claim unlocked bonded LP tokens for any member. This can reduce a member's weight in the BondVault, potentially preventing them from finalizing a proposal or reducing their rewards.

shw Follow

Originally disclosed on Code4rena

Submitted by shw, also found by 0xRajeev

The claimAllForMember function of Dao is permissionless, allowing anyone to claim the unlocked bonded LP tokens for any member. However, claiming a member’s LP tokens could decrease the member’s weight in the BondVault, thus affecting the member’s votes and rewards in the Dao contract.

For example, an attacker can intentionally front-run a victim’s voteProposal call to decrease the victim’s vote weight to prevent the proposal from being finalized:

  1. Supposing the victim’s member weight in the BondVault is 201, the total weight is 300. The victim has some LP tokens claimable from the vault, and if claimed, the victim’s weight will be decreased to 101. To simplify the situation, assuming that the victim’s weight in the DaoVault and the total weight of the DaoVault are both 0.
  2. The victim wants to vote on the current proposal, which requires the majority consensus. If the victim calls voteProposal, the proposal will be finalized since the victim has the majority weight (201/300 > 66.6%).
  3. An attacker does not want the proposal to be finalized, so he calls claimAllForMember with the victim as the parameter to intentionally decrease the victim’s weight.
  4. As a result, the victim’s weight is decreased to 101, and the total weight is decreased to 200. The victim cannot finalize the proposal since he has no majority anymore (101/200 < 66.6%).

Similarly, an attacker can front-run a victim’s harvest call to intentionally decrease the victim’s reward since the amount of reward is calculated based on the victim’s current weight.

See issue page page for referenced code

Consider removing the member parameter in the claimAllForMember function and replace all member to msg.sender to allow only the user himself to claim unlocked bonded LP tokens.

verifyfirst (Spartan) confirmed and disagreed with severity:

Although a low risk issue, it is valid and the suggested mitigation is correctly proposed.

ghoul-sol (judge) commented:

Making this medium risk as no funds are lost.

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

An attacker could front-run a victim's voteProposal or harvest call to reduce the victim's weight, potentially preventing proposal finalization or decreasing rewards; no funds are lost.

What the attacker needed

Victim has claimable LP tokens; attacker can front-run victim's transaction

The fix

The fix is to remove the member parameter from claimAllForMember and replace all uses of member with msg.sender, so only the user themselves can claim their unlocked bonded LP tokens.

How it was found

  1. The victim has a member weight of 201 out of total 300, and has claimable LP tokens that would reduce their weight to 101 if claimed.
  2. The victim intends to call voteProposal to finalize a proposal, which requires majority consensus.
  3. An attacker calls claimAllForMember with the victim's address as the parameter, decreasing the victim's weight to 101 and total weight to 200.
  4. The victim can no longer finalize the proposal because their weight is now 101/200, below the 66.6% threshold.

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 smart contract function that lets anyone claim tokens on behalf of another user can be abused. By calling it, an attacker can lower that user's voting power or rewards, which might stop a proposal from passing or reduce earnings.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by shw

View all

22 more disclosed reports, best first.

More from Spartan Protocol Contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.