Reproduced Exploit

Frankencoin — Transfer position ownership to address(0) DoSes end()

1. Owner about to lose a challenge calls transferOwnership(address(0)). 2. Winning bid creates an excess refund path in end(). 3. zchf.transfer(owner, excess) reverts because recipient is zero. 4. Bid ZCHF and challenger collateral stay locked in the hub forever.

Apr 2023Otheruntagged3 min read

Chain

Other

Category

untagged

Date

Apr 2023

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. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 20019-h-04-transfer-position-ownership-to-addr0-to-dos-end-challen. Standalone Foundry PoC and full write-up: 20019-h-04-transfer-position-ownership-to-addr0-to-dos-end-challen_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/frozen-funds · vuln/ownership-transfer · vuln/dos-resistance

Reproduction: self-contained Foundry PoC with only forge-std — no fork, no RPC. Full trace: output.txt. PoC: test/20019-h-04-transfer-position-ownership-to-addr0-to-dos-end-challen.sol.


Key info#

ImpactHIGH — position owner sets owner = address(0); MintingHub.end refunds excess bid to owner and reverts on ZCHF's zero-address guard, permanently locking the winning bid and the challenger's escrowed collateral
ProtocolFrankencoin
Vulnerable codeMintingHub.endzchf.transfer(owner, excess) + ERC20 _transfer require(recipient != address(0)); enabler: unbounded transferOwnership
Bug classOwnership transfer to zero → settlement DoS → frozen funds
FindingCode4rena — Frankencoin, 2023-04 · #20019 · reporter 141345
Reportcode4rena.com/reports/2023-04-frankencoin
SourceAuditVault
StatusAudit finding — confirmed by Frankencoin
Compiler^0.8.24 (PoC)

TL;DR#

  1. Owner about to lose a challenge calls transferOwnership(address(0)).
  2. Winning bid creates an excess refund path in end().
  3. zchf.transfer(owner, excess) reverts because recipient is zero.
  4. Bid ZCHF and challenger collateral stay locked in the hub forever.

The vulnerable code#

SOLIDITY
// MintingHub.end — excess refund
if (effectiveBid > fundsNeeded) {
    // @> VULN: reverts when owner is address(0)
    zchf.transfer(owner, effectiveBid - fundsNeeded);
}

// ERC20._transfer
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
    require(recipient != address(0)); // zero-address guard
    ...
}

Fix: disallow transferOwnership(address(0)); optionally skip/burn excess when owner is zero.

Root cause#

Settlement always tries to refund excess bid to the current position owner. Ownership is transferable to the zero address, and the ZCHF ERC20 forbids transfers to zero — so a malicious (or desperate) owner can brick every end() that would pay them a refund.

Attack walkthrough#

  1. Challenge + winning bid escrowed (period 0 so end is immediate).
  2. Owner calls transferOwnership(address(0)).
  3. Anyone calls end() → excess refund reverts.
  4. Bid and challenger collateral remain in the hub; challenge never clears.

Diagrams#

flowchart TD A["Owner transferOwnership(address 0)"] --> B["Bidder escrow locked in hub"] B --> C["end tries zchf.transfer owner excess"] C --> D{"recipient == 0?"} D -->|"yes"| E["revert - end DoSed"] E --> F["Bid + challenger collateral frozen"]

Impact#

  • Successful bidder loses the bid fund (locked, unrecoverable via end).
  • Challenger loses escrowed collateral and challenge reward.
  • Liquidation / challenge settlement for that position is permanently bricked when excess would be refunded.

Taxonomy#

  • genome: frozen-funds, ownership-transfer, dos-resistance, reward-accounting
  • sector: lending, token
  • severity: high
  • platform: code4rena

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.