Technical Analysis: How was Balancer Hacked for $120 Million, and Where was the Vulnerability? On [date], Balancer, a popular decentralized exchange (DEX), was hacked for $120 million in a sophisticated attack. The vulnerability exploited in this atta...
Original Article Title: "Balancer $120M Hack Vulnerability Technical Analysis"
Original Source: ExVul Security
Foreword
On November 3, 2025, the Balancer protocol was attacked on multiple chains including Arbitrum and Ethereum, resulting in a $120 million asset loss. The attack was primarily due to a dual vulnerability involving precision loss and Invariant manipulation.
Chainlink's infrastructure has long maintained the highest standards in the Web3 space, making it a natural choice for X Layer, which is dedicated to providing institutional-grade tools for developers.
The key issue in this attack lies in the protocol's logic for handling small transactions. When users conduct exchanges with small amounts, the protocol invokes the _upscaleArray function, which uses mulDown for rounding down values. When the balance in the transaction and the input amount both hit a specific rounding boundary (e.g., the 8-9 wei range), a noticeable relative precision error occurs.
This precision error is propagated to the calculation of the protocol's Invariant value D, causing an abnormal reduction in the D value. The fluctuation of the D value directly lowers the price of the Balancer Pool Token (BPT) in the Balancer protocol. The hacker exploited this suppressed BPT price through a premeditated trading path to conduct arbitrage, ultimately leading to a massive asset loss.
Exploited Transaction:
https://etherscan.io/tx/0x6ed07db1a9fe5c0794d44cd36081d6a6df103fab868cdd75d581e3bd23bc9742
Asset Transfer Transaction:
https://etherscan.io/tx/0xd155207261712c35fa3d472ed1e51bfcd816e616dd4f517fa5959836f5b48569
Technical Analysis
Attack Vector
The entry point of the attack was the Balancer: Vault contract, with the corresponding entry function being the batchSwap function, which internally calls onSwap for token exchanges.

From the perspective of function parameters and restrictions, several pieces of information can be obtained:
1. The attacker needs to call this function through the Vault and cannot call it directly.
2. The function will internally call _scalingFactors() to get the scaling factor for scaling operations.
3. The scaling operation is concentrated in either _swapGivenIn or _swapGivenOut.
Attack Pattern Analysis
BPT Price Calculation Mechanism
In Balancer's stable pool model, the BPT Price is a crucial reference point that determines how much BPT a user receives and how much each BPT receives in assets.

In the pool's exchange calculation:

Where the part acting as the BPT Price anchor is an immutable value D, which means controlling the BPT Price requires controlling D. Let's analyze the calculation process of D further:

In the above code, the calculation process of D depends on the scaled balances array. This means that an operation is needed to change the precision of these balances, leading to an incorrect D calculation.
Root Cause of Precision Loss

Scaling Operation:

As shown above, when passing through _upscaleArray, if the balance is very small (e.g., 8-9 wei), the rounding down in mulDown will result in significant precision loss.
Attack Process Detailed
Phase 1: Adjustment to Rounding Boundary

Phase 2: Trigger Precision Loss (Core Vulnerability)

Phase 3: Exploiting Depressed BPT Price for Profit

Above, the attacker uses Batch Swap to perform multiple exchanges in one transaction:
1. First Exchange: BPT → cbETH (balance adjustment)
2. Second Exchange: wstETH (8) → cbETH (trigger precision loss)
3. Third Exchange: Underlying Asset → BPT (profit-taking)
All these exchanges occur in the same batch swap transaction, sharing the same balance state, but each exchange calls _upscaleArray to modify the balances array.
Lack of Callback Mechanism
The main process is initiated by the Vault. How does this lead to accumulating precision loss? The answer lies in the passing mechanism of the balances array.

Looking at the above code, although Vault creates a new currentBalances array each time onSwap is called, in Batch Swap:
1. After the first swap, the balance is updated (but due to precision loss, the updated value may be inaccurate)
2. The second swap continues the calculation based on the result of the first swap
3. Precision loss accumulates, eventually causing the invariant value D to significantly decrease
Key Issue:

Summary
The Balancer attack can be summarized for the following reasons:
1. Scaling Function Uses Round Down: _upscaleArray uses mulDown for scaling, which results in significant relative precision loss when the balance is very small (e.g., 8-9 wei).
2. Invariant Value Calculation Is Sensitivity to Precision: The calculation of the invariant value D relies on the scaled balances array, and precision loss directly affects the calculation of D, causing D to decrease.
3. Lack of Invariant Value Change Validation: During the swap process, there was no validation to ensure that the change in the invariant value D was within a reasonable range, allowing attackers to repeatedly exploit precision loss to suppress the BPT price.
4. Accumulation of Precision Loss in Batch Swaps: Within the same batch swap, the precision loss from multiple swaps accumulates and eventually leads to significant financial losses.
These two issues—precision loss and lack of validation—combined with the attacker's careful design of boundary conditions, resulted in this loss.
This article is a contribution and does not represent the views of BlockBeats.
You may also like

A plunge of over 97% continues to unlock, yet WLD has completed $65 million in over-the-counter financing: who is still footing the bill?

Potential Bitcoin Crash Below $60K May Delay Recovery to 2027
Key Takeaways: Bitcoin’s deep drawdown phase may extend recovery to the second quarter of 2027. Historical data shows…

BTC USD Price Drops Below $67K Amid Rising Treasury Yields
Key Takeaways: BTC USD slumped to $66,300, its first drop below $67K since March 9, driven by macroeconomic…

Second Bill Targets Insider Trading in Prediction Markets
Key Takeaways: The Public Integrity in Financial Prediction Markets Act of 2026 prohibits government officials from using insider…

India Apprehends Key Figure in Myanmar Crypto Fraud Complex
Key Takeaways: India’s Central Bureau of Investigation (CBI) arrested a key player in a scam that trafficked Indian…

Bitcoin and Profit Metrics: Will History Repeat Itself?
Key Takeaways: Historical patterns reveal that when Bitcoin’s supply in profit falls below 50%, significant price rallies ensue.…

Bitcoin ‘Compression’ Outcome Could Propel BTC Towards $80K: An Analyst’s Perspective
Key Takeaways: Bitcoin’s price is testing a critical $71,500 level, hinting at a possible rally to $80,000. Traders…

Data Points to Accelerating Ether Supply Crunch: Will ETH Price Follow?
Key Takeaways: As of now, 33.1% of Ethereum’s circulating supply is staked, resulting in a tighter liquid supply.…

XRP Risk-Reward Improves as Whale Accumulation Surges: Will the Price Mirror This Trend?
Key Takeaways: XRP’s Sharpe Ratio turned positive on March 26, 2026, indicating a potential for returns outweighing associated…

Cryptocurrency Price Predictions for March 27: BTC, ETH, BNB, XRP, SOL, DOGE, HYPE, ADA, BCH, and LINK
Key Takeaways: Bitcoin is struggling to maintain its position above the $66,000 threshold, amplifying concerns of a further…

Bitcoin ETFs Face Capital Outflow as Market Treads with Caution
Key Takeaways: Bitcoin ETFs experienced a $296 million outflow, ending a four-week inflow run. Total net assets for…

Crypto Market Predictions: BTC, ETH, BNB, XRP, SOL, DOGE, HYPE, ADA, BCH, LINK
Key Takeaways: Bitcoin struggles at the $72,000 level as bulls aim for $80,000, while resistance remains strong. Ethereum…

Bitcoin Returns to $71K as Oil Prices Plummet with Trump Halting Iran Strikes
Key Takeaways: Bitcoin rallies 5% to surpass $71,000 following Trump’s delay of US military action against Iran. Liquidations…

Ether Taker Volume Reaches Three-Year Peak: Can ETH Sidestep a 19% Price Drop?
Key Takeaways: An Ether on-chain indicator has surged to its highest in over three years, signaling potential stabilization…

Bitcoin Spot Volumes Reach 2023 Lows While BTC Rallies Stay News-Driven
Key Takeaways: Bitcoin’s price surged to $71,600 during a US market open, but the rise lacked consistent spot…

Unifying Ethereum: Tackling Fragmentation and Embracing Onchain Trading
Key Takeaways: Ethereum developers propose a groundbreaking ‘Economic Zone’ to address fragmentation in layer-2 networks. Onchain commodity trading…

Lummis Affirms CLARITY Act as DeFi’s Strongest Shield Yet
Key Takeaways: The CLARITY Act is touted by Senator Cynthia Lummis as providing unparalleled protections for DeFi developers.…

US Probes Bitmain over Security Concerns Amidst Crypto Mining Dominance
Key Takeaways: US authorities have initiated “Operation Red Sunset” to investigate potential security threats posed by Bitmain’s Chinese-manufactured…
A plunge of over 97% continues to unlock, yet WLD has completed $65 million in over-the-counter financing: who is still footing the bill?
Potential Bitcoin Crash Below $60K May Delay Recovery to 2027
Key Takeaways: Bitcoin’s deep drawdown phase may extend recovery to the second quarter of 2027. Historical data shows…
BTC USD Price Drops Below $67K Amid Rising Treasury Yields
Key Takeaways: BTC USD slumped to $66,300, its first drop below $67K since March 9, driven by macroeconomic…
Second Bill Targets Insider Trading in Prediction Markets
Key Takeaways: The Public Integrity in Financial Prediction Markets Act of 2026 prohibits government officials from using insider…
India Apprehends Key Figure in Myanmar Crypto Fraud Complex
Key Takeaways: India’s Central Bureau of Investigation (CBI) arrested a key player in a scam that trafficked Indian…
Bitcoin and Profit Metrics: Will History Repeat Itself?
Key Takeaways: Historical patterns reveal that when Bitcoin’s supply in profit falls below 50%, significant price rallies ensue.…
