Reproduced Exploit
XPress Protocol: post_only bids pay a 100 ether aggressive commission
placeOrder is supposed to return 0 when a post_only bid has price_id =. A passive bid at price 90 against a best ask of 100 is therefore matched, and the bidder pays the aggressive commission: 1% of a 10,000 ether notional, which is 100 ether. The corrected comparison charges 0.
Loss
100 ether of quote paid as an aggressive commission on a passive post_only bid
Chain
Ethereum
Category
untagged
Date
May 2024
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
The attack replays in your browser. Step through it by Solidity line or by opcode.
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: 53800-incorrect-condition-for-post-only-orders-mixbytes-none-xpres. Standalone Foundry PoC and full write-up: 53800-incorrect-condition-for-post-only-orders-mixbytes-none-xpres_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/logic · vuln/defi
Reproduction: a self-contained Foundry PoC that compiles and runs offline with only
forge-std- no fork and no RPC. PoC: test/53800-incorrect-condition-for-post-only-orders-mixbytes-none-xpres_exp.sol.
Key info#
| Field | Value |
|---|---|
| Loss | 100 ether of quote paid as an aggressive commission on a passive post_only bid |
| Protocol | XPress Protocol |
| Bug class | Inverted post_only comparison in placeOrder |
| Source | AuditVault finding |
| Report | MixBytes, XPress Protocol OnchainCLOB |
| Chain / block / date | Ethereum model · block 0 · 2024-05 |
| Compiler | solc 0.8.27, cancun, via IR |
TL;DR#
placeOrder is supposed to return 0 when a post_only bid has price_id <= askTree.best_offer(). The sign is flipped to >=. A passive bid at price 90 against a best ask of 100 is therefore matched, and the bidder pays the aggressive commission: 1% of a 10,000 ether notional, which is 100 ether. The corrected comparison charges 0.
The vulnerable code#
uint256 best = askTree.best_offer();
// @> VULN: inverted. Auditors require `if (price_id <= best) return 0`.
bool reject = price_id >= best;
if (post_only && reject) {
return 0;
}
uint256 fee = notional * AGGRESSIVE_FEE_BPS / 10_000;
Root cause#
The reject flag is price_id >= best. For every passive bid priced below the best ask that expression is false, so the function falls through into the aggressive fill and charges AGGRESSIVE_FEE_BPS. Flipping the sign, as the auditors wrote (price_id <= best), returns 0 before any commission is taken.
Preconditions#
- Any trader can call
placeOrder. No role is required. - An ask is resting at price id 100.
- The bidder submits
post_only = trueat price id 90 with quantity 10,000. - Aggressive commission is 100 bps. Passive orders are not meant to pay it.
Attack walkthrough#
- Read best ask = 100.
- Evaluate
price_id >= bestfor a bid at 90. The flag is false. - Skip the early return that should have rejected the post_only order.
- Price the fill at quantity * 1 ether = 10,000 ether.
- Charge 1% = 100 ether and pull it from the bidder.
- Return order id 1, i.e. the bid matched.
Diagrams#
Impact#
The bidder pays 100 ether that a passive post_only order is not supposed to pay. Every post_only bid priced below the touch takes this path. The control, using price_id <= best, returns 0 and pulls nothing.
Remediation#
Return 0 when post_only and price_id <= askTree.best_offer(), before the aggressive fee is computed.
How to reproduce#
cd 53800-incorrect-condition-for-post-only-orders-mixbytes-none-xpres_exp
forge test -vv
run() is the harm path. The control test uses the corrected comparison or guard and does not produce the loss number.
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 53800-incorrect-condition-for-post-only-orders-mixbytes-none-xpres_exp (evm-hack-registry mirror).
- AuditVault finding: 53800-incorrect-condition-for-post-only-orders-mixbytes-none-xpres.
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.