Skip to content
Race condition Write-up Advanced

Hijacking Phantom Shares: How a Cross-Contract Reentrancy in Panoptic Leads to Infinite Supply Inflation

The CollateralTracker contract in Panoptic performs an external call to the liquidator before updating the victim's share balance, violating the checks-effects-interactions pattern. A malicious liquidator can reenter during the call to transfer the victim's shares out, causing the contract to inflate the internal supply by a massive amount and potentially drain the vault.

rdin777 Follow

Published on blog.blockmagnates.com

In decentralized finance, the order of operations is everything. A single asset transfer executed prior to fully writing internal state changes to storage is one of the oldest and most devastating pitfalls in smart contract security.

rdin777, on blog.blockmagnates.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

Impact

The total supply of the pool is instantly inflated by a massive number, and the stolen phantom shares become real, backed claims that the attacker can redeem to completely drain the vault.

What the attacker needed

Attacker controls a smart contract as liquidator; victim has a balance in the collateral tracker; attacker can trigger settleLiquidation via the pool

The fix

The contract should follow the checks-effects-interactions pattern by updating all state before making external calls, and should add a reentrancy guard.

How it was found

  1. The attacker calls settleLiquidation via the pool with a small native ETH value to trigger the native transfer block.
  2. The attacker's contract receives the ETH and, inside its receive() fallback, calls transferFrom to move the victim's shares to a receiver.
  3. Control returns to settleLiquidation, which reads the victim's balance as zero and adds the difference to _internalSupply, inflating the total supply.

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.

Smart contracts sometimes call other contracts before finishing their own bookkeeping. If the called contract is malicious, it can run code that takes advantage of the unfinished state. Here, the attacker used that moment to steal the victim's shares, and the contract then mistakenly created a huge number of new shares.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More by rdin777

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.