Reproduced Exploit

Xyro UpDown — a late report refunds the loser and the winner only gets their stake

Two hours after the end, the report still on hand is 30 minutes old. It is more than 10 minutes after endTime and more than 10 minutes before the current block, so both clauses of the freshness check fail and finalizeGame reverts. The game master refunds every player, including the side that lost.…

Aug 2024•Other•oracle•3 min read

Chain

Other

Category

oracle

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: 45672-finalizing-a-game-after-10-minutes-will-lock-users-earned-fu. Standalone Foundry PoC and full write-up: 45672-finalizing-a-game-after-10-minutes-will-lock-users-earned-fu_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/oracle/stale-price · vuln/logic/wrong-condition

Key info#

ProtocolXyro UpDown
FindingZokyo, AuditVault 45672
Vulnerable codefinalizeGame freshness require
HarmDown is refunded 100. The end-time report pays up 200 on the control.
Chainlocal synthetic

TL;DR#

Two hours after the end, the report still on hand is 30 minutes old. It is more than 10 minutes after endTime and more than 10 minutes before the current block, so both clauses of the freshness check fail and finalizeGame reverts. The game master refunds every player, including the side that lost. The true winner gets their 100 stake back, not the 200 pot. Submitting the report from endTime itself still pays the winner 200.

The vulnerable code#

SOLIDITY
require(
    priceTimestamp - endTime <= 10 minutes || block.timestamp - priceTimestamp <= 10 minutes,
    "Old chainlink report"
);

A report timestamp equal to endTime still passes the first clause at any later block. A report that is merely "recent" does not, once it is more than 10 minutes after the end and more than 10 minutes old.

Root cause#

The check is an OR of two windows. It does not mean "you may finalize only within 10 minutes." It rejects the report that is actually available after a delay, and the only recovery in this reduction is refund, which returns stakes to both sides.

Preconditions#

The block timestamp is 1700000000. endTime is two hours earlier. The available report is from 30 minutes ago, so it is 90 minutes after the end. The end-time price is 1100 and the later price is 900. Starting price is 1000. Each side staked 100.

Attack walkthrough#

  1. The game is opened with endTime = block.timestamp - 2 hours.
  2. finalizeGame is called with the 30-minute-old report.
  3. Both comparisons fail and the require reverts.
  4. refund sends 100 to up and 100 to down.
  5. The control is finalized with priceTimestamp == endTime. Price 1100 pays up 200. Down receives 0.

Diagrams#

flowchart TD A["Game ended two hours ago"] --> B["Report from 30 minutes ago"] B --> C["VULN: both freshness clauses fail"] C --> D["Refund pays both sides 100"] D --> E["End-time report pays the winner 200"]

Impact#

Down, who lost on the end-time price, is refunded 100 instead of losing that stake. Up is paid 100 rather than 200. The control pays up the full 200 and pays down nothing.

Remediation#

Accept the report from endTime at any later block, and reject every other timestamp. Do not force a full refund when finalizing is merely late.

How to reproduce#

BASH
cd 45672-finalizing-a-game-after-10-minutes-will-lock-users-earned-fu_exp
forge test -vv

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.