Balancer oracle deadlock from cumulative price weight
The Balancer price oracle accumulates a cumulative price weight that grows without bound, so its time-weighted average becomes increasingly resistant to change. Once the market price moves beyond the configured slippage tolerance, the update function keeps rejecting new prices and the oracle can become permanently stuck, returning stale or inaccurate prices to consumers.
Submitted by Valves, also found by 0xGutzzz, 0xVrka, akleeko22, DQH1, Gakarot, KyleMcodes, M4v3r1ck, sahuang, santipu_, udaykiranpedda, viper7882, and Wojack
autonolas-tokenomics/../contracts/oracles/BalancerPriceOracle.sol#L109
The BalancerPriceOracle.updatePrice() function can enter a permanent deadlock state where price updates are perpetually rejected due to the ever-growing cumulativePrice making the time-weighted average price increasingly resistant to change. Once the cumulative weight becomes sufficiently large, any market movement exceeding maxSlippage will permanently brick the oracle.
Finding Description
The oracle calculates a time-weighted average price using the formula:
uint256 averagePrice = (snapshot.cumulativePrice + (currentPrice * elapsedTime)) /
((snapshot.cumulativePrice / snapshot.averagePrice) + elapsedTime);
At each update, cumulativePrice is incremented by snapshot.averagePrice * elapsedTime.
The vulnerability arises from the interaction between:
- Growing cumulative weight:
cumulativePrice / snapshot.averagePricerepresents ТOTAL historical time weight - Slippage validation: Current price must be within
maxSlippageof the newly calculated average
As the oracle runs longer, the denominator (cumulativePrice / snapshot.averagePrice) + elapsedTime grows dominated by the historical weight. This makes the average price increasingly inertial - even long time periods cannot shift it significantly.
Mathematical example
// PHASE 1: After 1 year at stable 1.0 price
elapsedTime = 31_536_000 seconds (365 days)
currentPrice = 1e18
averagePrice = 1e18
// First update succeeds
cumulativePrice = 0 + (1e18 * 31_536_000) = 3.1536e25
newAverage = (0 + 1e18 * 31_536_000) / (0 + 31_536_000) = 1e18
// Update SUCCESS ✓
// PHASE 2: 10 years pass, market moves 10% higher
elapsedTime = 315_360_000 seconds (10 years)
currentPrice = 1.1e18 (market price increased 10%)
cumulativePrice = 3.1536e25 (frozen from last update)
averagePrice = 1e18 (frozen from last update)
maxSlippage = 5%
// Slippage check happens FIRST (using OLD average)
upperBound = 1e18 * 1.05 = 1.05e18
lowerBound = 1e18 * 0.95 = 0.95e18
currentPrice = 1.1e18 > upperBound
// Update rejected! Function returns false
// State remains frozen - cumulativePrice and averagePrice NEVER update
The deadlock mechanism:
- Oracle runs for extended period (weeks/months), accumulating large
cumulativePrice - Market experiences legitimate volatility, price moves > maxSlippage from current average
- Slippage check fails → function returns
false - State is NOT updated:
cumulativePriceandaveragePricestays frozen - Even after extended time passes, the frozen cumulative weight dominates any new time period
- The calculated average cannot catch up to the market price
- Slippage check in
validatePriceis not accurate
Another way this can get frozen without having to wait for cumulativePrice to grow big Long‑term price moves can permanently halt protocol actions that rely on oracle validation. If market moves beyond maxSlippage, causing DoS for any consumer. updatePrice() simply returns false when the new price deviates beyond maxSlippage, leaving the snapshot unchanged. If the real price shifts permanently, the oracle never updates again and validatePrice() will keep failing, blocking buybacks or exits that depend on it.
Impact Explanation
updatePrice() returns false indefinitely, cumulativePrice and averagePrice stays frozen, validatePrice is going to work with an inaccurate slippage check, returing bad prices as valid and good prices as bad.
Likelihood Explanation
This is expected to occur naturally
Recommendation
The root cause is that slippage validation occurs against the stale average price before state updates, creating a deadlock when the oracle falls behind market movements.
Limit the TWAP window to something that you are ok with (30 minutes, 1 day, 1 month…). Add an emergency mechanism to reset the oracle when deadlocked.
Proof of Concept
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 slippage check compares the current price against a stale average before the state is updated, while the cumulative weight grows without bound, so the average can never catch up to a sustained market move.
Impact
Price updates could be rejected indefinitely, leaving the oracle frozen and causing validatePrice to accept bad prices and reject good ones, which could block buybacks or exits that depend on it.
What the attacker needed
Oracle runs for a long period; market price moves beyond maxSlippage
The fix
The time-weighted window should be bounded to a chosen length and an emergency reset mechanism added so a stuck oracle can be recovered.
How it was found
- Let the oracle run for a long period at a stable price so the cumulative price weight grows large.
- The market price then moves by more than the allowed slippage from the stored average.
- The update call fails the slippage check and returns false without changing state.
- The stored average and cumulative weight stay frozen, so later updates keep failing and consumers receive inaccurate prices.
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.
An oracle is a contract that feeds outside information, here a market price, into a protocol. This oracle averages prices over time, and the longer it runs the more weight it gives to old history, so a real price change can no longer move the average. Because each update is only accepted if the new price is close to the old average, the oracle can get stuck forever and keep reporting a price that is no longer true.
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.