Reproduced Exploit
Xyro UpDown — a price from 9 minutes after the end pays the wrong side
Each game has an end time, and the pot should be settled on the Chainlink report from that time. finalizeGame accepts any report whose timestamp is within 10 minutes after the end. A report from 9 minutes later has price 900 instead of the end price 1100. The down side takes both 100 stakes. The sa…
Chain
Other
Category
oracle
Date
Aug 2024
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. 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.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 45673-final-prices-within-a-threshold-of-10-minutes-are-accepted-l. Standalone Foundry PoC and full write-up: 45673-final-prices-within-a-threshold-of-10-minutes-are-accepted-l_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/oracle/stale-price·vuln/logic/price-calculation
Key info#
| Protocol | Xyro UpDown |
| Finding | Zokyo, AuditVault 45673 |
| Vulnerable code | finalizeGame freshness require |
| Harm | Down is paid 200. The end-time report pays up 200 on the control. |
| Chain | local synthetic |
TL;DR#
Each game has an end time, and the pot should be settled on the Chainlink report from that time. finalizeGame accepts any report whose timestamp is within 10 minutes after the end. A report from 9 minutes later has price 900 instead of the end price 1100. The down side takes both 100 stakes. The same game settled on the end-time report pays the up side 200.
The vulnerable code#
require(
priceTimestamp - endTime <= 10 minutes || block.timestamp - priceTimestamp <= 10 minutes,
"Old chainlink report"
);
The current xyro-io/smart-contracts tree checks priceTimestamp - endTime <= 1 minutes and drops the second clause. This reduction keeps the check the finding quotes.
Root cause#
The window is measured from endTime, not from an equality with endTime. Nine minutes of price movement is enough to cross the starting price, so the later report names the other winner.
Preconditions#
Both sides have staked 100. The starting price is 1000. The report at endTime is 1100. The report at endTime + 9 minutes is 900. The game master submits that later report. The first clause of the require is true, so the call does not revert.
Attack walkthrough#
- Up and down each lock 100.
endTimeis this block. finalizeGameis called with timestampendTime + 9 minutes.priceTimestamp - endTimeis 9 minutes, which is inside the 10 minute window.- Price 900 is below 1000, so the contract transfers 200 to down. Up's balance stays 0.
- The control contract accepts only
priceTimestamp == endTime. Price 1100 pays up 200. Down receives nothing.
Diagrams#
Impact#
The up player, who won on the price at endTime, receives none of the 200 pot. The down player is paid 200. The control, which requires the end-time report, pays that 200 to up.
Remediation#
Require the report timestamp to be the game end, not any timestamp inside a 10 minute band around it.
How to reproduce#
cd 45673-final-prices-within-a-threshold-of-10-minutes-are-accepted-l_exp
forge test -vv
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/45673-final-prices-within-a-threshold-of-10-minutes-are-accepted-l.md
- Zokyo report: https://github.com/solodit/solodit_content/blob/main/reports/Zokyo/2024-08-29-Xyro.md
- Game contract, fixed on main: https://github.com/xyro-io/smart-contracts/blob/main/contracts/UpDown.sol
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 45673-final-prices-within-a-threshold-of-10-minutes-are-accepted-l_exp (evm-hack-registry mirror).
- AuditVault finding: 45673-final-prices-within-a-threshold-of-10-minutes-are-accepted-l.
Alerts & third-party analyses
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.