Balancer Logic Error Bug Fix Review
A logic error in the Merkle Orchard contract allowed a liquidity provider to submit duplicate claims in a single transaction, bypassing the claimed-bits check and draining all assets from the Vault. An attacker could repeatedly claim the same reward, receiving multiple times the entitled amount.
immunefi.com
Published on immunefi.com
On January 22, 2023, whitehat 0xriptide reported a high severity vulnerability to the Balancer protocol, a community-driven DeFi liquidity infrastructure provider. The bug itself would allow liquidity providers to submit duplicate claims to drain all the Merkle Orchard’s assets from the Vault.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The contract failed to set claimed bits for duplicate claims within the same transaction, allowing the claim amount to accumulate without verification.
Impact
An attacker could drain all vulnerable funds from the Merkle Orchard, which held around $3.2 million across Ethereum, Polygon, and Arbitrum at the time of the report.
What the attacker needed
A valid claim (distribution ID, amount, Merkle proof); access to the Merkle Orchard contract
The fix
Balancer mitigated the issue by creating new distributions to move Merkle Orchard tokens to the Balancer Treasury address on each network, with a patched Merkle Orchard to be deployed later.
How it was found
- Obtain a valid claim (distribution ID, amount, Merkle proof) from a past transaction.
- Create an array with the same claim repeated multiple times.
- Call claimDistributions with the array and the token.
- The contract processes each duplicate, accumulating the claim amount without setting bits until the last element.
- The final claim is verified and the total accumulated amount is withdrawn from the Vault.
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 write-up has not been written yet. The Original tab links to the source.
A smart contract for distributing rewards had a flaw: it didn't properly check if a claim was already made when the same claim appeared multiple times in one transaction. This let someone claim the same reward over and over, taking more funds than they should.
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.