Skip to content
Audit finding Advanced

Balancer oracle uses vault balances as price and can be steered by anyone

The Balancer price oracle reads pool balances directly from the Vault and returns a simple reserve ratio, which is a spot price that moves whenever the pool is traded. Because updatePrice() is permissionless and the snapshot is built from that spot price, an attacker who keeps the pool in a manipulated state and calls updatePrice() over time can drag the stored average away from the real market price, so validatePrice() still passes while the price is far off.

Silvermist Follow with Ace2, AzizHack and 10 others

Originally disclosed on Code4rena

Submitted by Silvermist, also found by Ace2, AzizHack, Funen, holtzzx, joker158, LittleJoe, Nerca, nisedo, santipu_, Silverwind, udaykiranpedda, and Yifan

autonolas-tokenomics/../contracts/oracles/BalancerPriceOracle.sol #L72-L80

BalancerPriceOracle.getPrice() does not read a Balancer oracle accumulator. It reads the pool balances directly from the Vault and returns a simple reserve ratio. That value is a spot price and it can change whenever the pool is traded.

(, uint256[] memory balances, ) = IVault(balancerVault).getPoolTokens(balancerPoolId);
uint256 balanceIn = balances[direction];
uint256 balanceOut = balances[(direction + 1) % 2];
return (balanceOut * 1e18) / balanceIn;

updatePrice() is permissionless and writes the oracle snapshot based on the current spot price returned by getPrice(). This means any address can decide when the snapshot should be updated, and the snapshot is always derived from the spot regime that exists at that moment.

uint256 currentPrice = getPrice();
snapshot.cumulativePrice += snapshot.averagePrice * elapsedTime;
uint256 averagePrice = (snapshot.cumulativePrice + (currentPrice * elapsedTime)) /
    ((snapshot.cumulativePrice / snapshot.averagePrice) + elapsedTime);
snapshot.averagePrice = averagePrice;
snapshot.lastUpdated = block.timestamp;

validatePrice(slippage) then compares the current spot price (getPrice()) to a band around the computed “timeWeightedAverage”. In practice, this check is only enforcing that current spot is near the oracle’s stored snapshot state. If an attacker can keep the pool in a manipulated spot regime and call updatePrice() over time, the stored snapshot can be moved away from the original market price and toward the attacker-controlled regime. Then validatePrice() can still return true while the price is far from the original reference.

Recommended mitigation steps

Do not use raw Vault balances as an oracle for slippage protection of large protocol swaps.

Proof of Concept

View detailed Proof of Concept

https://github.dev/code-423n4/reports/blob/main/olas/2026-01-olas.md


The original report as published on Code4rena, by Silvermist. 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 oracle derives its price from raw, manipulable pool balances (a spot price) instead of a manipulation-resistant accumulator, and lets anyone trigger the snapshot update from that spot value.

Impact

An attacker could steer the stored oracle snapshot away from the original market price so that validatePrice() still returns true while the price is far from the real reference, weakening slippage protection for large protocol swaps.

What the attacker needed

Ability to trade in the Balancer pool; ability to call updatePrice() repeatedly

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 price oracle is a contract that tells other contracts what something is worth. This one worked out the price by looking at how much of each token sat in a trading pool at that instant, which anyone can shift by trading. Since anyone could also trigger the price snapshot update, a person could nudge the recorded price over time until it no longer matched the real market.

More by Silvermist

View all

4 more disclosed reports, best first.

More from Olas

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.