The VoterUpgradeableV2.createV3Gauge function incorrectly uses v2GaugeFactory instead of v3GaugeFactory
Lines of code
Vulnerability details
Impact
The gauges for the V3 pool are managed incorrectly by v2GaugeFactory rather than v3GaugeFactory.
Proof of Concept
In the VoterUpgradeableV2.createV3Gauge function, v2GaugeFactory is used instead of the appropriate v3GaugeFactory.
solidityFile: contracts\core\VoterUpgradeableV2.sol 323: externalBribe = IBribeFactory(bribeFactoryCache).createBribe(token0, token1, string.concat("Fenix Bribes: ", symbol)); 324: gauge = IGaugeFactory(v2GaugeFactory).createGauge( 325: token, 326: votingEscrow, 327: pool_, 328: address(this), 329: internalBribe, 330: externalBribe, 331: true, 332: feeVault 333: );
As a result, v2GaugeFactory manages the gauges for the V3 pool instead of v3GaugeFactory. The GaugeFactoryUpgradeable contract includes the defaultBlastGovernor and merklGaugeMiddleman variables, and the createGauge function initializes the gauge using these variables.
solidityFile: contracts\gauges\GaugeFactoryUpgradeable.sol function createGauge( address _rewardToken, address _ve, address _token, address _distribution, address _internal_bribe, address _external_bribe, bool _isDistributeEmissionToMerkle, address _feeVault ) external virtual override returns (address) { require(msg.sender == voter || msg.sender == owner(), "only voter or owner"); address newLastGauge = address(new GaugeProxy()); IGauge(newLastGauge).initialize( defaultBlastGovernor, _rewardToken, _ve, _token, _distribution, _internal_bribe, _external_bribe, _isDistributeEmissionToMerkle, merklGaugeMiddleman, _feeVault ); last_gauge = newLastGauge; return newLastGauge; }
Tools Used
Manual Review
Recommended Mitigation Steps
It is recommended to change the code in the createV3Gauge function as following:
diff- gauge = IGaugeFactory(v2GaugeFactory).createGauge( + gauge = IGaugeFactory(v3GaugeFactory).createGauge( token, votingEscrow, pool_, address(this), internalBribe, externalBribe, true, feeVault );
Assessed type
Other
