Skip to content
Smart contracts Write-up Advanced

Aztec Multiple Spend Error Bug Fix Review

A multiple-spend error in Aztec's zero-knowledge proof system allowed an attacker to tamper with the residual calculation and overflow the modulus, enabling them to claim the entire output in each claim and drain the total value locked. The vulnerability could have led to the loss of approximately $5,000,000.

immunefi.com

Published on immunefi.com

On September 12th, 2023, the security researcher LonelySloth responsibly disclosed a Critical severity vulnerability from the Aztec Network codebase via Immunefi.

The author, on immunefi.com

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 residual calculation lacked a range check and the limb decomposition allowed an overflow of the modulus, enabling an attacker to manipulate the proof and claim the full output multiple times.

Impact

An attacker could have drained the entire total value locked (approximately $5,000,000) by exploiting the multiple-spend error, but the issue was mitigated before any funds were affected.

What the attacker needed

Access to Aztec Network; ability to submit claims

The fix

The vulnerability was fixed by deprecating the existing residual calculation and correcting the limb calculation to prevent overflow.

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.

In a zero-knowledge proof system, a user can prove they know a secret without revealing it. Aztec uses such proofs to handle deposits and withdrawals privately. A flaw in the code that checks these proofs let an attacker create fake proofs that appeared valid, so they could withdraw more money than they actually had, potentially emptying the entire pool.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.