Reproduced Exploit
Harmonix Finance: Any unprivileged EOA calls the unprotected public testFinalizeSettlement() to flip settlem
Chain
Other
Category
untagged
Date
Jan 1970
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
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.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 63976-h-01-anyone-can-finalize-the-sale-early-via-testfinalizesett. Standalone Foundry PoC and full write-up: 63976-h-01-anyone-can-finalize-the-sale-early-via-testfinalizesett_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/theft · vuln/locked-funds
Reproduction: a faithful minimal reproduction of the vulnerable finding — the vulnerable function is reproduced verbatim (marked
@>) with faithful minimal doubles; local deploy, no fork.
Root cause#
Any unprivileged EOA calls the unprotected public testFinalizeSettlement() to flip settlementFinalized=true, after which every buyer's purchase() reverts permanently (both a fresh buyer and an existing buyer are frozen out); the sale is bricked and allocations locked at an attacker-chosen block. No theft; the blocked payment magnitude (1000e18) is marked to the SINK.
// ── VERBATIM vulnerable function from the finding (contracts/token_sales/
// HarTokenSale.sol#L182-L185). External, no owner check, no time check. ──
function testFinalizeSettlement() external { // @> unprotected public finalize: any EOA flips settlementFinalized and permanently freezes purchase()
require(!settlementFinalized, "Settlement: finalized");
_finalizeSettlement();
Why it's exploitable here#
Any unprivileged EOA calls the unprotected public testFinalizeSettlement() to flip settlementFinalized=true, after which every buyer's purchase() reverts permanently (both a fresh buyer and an existing buyer are frozen out); the sale is bricked and allocations locked at an attacker-chosen block. No theft; the blocked payment magnitude (1000e18) is marked to the SINK.
Attack path#
Marked-line walkthrough (Playground)#
The EVM Playground pins each step to the exact executed source line in 0x671d353a77…:
- L98 — Reject zero-amount purchase:
purchase()rejects a zero buy amount — a normal buyer-path guard that early finalization will soon make unreachable. - L106 — Unprotected public finalize function: Root-cause bug:
testFinalizeSettlement()isexternalwith no owner or access check, so any EOA can finalize the sale early. - L107 — Guard against double finalize: The lone guard only blocks re-finalizing; it does nothing to stop an unauthorized first caller from triggering it.
- L111 — Internal settlement finalizer: Internal routine the unprotected wrapper calls to flip the sale into its finalized state.
- L112 — Flip settlementFinalized flag: Sets
settlementFinalized = true; from here every buyer'spurchase()reverts and allocations lock permanently. - L123 — Owner state variable: Setup: the privileged
ownerthat finalize should have been restricted to but never is. - L128 — Per-buyer accepted allocations: Setup: tracks each buyer's accepted allocation, frozen at whatever block the attacker chose to finalize.
PoC#
Registry (Foundry, local deploy — verbatim vulnerable source + harm-asserting test + negative control):
cd 63976-h-01-anyone-can-finalize-the-sale-early-via-testfinalizesett_exp
forge test -vvv
The browser Playground replays the same synthetic opcode-for-opcode and measures the harm: Any unprivileged EOA calls the unprotected public testFinalizeSettlement() to flip settlementFinalized=true, after which every buyer's purch. Both gates are green (registry forge test PASS + Playground _verify-poc VERDICT: PASS).
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 63976-h-01-anyone-can-finalize-the-sale-early-via-testfinalizesett_exp (evm-hack-registry mirror).
- AuditVault finding: 63976-h-01-anyone-can-finalize-the-sale-early-via-testfinalizesett.
- Upstream DeFiHackLabs PoC directory: src/test.
Alerts & third-party analyses
- DeFiHackLabs incident explorer: search "Harmonix Finance: Any unprivileged EOA calls the unprotected public testFinalizeSettlement() to flip settlem".
- 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.