FlywheelCore ’s setFlywheelRewards can remove access to reward funds from current users
The setFlywheelRewards function does not verify that the new rewards contract points back to the same FlywheelCore, so if an admin sets a mismatched contract, all reward funds become permanently inaccessible to users. An attacker with admin access could intentionally cause this, or it could happen by mistake.
Submitted by hyh, also found by rayn
FlywheelCore.setFlywheelRewards can remove current reward funds from the current users’ reach as it doesn’t check that newFlywheelRewards’ FlywheelCore is this contract.
If it’s not, by mistake or with a malicious intent, the users will lose the access to reward funds as this FlywheelCore will not be approved for any fund access to the new flywheelRewards, while all the reward funds be moved there.
Setting severity to medium as on one hand that’s system breaking issue (no rewards can be claimed after that, users are rugged reward-wise), on the other hand setFlywheelRewards function is requiresAuth. Also, a room for operational mistake isn’t too small here as new flywheelRewards contract can be correctly configured and not malicious in all other regards.
Proof of Concept
FlywheelCore.setFlywheelRewards doesn’t check that newFlywheelRewards’ FlywheelCore is this FlywheelCore instance:
FlywheelCore is immutable within flywheelRewards and its access to the flywheelRewards’ funds is set on construction:
This way if new flywheelRewards contract have any different FlywheelCore then current users’ access to reward funds will be irrevocably lost as both claiming functionality and next run of setFlywheelRewards will revert, not being able to transfer any funds from flywheelRewards with rewardToken.safeTransferFrom(address(flywheelRewards), ...):
As FlywheelCore holds user funds accounting via rewardsAccrued mapping, all these accounts became non-operational, as all the unclaimed rewards will be lost for the users.
Recommended Mitigation Steps
Consider adding the require for address(newFlywheelRewards.flywheel) == address(flywheelRewards.flywheel) in setFlywheelRewards so that users always retain funds access.
Joeysantoro (xTRIBE) acknowledged and commented:
Similar to M-06. I think adding this check makes sense.
This issue seems distinct enough from M-06 to warrant separate issues. Leaving open and not as a duplicate.
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 setFlywheelRewards function lacks a check that the new rewards contract's flywheel reference matches the current FlywheelCore.
Impact
If an admin sets a mismatched rewards contract, all unclaimed rewards become permanently inaccessible because claiming and further setFlywheelRewards calls revert.
What the attacker needed
Admin calls setFlywheelRewards; new rewards contract has different FlywheelCore
The fix
The function should require that the new rewards contract's flywheel address equals the current flywheel address.
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.
This is a smart contract bug where an admin function can accidentally or maliciously lock away users' reward tokens forever. The function changes where rewards are stored, but it doesn't check that the new storage contract is still linked to the original core contract, so the core can no longer move the funds.
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.