Research
The Ghosts of Polymarket: When Off-Chain Matches Meet On-Chain Reverts
Polymarket matches trades in an off-chain order book but settles them on-chain, so an order can be reported as "filled" to both sides while its settlement transaction is still pending — and may still…

- arXiv
- 2606.16852
- Published
- 2026-06-15
- Authors
- Yiming Shen, Yuhan Jin, Shuohan Wu, Yanlin Wang, Jiachi Chen
AI summary
Overview
Research area: Blockchain security and DeFi measurement — specifically the security of hybrid (off-chain matching, on-chain settlement) prediction-market architectures, using Polymarket as the case study.
Technical level: Advanced. The paper assumes familiarity with EVM execution traces, ERC1155 receiver hooks, nonces, allowances, gas markets, and proxy-wallet patterns, though the core argument is stated in plain terms.
Scope: A one-year, trace-level measurement of every reverted matchOrders transaction on Polymarket, attributing a subset to deliberate attacker-induced cancellations, and then tracing the same design flaw across verified contracts on other chains.
What This Paper Is About
Polymarket matches trades in an off-chain order book but settles them on-chain, so an order can be reported as "filled" to both sides while its settlement transaction is still pending — and may still revert. The authors call this gap a Ghost Fill and ask whether it is a random operational nuisance or a structural vulnerability that attackers deliberately exploit for profit and that has spread to other projects through code reuse. Their goal is to measure how often and how expensively this happens, explain the mechanisms attackers use, and check whether the flawed exchange design has been copied elsewhere.
Key Contributions
- Names and characterizes a new failure mode. The paper defines Ghost Fills (a user-side phenomenon: an off-chain fill whose on-chain settlement reverts) and Cancellation Attacks (the attacker-side behavior that deliberately manufactures them), organized into four attack vectors: Nonce Bump, Balance Drain, Allowance Revoke, and Proxy Trap.
- Builds GhostHunter, a trace-based analysis pipeline that collects reverted
matchOrderstransactions, decodes calldata and execution traces into a relational fact schema, and applies vector-specific rules in a fixed priority order to attribute reverts to attacks. It reports 994,196 attributed reverts and catalogs 37 implementation variants across the four vectors. - Quantifies the cost to users and to the operator — 2,037,304 reverted settlements overall, $103.7 M in net losses avoided by cancelled orders, 2.36 M POL burned in total operator gas (2.17 M POL, about $162 K, from attacks alone), and a de facto DoS at peak with 24.3% of transactions reverting in one hour.
- Measures cross-chain propagation by scanning 32,103,371 Sourcify-verified contracts across 401 chains with a Jaccard similarity score over function-selector sets, finding 167 Polymarket-like deployments on 10 chains holding at least $23 M, and confirming Ghost Fills on four of them (including the two largest). The authors disclosed evidence to affected parties and release artifacts at a public GitHub repository.
Main Findings
-
Ghost Fills are pervasive. 2,037,304 reverted
matchOrderstransactions involving 261,156 distinct participants were found between Aug 15, 2025 and Aug 15, 2026. V1 contributed 1,090,017 and V2 contributed 947,287, but V2 reached 862,423 in its first week at comparable daily settlement volume — meaning V2's daily revert rate runs more than an order of magnitude above V1's. -
Peak severity reached de facto denial of service. On the worst day, 8.5% of all
matchOrderstransactions reverted. The worst hour was May 4, 2026, between 11:00 and 12:00 UTC, when 23,596 of 97,048 transactions (24.3%) reverted. After the May 4, 2026 Deposit Wallet upgrade, the daily rate fell from roughly 8% to 0.3% within two days, then averaged 0.04% and never exceeded 0.25% for the rest of the window. -
Two failure surfaces dominate. Insufficient balance accounts for 1,069,773 reverts (52.5%) and a reverted ERC1155 callback for 804,241 (39.5%). Insufficient allowance covers 70,551 (3.5%), operator-side order validation 43,999 (2.2%), user-side order validation 25,790 (1.3%, all
InvalidNonceand all pre-V2), V2-only fee computation 21,076 (1.0%), condition token 803, and other/unknown 1,071. The taxonomy covers 99.9% of reverts. -
Removing the nonce did not remove the problem. V2 eliminated
incrementNonce(), yet the dominant failure surface simply shifted: under V1, balance reverts lead (946,669); under V2, the ERC1155 callback surface dominates (748,119 of 947,287). -
Nearly half of reverts are deliberate. 994,196 of the 2,037,304 Ghost Fills (48.8%) are attributed to attacks across 37 variants. These place $1.46 B of collateral at risk and burn 2.17 M POL (about $162 K) in operator gas, which is 92% of all gas burned by reverts.
-
Some reverts self-identify as intentional. A handful of transactions carry custom strings compiled into wallet code, including
GRIEFING_ACTIVE,poc-v4: griefing on, andghost-fill: receiver invalidated. -
Attacks are concentrated but widespread. The busiest participant appears in 122,753 reverts (6.0%); the top ten account for 11.1%, the top 100 for 32.8%, and the top 1,000 for 69.8%, with the remainder spread across more than 260,000 participants.
-
Ghost Fills cluster in fast markets. The most common market tags are Crypto, Up or Down, and 5Min, each tied to more than one million reverts; the most affected individual markets are five-minute Bitcoin direction markets. High-stakes events also appear — "English Premier League Winner" alone has 14,902 reverts and $2.8 M of collateral at risk, and it is a NegRisk multi-outcome market.
-
The economic motive is measurable as avoided loss. Had the attacked orders settled, their owners would have lost $103.7 M net, or 73 cents per dollar of notional. Attackers use the window for risk-free prediction, arbitrage-bot hunting, and liquidity-reward manipulation, and deploy Sybil strategies (mass disposable wallets, laundered gas funds) to blunt per-account blacklisting.
-
The design flaw has escaped Polymarket. After scanning 32,103,371 verified contracts, the authors find 167 independent Polymarket-like deployments on 10 chains holding at least $23 M in user funds, including 71 with an identical function-selector set. Four of these were confirmed to exhibit Ghost Fills, including the two largest.
-
Context is not the vulnerability by itself. The same settlement gap is largely harmless in NFT trading but becomes profitable in prediction markets, where a reported fill is worth voiding.
-
Mitigation is partial. Polymarket shipped fixes after three rounds of responsible disclosure, but an off-chain fill remains provisional until on-chain settlement succeeds; as of writing, Ghost Fills persist.
Methodology in Plain English
The authors start with the public record. They pull every transaction sent to Polymarket's settlement contracts on Polygon whose receipt shows failure, over a defined one-year window spanning both protocol generations, and then retrieve the full execution trace of each one from an archive node. They decode the transaction's calldata to recover who the orders belonged to and what amounts were owed, and they decode the trace to find which internal call failed and why. They map each revert reason back to the specific require or revert line in the official source code, which lets them group failures into a small set of "failure surfaces."
To decide whether a failure was an accident or an attack, they represent each case as a set of simple facts — this order carried nonce N, this call failed with this error, this account's balance dropped below what was needed at this moment — and then write rules that match one attack shape at a time. A nonce-bump rule, for instance, requires an InvalidNonce failure plus a preceding transaction in which the same owner successfully called incrementNonce(). Because no labelled ground-truth dataset of attacks exists, they build the rules by snowball sampling: inspect failures by revert reason, encode any recurring mechanism, rerun, audit for false positives, and sample the leftovers until nothing new appears.
For the cross-chain question, they use each contract's set of four-byte function selectors as a fingerprint, compare every verified contract against Polymarket's official exchanges with a Jaccard score, keep the close matches (494 candidates scored J ≥ 0.5), filter out testnets and unused contracts, and then have two authors independently read the source of each candidate to confirm it really implements a Polymarket-like hybrid exchange.
Why This Matters
Impact on research. The paper reframes a mundane operational metric — the revert rate — as a security signal in hybrid architectures. It also demonstrates a reusable methodology: encoding attacker behavior as conjunctions over on-chain relational facts, and using function-selector similarity as a cheap first pass for finding inherited vulnerabilities at ecosystem scale.
Real-world applications:
- Protocol risk assessment. Exchanges can use revert-rate decomposition as an early-warning indicator, distinguishing incidental failures from engineered ones by checking for a causal transaction between match and settlement.
- Operator cost control. Because the operator pays gas even for reverted settlements, quantifying attack-driven gas burn (2.17 M POL, 92% of all revert gas) gives a concrete budget argument for architectural changes.
- Auditor and fork due diligence. The selector-similarity scan gives auditors a way to find forks that inherited a risky settlement design before depositing users are exposed.
- Bot and agent design. Trading bots and AI agents that act on a reported fill need to treat that fill as provisional; the paper's core warning is aimed directly at them.
Industry relevance. The finding that 167 deployments on 10 chains hold at least $23 M under a similar design, and that V2's redesign merely relocated the failure surface to token-delivery callbacks rather than closing the gap, matters to anyone building or securing an order-book-style DEX on an EVM chain.
Future Directions
- Closing the gap architecturally. The paper shows that removing a single vector (the nonce) and reducing the aggregate rate do not eliminate Ghost Fills. An open question is what settlement design — escrow at match time, optimistic fills with bonding, or atomic off-chain commitments — removes the provisional-fill window rather than shrinking it.
- Extending attribution to the other half. 994,196 of 2,037,304 reverts are attributed to attacks; the rules-based approach leaves the remaining cases unattributed. Larger-scale or model-assisted attribution could reveal vectors beyond the four catalogued here.
- Auditing the 167 reused deployments. The authors confirm Ghost Fills on four of them, including the two largest, but the other deployments on 10 chains remain unmeasured. A per-deployment audit and remediation campaign is the obvious next step, particularly for the 71 selector-identical copies.
- Defending against Sybil-scaled adversaries. Attackers mass-produce disposable wallets and launder gas payments, weakening per-account blacklisting. Mitigation research would need to target behavior across accounts rather than addresses in isolation.
Target Audience
Smart-contract security researchers and auditors; DeFi protocol engineers and architects, especially those building order-book or hybrid exchange designs; MEV and trading-bot developers who consume fill feeds; and risk or compliance analysts who need to reason about provable, on-chain evidence of market manipulation. Prediction-market operators evaluating a fork or an inherited codebase will find the reuse analysis directly actionable.
Authors’ abstract
Polymarket has emerged as a prominent prediction market platform and one of the fastest-growing applications in DeFi. To achieve low-latency trading, it adopts a hybrid architecture that matches orders off-chain but settles them on-chain for final execution. This design creates a consistency gap we call Ghost Fills: an order that is successfully matched off-chain may later fail during on-chain settlement. To understand the security implications of this gap, we investigate…
The full abstract on arXiv