The GaugeController
contract allows an unlimited number of gauges to be added, which can be exploited to make multiple core operations prohibitively expensive or completely impossible due to block gas limits. This includes reward distribution and total weight calculations, both of which must iterate over all gauges.
The GaugeController
contract allows adding an unlimited number of gauges through the addGauge()
function. When distributing rewards via distributeRewards()
or calculating total weights via getTotalWeight()
, the contract must iterate through all gauges, making the gas cost increase linearly with the number of gauges.
An attacker can exploit this by:
Adding a large number of gauges
This makes any operation requiring iteration over all gauges extremely expensive or impossible
Effectively breaks core protocol functionality including reward distribution and weight calculations
Test output shows dramatic increases in gas costs as gauges are added:
Reward Distribution:
Baseline: 14,031 gas
With 100 gauges: 165,097 gas (1,176% increase)
With 500 gauges: 901,097 gas (6,422% increase)
With 1000 gauges: 2,377,097 gas (16,941% increase)
Total Weight Calculation:
Baseline: 5,664 gas
With 100 gauges: 153,264 gas (2,705% increase)
With 500 gauges: 891,264 gas (15,735% increase)
With 1000 gauges: 2,367,264 gas (41,794% increase)
Voting Operations:
Baseline: 54,088 gas
Remains relatively constant around 7,788 gas (14% change)
Not significantly impacted as it only operates on a single gauge
Extrapolating from these growth rates, approximately 3,000-4,000 gauges would make reward distribution and weight calculations hit block gas limits.
High severity due to:
Complete denial of service of multiple core protocol functions:
Reward distribution becomes prohibitively expensive
Total weight calculations become extremely costly
Affects any operation that must iterate over all gauges
Attack is relatively cheap to execute
Affects all protocol users
No existing mitigations or limits
Foundry for testing and gas analysis
Manual code review
Implement one or more of the following mitigations:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.