Reproduced Exploit

Plaza: a flash-minted bond balance takes all 1000 coupons

Anyone can call startAuction once distributionPeriod has passed. This pool uses a period of 0, so the check passes in the deployment block. getIndexedUserAmount adds balance * sharesPerToken for each period since the user was last updated, and balance is the live balance. A flash loan mints 1000 bo…

Dec 2024•Ethereum•governance•4 min read

Loss

1000 coupons claimed by a flash mint. The existing 100-bond holder is paid 0

Chain

Ethereum

Category

governance

Date

Dec 2024

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 49235-h-6-malicious-user-can-leverage-flash-loans-to-claim-all-cou. Standalone Foundry PoC and full write-up: 49235-h-6-malicious-user-can-leverage-flash-loans-to-claim-all-cou_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/governance/flash-loan-attack · vuln/logic/reward-calculation

Key info#

FieldValue
Loss1000 coupons claimed by a flash mint. The existing 100-bond holder is paid 0
Vulnerable contractBondToken.getIndexedUserAmount
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2024-12
Compilersolc 0.8.27, cancun, via IR
Bug classstartAuction indexes the live bond balance, so a same-transaction mint is paid

TL;DR#

Anyone can call startAuction once distributionPeriod has passed. This pool uses a period of 0, so the check passes in the deployment block. getIndexedUserAmount adds balance * sharesPerToken for each period since the user was last updated, and balance is the live balance. A flash loan mints 1000 bonds, startAuction records 1e18 shares per bond, and the attacker claims all 1000 coupons, then burns the bonds. The holder who already had 100 bonds is paid 0 because the distributor is empty. A snapshot taken before the mint pays that holder 100 and the attacker 0.

Background#

Sherlock's December 2024 Plaza Finance contest, issue 725, H-6. Pool.startAuction calls BondToken.increaseIndexedAssetPeriod. Distributor.claim pays one coupon per indexed share. The report's attack is one transaction: flash-mint bonds, start the auction, distribute, claim, burn, repay.

The vulnerable code#

SOLIDITY
for (uint256 i = userPool.lastUpdatedPeriod; i < period; i++) {
    // @> VULN: the live bond balance is indexed for the period, so a same-transaction flash mint is paid
    shares += (balance * sharesPerTokenAt[i]) / (10 ** SHARES_DECIMALS);
}

startAuction stores sharesPerToken for the current period and increments the period. The claim then walks that period with whatever balanceOf is at claim time. The flash-minted 1000 bonds are still held, so the shares equal the full 1000 coupon distribution.

Root cause#

The index uses the balance at claim time, not a balance snapshotted before the auction. startAuction is permissionless, so the mint and the period change fit in one transaction. distributionPeriod of 0 makes the timestamp check true without warping the clock.

Preconditions#

  • An existing holder has 100 bonds. The distributor will receive 1000 coupons.
  • sharesPerToken is 1e18, so one bond earns one coupon share.
  • lastDistribution is 0 and distributionPeriod is 0. block.timestamp is 1, and auctionPeriod still covers this block.

Attack walkthrough#

  1. The flash lender mints 1000 bonds to the attacker.
  2. startAuction passes both time checks and stores the share index.
  3. distribute moves 1000 coupons into the distributor.
  4. The indexed share math credits the 1000-bond live balance.
  5. The attacker is paid 1000 coupons, then burns the bonds to repay the flash loan.
  6. The original holder's claim pays 0. Their 100 bonds are still in the wallet.
  7. The control snapshots balances before the mint. The holder receives 100 coupons and the attacker receives 0.

Diagrams#

flowchart TD A["Holder already has 100 bonds"] --> B["Flash loan mints 1000 bonds"] B --> C["startAuction stores sharesPerToken and advances the period"] C --> D["VULN indexes the live 1000 bond balance"] D --> E["Attacker claims 1000 coupons and burns the bonds"] E --> F["Existing holder is paid 0"] A --> G["Control snapshots the 100 bonds before the mint"] G --> H["Control pays the holder 100 and the attacker 0"]

Impact#

The existing holder receives none of the 1000 coupons. The attacker keeps the coupons after the flash loan is repaid. Every later distribution can be taken the same way by minting just before startAuction.

Remediation#

Snapshot bond balances before the period is closed, and pay from that snapshot. Do not let an arbitrary caller turn the period in the same transaction that minted the balance being indexed.

How to reproduce#

BASH
cd 49235-h-6-malicious-user-can-leverage-flash-loans-to-claim-all-cou_exp
forge test -vv

test_exploit_flash_mint_takes_every_coupon asserts the attacker holds 1000 coupons, the holder is paid 0, and the bond flash loan is repaid. test_control_snapshot_pays_the_existing_holder asserts the holder receives 100 and the post-snapshot mint receives 0. Captured output is output.txt.

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.