Reproduced Exploit
Buffer market direction is chosen at close, guaranteeing a winning trade
Chain
Other
Category
signature
Date
Jul 2023
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: 55635-h-03-market-direction-signature-can-be-abused-if-privatekeep. Standalone Foundry PoC and full write-up: 55635-h-03-market-direction-signature-can-be-abused-if-privatekeep_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/signature/replay · impact/loss-of-funds/locked-funds · reward-accounting
Reproduction: the test deploys the REAL audited Buffer v2.5
BufferRouter+BufferBinaryOptions+BufferBinaryPooland drives the realcloseAnytimepath with private keeper mode disabled. Because the trade DIRECTION is never committed on-chain at open, the trader signs whichever direction is winning after seeing the closing price — draining LP funds on a trade that should have lost.
Root cause#
Neither the QueuedTrade nor the Option struct stores the market direction (isAbove). The
direction is only supplied and checked at close time, in
BufferRouter.closeAnytime:
if (!Validator.verifyMarketDirection(params, queuedTrade, optionInfo.signer)) {
emit FailUnlock(params.optionId, params.targetContract, "Router: Wrong market direction");
continue;
}
verifyMarketDirection only checks that params.isAbove matches a signature from
optionInfo.signer — which is the trader's own 1CT key. Since the direction was never
committed at open, and the trader controls their own signing key, they simply observe the
closing price and sign whichever direction wins. With private keeper mode disabled the trader
can call closeAnytime themselves.
Exploit walkthrough (numbers from the test)#
- An LP seeds the pool with 1,000 USDC. A trader opens an ETH/USD option, strike
1000, locking 100 USDC. The closing price ends below strike at900. - Honest control: a trader who had committed to a call (
isAbove = true) loses — the option is out-of-the-money and expires worthless, paying 0. - Exploit: on an identical option at the identical price, the attacker signs a put
(
isAbove = false) at close. Now!isAbove && closingPrice < strikeis true, so the option is in-the-money and pays the full 100 USDC. - The attacker wins on every trade regardless of price direction, draining LP funds risk-free.
The negative control (an honest committed call paying 0 at the same price) proves the win comes purely from choosing the direction after the outcome is known.
Fix#
Commit the direction at open — e.g. store a hash of (direction, salt) with the queued trade and
reveal it at close. Buffer's remediation
(PR #4) removes the ability to
disable private keeper mode.
Reproduction#
- Registry PoC:
_shared/run-poc/run_poc.sh 55635-h-03-market-direction-signature-can-be-abused-if-privatekeep_exp -vvvvv - Real audited source under
src/at commit84b6060b4447b2550de595202e8820c7f515988b.
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 55635-h-03-market-direction-signature-can-be-abused-if-privatekeep_exp (evm-hack-registry mirror).
- AuditVault finding: 55635-h-03-market-direction-signature-can-be-abused-if-privatekeep.
- Upstream DeFiHackLabs PoC directory: src/test.
Alerts & third-party analyses
- DeFiHackLabs incident explorer: search "Buffer market direction is chosen at close, guaranteeing a winning trade".
- 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.