Skip to content
Access control Audit finding Intermediate

Unable to call some functions in the incentive contracts with onlyOwner modifier because of incorrect initialization leading to stuck funds

Incentive contracts are initialised with BoostCore as the owner, so onlyOwner functions like drawRaffle and clawback cannot be called by the intended user. This leaves funds stuck and prevents raffle winners from being drawn.

0xDemon Follow with 0xNirix, 0xSecuri and 32 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-06-boost-aa-wallet-judging/issues/43

Found by

0xDemon, 0xNirix, 0xSecuri, 0xSolus, 0xbranded, 0xbrivan, 0xdeadbeef, 0xloscar01, Atharv, Aymen0909, Galturok, Greese, Hacek00, IvanFitro, Japy69, KupiaSec, PranavGarg, Ragnarok, SovaSlava, TessKimy, Trooper, ZanyBonzy, blutorque, ctf_sec, dimulski, durov, frndz0ne, ge6a, haxagon, iamnmt, ke1caM, oxelmiguel, sakshamguruji, scyron6, y4y

Summary

BoostCore.sol will always be set as the owner of Boost provided incentive contracts because the initializer is called here within _makeIncentives. Therefore any function using the onlyOwner modifier within the incentive contracts must be called by BoostCore. For example, there is no way to call drawRaffle or clawback from the BoostCore contract.

Root Cause

createBoost is called to create a new boost. Each incentive is initialized by the call to _makeIncentives. Within _makeIncentives the initializer is called for each incentive. The initializer function within each incentive contract sets the owner as msg.sender which would be the BoostCore contract.

Internal pre-conditions

  1. Boost is created using the out of the box incentive contract as one of the incentives including: ERC20Incentive, CGDAIncentive, ERC20VariableIncentive, and ERC1155Incentive

External pre-conditions

No response

Attack Path

  1. User calls createBoost to create a new Boost
  2. They choose to use an out of the box incentive contract listed above
  3. They are initialized with BoostCore as the owner

Impact

  • No winner can be drawn for raffle contests through ERC20Incentive contract
  • Any funds in the contract that need to be rescued cannot be retrieved through clawback

PoC

No response

Mitigation

Owner should be specified in the init payload by the user similarly to how its done for the budget contracts here

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/boostxyz/boost-protocol/pull/192

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

No winner can be drawn for raffle contests and any funds in the contract that need to be rescued cannot be retrieved through clawback.

What the attacker needed

Boost is created using an out-of-the-box incentive contract

The fix

The owner should be specified in the init payload by the user, similarly to how it is done for the budget contracts.

How it was found

  1. User calls createBoost to create a new Boost
  2. They choose to use an out of the box incentive contract listed above
  3. They are initialized with BoostCore as the owner

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.

Smart contracts often have an 'owner' who has special permissions, like the ability to withdraw funds or start a raffle. Here, the ownership was accidentally given to the main BoostCore contract instead of the user, so the user cannot perform those actions. As a result, money can get stuck and raffles cannot be completed.

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

View all

8 more disclosed reports, best first.

More from Boost Core Incentive Protocol

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.