Reproduced Exploit
Origin: a malicious ERC20 currency bricks an accepted offer
makeOffer stores any address as the offer currency. paySeller then requires that currency's transfer to succeed. A token that reverts on transfer makes finalize revert, so an accepted offer can never be completed. The seller's balance stays 0.
Loss
The seller cannot finalize. Offer status stays accepted and the seller receives 0
Chain
Ethereum
Category
dos
Date
Nov 2018
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: 17097-remote-code-execution-through-arbitrary-erc20-implementation. Standalone Foundry PoC and full write-up: 17097-remote-code-execution-through-arbitrary-erc20-implementation_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/dos/frozen-funds·vuln/logic/missing-check
Key info#
| Field | Value |
|---|---|
| Loss | The seller cannot finalize. Offer status stays accepted and the seller receives 0 |
| Vulnerable contract | Marketplace.paySeller |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2018-11 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | Untrusted ERC20 used as the offer currency |
TL;DR#
makeOffer stores any address as the offer currency. paySeller then requires that currency's transfer to succeed. A token that reverts on transfer makes finalize revert, so an accepted offer can never be completed. The seller's balance stays 0.
Background#
Trail of Bits' November 2018 Origin Protocol review. The report calls the issue remote code execution through an arbitrary ERC20. The concrete effect in paySeller is a grief: Bob offers a token that reverts on every transfer, Alice accepts, and finalization can never succeed. The short-term fix is a revoke path that does not call the currency. The long-term fix is a currency whitelist.
The vulnerable code#
require(IERC20(offer.currency).transfer(offer.buyer, offer.refund), "Refund failed"); // @> VULN
require(IERC20(offer.currency).transfer(listing.seller, value), "Transfer failed");
The first transfer reverts, so the seller payout on the next line never runs and the offer status is never set to finalized.
- require(offer.currency.transfer(offer.buyer, offer.refund), "Refund failed");
- require(offer.currency.transfer(listing.seller, value), "Transfer failed");
+ // revoke the accepted offer without calling currency, or only allow a whitelisted currency
Root cause#
The currency is caller-chosen and the finalization path treats its return value as a hard requirement. There is no way for the seller or arbitrator to clear an accepted offer without that call.
Preconditions#
- A listing exists.
- The buyer passes a contract whose
transferFromreturns true and whosetransferreverts. - The seller accepts the offer.
Attack walkthrough#
- Bob calls
makeOfferwith the malicious token for 1000 units.transferFromreturns true, so the offer is stored. - Alice accepts. Status becomes accepted.
finalizecallspaySeller. The refundtransferreverts.- Status is still accepted. The seller's balance of the token is 0.
Diagrams#
Impact#
Alice cannot complete the sale and cannot revoke it without another call into the same token. The accepted offer is stuck. An honest currency in the control finalizes and pays the seller 1000 units.
Remediation#
Let the seller or the arbitrator revoke an accepted offer without calling the currency, and restrict makeOffer to a whitelist of token addresses.
How to reproduce#
cd 17097-remote-code-execution-through-arbitrary-erc20-implementation_exp
forge test -vv
test_exploit_malicious_currency_bricks_finalize asserts finalize fails, status stays 2, and the seller balance is 0. test_control_honest_token_finalizes asserts an honest token reaches status 3 and pays the seller. Captured output is output.txt.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/17097-remote-code-execution-through-arbitrary-erc20-implementation.md
- Trail of Bits report: https://github.com/trailofbits/publications/blob/master/reviews/origin.pdf
- Blamed functions: marketplace
makeOfferandpaySellerin the Origin contracts reviewed November 2018
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 17097-remote-code-execution-through-arbitrary-erc20-implementation_exp (evm-hack-registry mirror).
- AuditVault finding: 17097-remote-code-execution-through-arbitrary-erc20-implementation.
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.