Skip to content
Business logic Audit finding Beginner

Logical Flaw in set_gauge_controller Permanently Disables Critical Governance Function

The set_gauge_controller function in Factory.vy contains an incorrect assertion that checks the incoming parameter instead of the stored state variable, causing any attempt to set a valid non-zero address to revert. This prevents the admin from ever updating the GaugeController address, potentially locking the protocol's governance.

0xAsen Follow with 0xd4ps, 0xding99ya and 20 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-08-yield-basis-judging/issues/30

Found by

0xAsen, 0xd4ps, 0xding99ya, Boy2000, Colin, DSbeX, Freescore, KupiaSec, Ziusz, blockace, boredpukar, djshaneden, emarai, francoHacker, fullstop, holtzzx, m3dython, m4ze, maigadoh, manga, richi, rsam_eth, spaceleaf

Summary

An incorrect assertion in the Factory.vy contract will cause the set_gauge_controller function to fail for any valid input, preventing the protocol's admin from ever updating the GaugeController contract address. When the admin attempts to call the function to set a valid contract address, the transaction will invariably fail due to a flawed check.

Root Cause

In yb-core/contracts/Factory.vy, the assertion assert gc == empty(address), "Already set" within the set_gauge_controller function contains a logical error. The code incorrectly checks if the incoming parameter gc is the zero address, rather than checking if the currently stored state variable self.gauge_controller is the zero address.

The likely intent was for this function to be callable only once. The correct implementation to achieve this would be assert self.gauge_controller == empty(address), "Already set", which would check if the controller has already been initialized.

https://github.com/sherlock-audit/2025-08-yield-basis/blob/main/yb-core/contracts/Factory.vy#L339-L344

Internal Pre-conditions

The protocol admin needs to update the gauge_controller address to a new, valid, non-zero contract address.

External Pre-conditions

None. This vulnerability is a purely internal logic flaw and does not depend on the state of any external protocols.

Attack Path

This is a functional defect rather than a typical attack path. The sequence of events is as follows:

The protocol admin, for reasons such as an upgrade or a bug fix, needs to point the gauge_controller in the Factory contract to a new implementation.

The admin calls set_gauge_controller(new_address), where new_address is a valid, non-zero contract address.

The function's assertion assert gc == empty(address) is triggered because the passed new_address is not equal to the zero address.

The transaction reverts, and the gauge_controller address cannot be updated.

Impact

This vulnerability causes the protocol admin to be unable to execute the action of updating the GaugeController address. The GaugeController is a core component for managing the protocol's token emissions. This flaw cripples the protocol's ability to upgrade or fix this critical component. If the GaugeController needs to be replaced for any reason after the initial deployment, the Factory contract will be unable to point to the new implementation, creating a severe governance deadlock and operational risk that could force a costly and complex redeployment of the entire protocol.

PoC

No response

Mitigation

No response

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/yield-basis/yb-core/commit/43157a9fdffb0c395cf39036b6e41deb9cacca63

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

The assertion checks the incoming parameter gc instead of the stored state variable self.gauge_controller, so it reverts for any non-zero address.

Impact

The admin cannot update the GaugeController address, which could lead to a governance deadlock and require redeploying the entire protocol if the component needs replacement.

What the attacker needed

Admin needs to update gauge_controller

The fix

The assertion should check self.gauge_controller instead of gc, and the issue was fixed in a commit.

How it was found

  1. The protocol admin needs to update the gauge_controller address.
  2. The admin calls set_gauge_controller with a valid non-zero address.
  3. The assertion fails because the new address is not zero.
  4. The transaction reverts and the address cannot be updated.

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 has a function meant to set an important address only once. The check that should ensure it hasn't been set before mistakenly checks the new address instead, so it always fails when a real address is provided. This means the admin can never change that address later, which could be a problem if the address needs updating.

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

View all

17 more disclosed reports, best first.

More from Yield Basis

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.