Optimism Infinite Money Duplication Bug Fix Review
A critical vulnerability in Optimism's OVM 2.0 allowed an attacker to duplicate Ether by repeatedly self-destructing a contract, because the balance was not properly zeroed in the ERC-20 storage. This could have let an attacker create unlimited OETH and drain DEXes and bridges, risking $322.5M in total value locked.
immunefi.com
Published on immunefi.com
On February 2, whitehat Jay Freeman (Saurik), known for developing Cydia, reported a critical vulnerability in the Optimism protocol, a Layer 2 (L2) scaling solution for Ethereum. The bug itself would have allowed an attacker to replicate money continuously on any chain using a vulnerability found in OVM 2.0.
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 Optimism client set the account balance to zero directly on the state object after self-destruct, instead of redirecting the balance change to the OVM_ETH contract's storage as required when UsingOVM is active.
Impact
An attacker could have created unlimited OETH and used it to drain DEXes and bridge assets, potentially stealing a large portion of Optimism's $322.5M total value locked.
What the attacker needed
Ability to deploy contracts on Optimism; Some initial Ether to fund the exploit contract
The fix
The bug was fixed in a GitHub pull request by Optimism.
How it was found
- Create an exploit contract with two internal functions: one that calls selfdestruct and sends the contract's balance to itself, and another that withdraws the contract's balance to the caller.
- Deploy the contract and in its constructor call the selfdestruct function multiple times in a loop.
- After the loop, call the second function to transfer the inflated funds to the attacker.
- The exploit contract is destroyed at the end of the transaction.
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.
Optimism is a system that makes Ethereum transactions faster and cheaper by processing them off the main chain. A mistake in its code meant that when a certain type of contract was deleted, its money was not actually removed from the system, so it could be spent again and again. This would let someone create fake money out of thin air.
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.