Skip to content
Business logic Write-up Advanced

Balancer

A logic error in the MerkleOrchard contract allowed a user to submit duplicate claims in a single transaction, bypassing the check that marks a claim as completed. An attacker could drain the MerkleOrchard's balance from the Balancer Vault on Mainnet, Polygon, and Arbitrum, stealing unclaimed yield from other liquidity providers.

mirror.xyz

Published on mirror.xyz

The existence of a bug bounty should be a positive signal for users/investors when deciding where to put their capital to work. It will attract hackers to the protocol in an attempt to find vulnerabilities, report those vulnerabilities, and get paid for their work.

The author, on mirror.xyz

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

Likely the claim-marking logic only sets the claimed bits after processing all claims in the loop, so duplicate claims within the same transaction are not detected and each is paid out.

Impact

An attacker could steal multiples of their initial claim amount, up to the MerkleOrchard balance of about $3.2 million across three chains, limited only by gas and that balance; no other vault funds were at risk.

What the attacker needed

Be a liquidity provider with a claim; submit multiple identical claims in one transaction

How it was found

  1. An existing liquidity provider calls claimDistributions with multiple identical claims in one transaction.
  2. The function loops over the claims, and for each duplicate the condition currentWordIndex == distributionWordIndex evaluates to true, skipping the marking of the claim as completed.
  3. Only after the last claim in the array does the code call _setClaimedBits, so the earlier duplicates are not marked and are paid out.
  4. The function then calls the Balancer Vault, which releases the tokens to the caller for each duplicate claim.

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.

The MerkleOrchard contract lets liquidity providers claim token rewards. It is supposed to mark each claim as used so it cannot be claimed again. A mistake in the code meant that if someone submitted the same claim many times in one transaction, only the last one was marked as used, so the earlier duplicates were paid out again and again.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.