Reproduced Exploit

Flayer: cancelling a collection shutdown does not return the votes

_vote pulls a voter's entire collection-token balance into CollectionShutdown. Once quorum is reached and total supply grows past MAX_SHUTDOWN_TOKENS, cancel() deletes the shutdown record and emits nothing back. Both voters stay at 0. The contract still holds 2 tokens.

Aug 2024•Ethereum•dos•3 min read

Loss

Two voters lose 1 collection token each. The shutdown contract keeps both

Chain

Ethereum

Category

dos

Date

Aug 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: 41748-h-10-the-users-who-voted-for-collection-shutdown-will-lose-t. Standalone Foundry PoC and full write-up: 41748-h-10-the-users-who-voted-for-collection-shutdown-will-lose-t_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/dos/frozen-funds · vuln/logic/missing-check

Key info#

FieldValue
LossTwo voters lose 1 collection token each. The shutdown contract keeps both
Vulnerable contractCollectionShutdown.cancel
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · local · 2024-08
Compilersolc 0.8.27, cancun
Bug classState deleted without refunding escrowed votes

TL;DR#

_vote pulls a voter's entire collection-token balance into CollectionShutdown. Once quorum is reached and total supply grows past MAX_SHUTDOWN_TOKENS, cancel() deletes the shutdown record and emits nothing back. Both voters stay at 0. The contract still holds 2 tokens.

Background#

Sherlock contest 2024-08-flayer, issue 261, reported by g and many others. The judging proof mints extra supply so cancel passes the total-supply check, then logs both voter balances as 0.

The vulnerable code#

SOLIDITY
params.collectionToken.transferFrom(msg.sender, address(this), userVotes);
// ...
delete _collectionParams[_collection]; // @> VULN: vote escrow is deleted and never refunded

The report's fix records the voter list and transfers shutdownVoters[collection][voter] back before the delete.

Root cause#

The escrow is recorded in shutdownVoters, but cancel only deletes _collectionParams. There is no loop that pays the voters.

Preconditions#

  • Two holders vote with 1 token each, so quorum is met.
  • Someone mints one more token so totalSupply is above MAX_SHUTDOWN_TOKENS.
  • cancel is called.

Attack walkthrough#

  1. Voter 1 and voter 2 each receive 1 collection token. A third token is minted to another address.
  2. Each vote transfers the voter's full balance into the shutdown contract.
  3. canExecute becomes true.
  4. cancel sees supply 3 above the cap of 2 and deletes the record.
  5. Both voter balances are 0. The contract balance is 2.

Diagrams#

flowchart TD A["Two voters each hold 1 collection token"] --> B["vote pulls both balances into the contract"] B --> C["Quorum is reached"] C --> D["Extra supply lets cancel pass the cap"] D --> E["VULN delete drops the vote record"] E --> F["Voters stay at 0 and the contract keeps 2 tokens"]

Impact#

Each voter loses the collection tokens they escrowed. In this run that is 1 token per voter, 2 tokens held by CollectionShutdown after the shutdown can no longer execute. The control cancelFixed returns both tokens and leaves the contract at 0.

Remediation#

Track voters and, inside cancel, transfer each recorded vote back before deleting the shutdown state, as recommended on issue 261.

How to reproduce#

BASH
cd 41748-h-10-the-users-who-voted-for-collection-shutdown-will-lose-t_exp
forge test -vv

test_exploit_cancel_keeps_both_votes asserts both voters at 0 and the contract at 2 ether. test_control_cancel_refunds_voters asserts both voters back at 1 ether. 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.