Coinbase Bug Bounty: Selling Crypto You Never Owned
The Coinbase Retail Advanced Trading API failed to check that the source account for an order held the same asset as the order book being traded. An attacker could place sell orders for assets they did not own, potentially manipulating real markets.
medium.com
Published on medium.com
Bug Bounty
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Coinbase's Retail Advanced Trading API is the order-entry surface behind a live order book. An order request carries three client-supplied choices: the product (the order book being traded, such as BTC-USD), the account the funds come from, and the account the proceeds go to. In normal use the web UI keeps those three values consistent with each other, so a sell order for a given product always names a source account holding that product's base asset.
The flaw described here is a business logic error in which the backend never checked that relationship. It was found by a pseudonymous researcher credited by Coinbase as Tree_of_alpha, fixed on 11 February 2022, and paid $250,000, which Coinbase confirmed as its largest bug bounty award ever. The write-up is an analytical case study of the public disclosure rather than the researcher's own account, and it deliberately omits reproduction details.

Setup
The report gives few operational details. The target was the Retail Advanced Trading API, which at the time was a limited-beta platform. The researcher's first move was a public tweet asking for a security contact, which suggests the work started without a private channel. No accounts, roles, tools or versions are described beyond the fact that a user could hold a cheap token and zero bitcoin.
Finding it
The validation service asked only one question of an incoming order: does the source account hold enough for this order? It never asked the second question: is the source account denominated in the asset that this order book trades?
That gap matters because the balance check reads a number from whichever account the client names. A user holding a cheap token and zero bitcoin could place a bitcoin sell order, name the token wallet as the source account, and the balance check would read the wrong number and pass. An attacker could push such an order into a real market for an asset they did not own.
Exploitation
The report describes the mechanism at a high level and intentionally leaves out the reproduction details, so there are no captured requests or responses to reproduce here. The sequence it does describe is:
- The client submits an order naming a product, a source account and a target account. The UI would normally keep these consistent; the API accepted them as independent inputs.
- The source account is chosen as a wallet holding a cheap token rather than the product's base asset.
- The validation service checks the source account balance against the order size. Because it reads the balance of the wrong asset, the check passes.
- The sell order reaches the live order book for an asset the user does not hold.
Timeline
- The researcher posts a public tweet asking for a security contact.
- Within about 90 minutes Coinbase had reproduced the issue and set the platform to cancel-only mode.
- A patch shipped by 4:01 PM PST on 11 February 2022.
- Coinbase paid $250,000, its largest bounty to date.
Root cause
The mistake is a missing cross-field validation. Each identifier in the order is valid on its own: the product exists, the source account exists, the target account exists, and the source account has a balance. What was never validated is the relationship between them, specifically that the source account's asset matches the base asset of the product for a sell (and the quote asset for a buy), and that the target account matches the other side.
The balance check confirmed sufficiency, not correctness of the asset. UI consistency kept the three values aligned for honest clients but is not a server-side control. Coinbase cites additional limits that reduced the real-world risk: the platform was in limited beta, price-protection circuit breakers were in place, and trade surveillance was running. Coinbase states the flaw was never maliciously exploited.
Impact
An attacker could push sell orders for assets they did not own into a real market. The report does not quantify the potential loss and notes that Coinbase's circuit breakers, trade surveillance and the limited-beta status constrained exposure. Severity rating was not reported; the bounty was $250,000.
Fix
Coinbase set the platform to cancel-only mode within about 90 minutes and patched the issue the same afternoon. The report does not describe the patch itself. Its own analysis of how this class of bug should be fixed lists three measures:
- Validate relationships, not just fields. Each ID can be valid on its own and still be wrong together.
- Reserve, don't read. An atomic hold on the exact asset being spent beats a balance read followed by a trade.
- Keep a kill switch. Cancel-only mode turned a market risk into hours of downtime.
The report includes this illustrative validation routine:
def validate_order(session, order): product = PRODUCTS.get(order.product_id) src = accounts.get(order.source_account_id) dst = accounts.get(order.target_account_id) if product is None or src is None or dst is None: return reject("invalid_order") if src.owner != session.user_id or dst.owner != session.user_id: return reject("invalid_order") if order.side == "sell": spend, receive = product.base, product.quote else: spend, receive = product.quote, product.base if src.asset != spend or dst.asset != receive: return reject("account_product_mismatch") if not ledger.reserve(src.id, spend, order.max_spend()): return reject("insufficient_funds") return accept(order)
The key line is the asset comparison: it rejects the order when the source account's asset does not match the asset being spent for that side, and when the target account's asset does not match the asset being received. The reserve call then holds the exact asset atomically rather than reading a balance and trading afterwards.
Variants to test
These are generalisations of the pattern, not claims about other Coinbase endpoints.
- Cross-asset source account. On any trading or exchange API, submit an order whose source account holds a different asset from the product's base. A positive result is an accepted order or a balance check that passes against the wrong wallet.
- Mismatched target account. Send proceeds to an account denominated in a different asset from the product's quote. A positive result is acceptance, or a settlement that credits the wrong asset.
- Buy-side mirror. Repeat the test on the buy side, where the spend asset is the quote currency. A positive result is a buy order funded from a base-asset wallet.
- Ownership swap. Name a source or target account belonging to another user. A positive result is acceptance rather than an authorisation error.
- UI versus API divergence. Capture a legitimate order from the UI, then change only the account or product fields and replay. A positive result is the backend accepting values the UI would never produce.
- Reserve versus read. Place two orders in quick succession against the same balance to see whether the check is an atomic hold or a read followed by a trade. A positive result is both orders accepted against a single balance.
What happened, in plain words
Coinbase is a large cryptocurrency exchange: a website and app where people buy, sell and hold digital currencies such as bitcoin. In February 2022 a researcher who goes by the name Tree of Alpha found a mistake in one of Coinbase's trading systems. The mistake could let a person place a sell order for a cryptocurrency they did not own, and push it into a real, live market where other people were trading.
Coinbase fixed it the same afternoon and paid the researcher $250,000. Coinbase confirmed that this was the largest bug bounty it had ever paid. A bug bounty is a programme where a company offers money to people who find and report security problems in its systems, instead of punishing them.
The important part for a beginner is that this was not a clever technical trick with strange code or hidden files. It was one missing check. The system asked "does this account have enough money?" but never asked "is this account holding the right kind of money?". That is the whole bug.

AI-generated illustration
A note on what follows: this is an analytical case study of a public disclosure, written with AI help from public sources and then reviewed and edited. It is not the researcher's own account, and it deliberately leaves out the details needed to reproduce the attack. Everything here is for learning how to defend systems, not for attacking them.
The system involved, explained from zero
Before the bug makes sense, you need three ideas: an API, an order book, and an account.
An API (Application Programming Interface) is the part of a website that a program talks to, rather than a person. When you click "Buy" on a website, your browser sends a message to the company's servers. An API is the set of rules for those messages: what you can ask for, in what format, and what comes back. Think of a restaurant: the menu and the waiter are the API. You do not walk into the kitchen yourself; you tell the waiter what you want in a known format, and food comes back. The kitchen is the backend, the part you never see.
An order book is a live list of everyone who wants to buy a thing and everyone who wants to sell it, with the prices they are willing to accept. When you place an order, it joins that list and can be matched against someone on the other side. "BTC-USD" is an example of an order book: it is the market for trading bitcoin against US dollars. In that pair, bitcoin is called the base asset (the thing being bought or sold) and the dollar is the quote asset (the money used to price it).
An account here is a wallet inside Coinbase holding one particular asset. You might have a wallet holding bitcoin, another holding a cheap token, and so on. A cheap token is just another cryptocurrency with a low price.
Coinbase's Retail Advanced Trading API was the order-entry surface behind a live order book. In plain words: it was the part of the system that accepted trade orders from customers and passed them into the real market. At the time it was a limited-beta platform, meaning it was released to a small group of users while still being tested.
When a customer places an order, the request carries three choices made by the customer's software:
- The product: which order book is being traded, such as BTC-USD.
- The source account: the wallet the funds come from.
- The target account: the wallet the proceeds go to.
In normal use, the web page you see in your browser keeps those three values consistent with each other. If you sell bitcoin, the page names a wallet that holds bitcoin as the source. The problem was that the backend, the kitchen behind the waiter, never checked that relationship itself. It trusted that the three values made sense together.
The flaw, in one sentence
The flaw is a business logic error: a mistake not in the code's syntax or memory handling, but in the rules the code enforces. The backend never checked that the source account actually held the asset that the chosen order book trades.
Security people sometimes group bugs into categories. This one maps to CWE-20 (Improper Input Validation) and CWE-840 (Business Logic Errors). Those labels are an analytical mapping added by the write-up, not something taken from Coinbase's own report. There is no CVE: a CVE is a public catalogue number for a specific flaw in specific software, and this was a hosted service that Coinbase could simply fix on its own servers.
The severity rating was not reported. The bounty was $250,000, confirmed by Coinbase as its largest ever.
How the flaw worked, at a high level
An order request carried three client choices: the product, the source account, and the target account. The web page kept them consistent. The backend never checked.
The validation service, the part of the system that decides whether an order is allowed, asked one question: does the source account hold enough for this order? It never asked the second question: is the source account in the asset this order book trades?
That gap matters because the balance check reads a number from whichever account the customer names. A user holding a cheap token and zero bitcoin could place a bitcoin sell order, name the token wallet as the source, and the balance check would read the wrong number and pass. The order would then enter a real market for an asset the user did not own.
An everyday comparison: imagine a shop that checks you have enough money in your wallet before letting you buy a television, but never checks that the wallet is yours or that the notes inside are the right currency. You could hand over a wallet full of foreign coins, the shop counts them, sees a big enough number, and hands you the television.
Finding it
The report gives few operational details. The target was the Retail Advanced Trading API, then a limited-beta platform. The researcher's first move was a public tweet asking for a security contact, which suggests the work started without a private channel to report through. No accounts, roles, tools or versions are described beyond the fact that a user could hold a cheap token and zero bitcoin.
The validation service asked only one question of an incoming order: does the source account hold enough for this order? It never asked the second: is the source account denominated in the asset that this order book trades?
Why does that matter? Because the balance check reads a number from whichever account the customer names. If the customer names a wallet full of a cheap token, the check counts that token's balance. It does not notice that the order is for bitcoin. The number is large enough, so the check passes.
Exploitation
The report describes the mechanism at a high level and intentionally leaves out the reproduction details, so there are no captured requests or responses to show here. The sequence it does describe is:
- The client submits an order naming a product, a source account and a target account. The web page would normally keep these consistent; the API accepted them as independent inputs.
- The source account is chosen as a wallet holding a cheap token rather than the product's base asset.
- The validation service checks the source account balance against the order size. Because it reads the balance of the wrong asset, the check passes.
- The sell order reaches the live order book for an asset the user does not hold.
Step 1 is the normal part: every order names these three things. Step 2 is the trick: the customer picks a wallet that holds something other than what they are selling. Step 3 is where the missing check bites: the system counts the wrong balance and is satisfied. Step 4 is the consequence: a sell order for bitcoin, backed by a wallet of cheap tokens, could reach the real market.
Timeline
- The researcher posts a public tweet asking for a security contact.
- Within about 90 minutes Coinbase had reproduced the issue and set the platform to cancel-only mode.
- A patch shipped by 4:01 PM PST on 11 February 2022.
- Coinbase paid $250,000, its largest bounty to date.
"Reproduced" means Coinbase's own engineers confirmed the problem on their side. "Cancel-only mode" means the platform stopped accepting new orders and only allowed existing ones to be cancelled. "A patch shipped" means the fix was deployed to the live service. The speed here is worth noticing: from a public tweet to a fix in a single afternoon.
Root cause
The mistake is a missing cross-field validation. A field is one piece of information in a request, such as the product or the account. Cross-field validation means checking that several fields make sense together, not just one at a time.
Each identifier in the order is valid on its own: the product exists, the source account exists, the target account exists, and the source account has a balance. What was never validated is the relationship between them. Specifically, for a sell, the source account's asset must match the base asset of the product, and the target account must match the other side. For a buy, the spend asset is the quote currency instead.
The balance check confirmed sufficiency, not correctness of the asset. Consistency in the web page kept the three values aligned for honest users, but a web page is not a server-side control: anyone can send messages to an API directly, without using the page at all.
Coinbase cites additional limits that reduced the real-world risk: the platform was in limited beta, price-protection circuit breakers were in place, and trade surveillance was running. A circuit breaker is an automatic pause in trading when prices move too far too fast, like a fuse in a plug. Trade surveillance means monitoring trades for suspicious patterns. Coinbase states the flaw was never maliciously exploited.
Impact
An attacker could push sell orders for assets they did not own into a real market. The report does not quantify the potential loss, and notes that Coinbase's circuit breakers, trade surveillance and the limited-beta status constrained exposure. The severity rating was not reported; the bounty was $250,000.
Fix
Coinbase set the platform to cancel-only mode within about 90 minutes and patched the issue the same afternoon. The report does not describe the patch itself. Its own analysis of how this class of bug should be fixed lists three measures:
- Validate relationships, not just fields. Each ID can be valid on its own and still be wrong together.
- Reserve, don't read. An atomic hold on the exact asset being spent beats a balance read followed by a trade. "Atomic" means it happens as one indivisible step: either the money is set aside or it is not, with no moment in between where two orders could both see the same balance.
- Keep a kill switch. Cancel-only mode turned a market risk into hours of downtime. A kill switch is a way to stop a system quickly when something goes wrong.
The report includes this illustrative validation routine:
def validate_order(session, order): product = PRODUCTS.get(order.product_id) src = accounts.get(order.source_account_id) dst = accounts.get(order.target_account_id) if product is None or src is None or dst is None: return reject("invalid_order") if src.owner != session.user_id or dst.owner != session.user_id: return reject("invalid_order") if order.side == "sell": spend, receive = product.base, product.quote else: spend, receive = product.quote, product.base if src.asset != spend or dst.asset != receive: return reject("account_product_mismatch") if not ledger.reserve(src.id, spend, order.max_spend()): return reject("insufficient_funds") return accept(order)
Line by line, in plain words:
def validate_order(session, order):defines a function calledvalidate_order. It takes two things:session, which represents the logged-in user making the request, andorder, the order they want to place.product = PRODUCTS.get(order.product_id)looks up the order book the customer named, such as BTC-USD, in a table of known products.src = accounts.get(order.source_account_id)looks up the source wallet, the one the funds come from.dst = accounts.get(order.target_account_id)looks up the target wallet, the one the proceeds go to.if product is None or src is None or dst is None:checks that all three actually exist. If any lookup came back empty, the request named something that is not real.return reject("invalid_order")refuses the order in that case, with the reason "invalid order".if src.owner != session.user_id or dst.owner != session.user_id:checks that both wallets belong to the person making the request. This is the ownership check.return reject("invalid_order")refuses the order if either wallet belongs to someone else.if order.side == "sell":asks whether this is a sell order.spend, receive = product.base, product.quoteif it is a sell, the customer is spending the base asset (bitcoin in BTC-USD) and receiving the quote asset (dollars).else:covers the buy case.spend, receive = product.quote, product.basefor a buy, the customer spends the quote asset and receives the base asset.if src.asset != spend or dst.asset != receive:is the key line. It checks that the source wallet holds exactly the asset being spent, and the target wallet holds exactly the asset being received.return reject("account_product_mismatch")refuses the order when the wallets and the order book do not match. This is the check that was missing in the real system.if not ledger.reserve(src.id, spend, order.max_spend()):asks the ledger, the record of who owns what, to set aside the exact asset being spent, as one atomic step. If it cannot, the next line runs.return reject("insufficient_funds")refuses the order because the money is not there.return accept(order)lets the order through once every check has passed.
The key line is the asset comparison: it rejects the order when the source account's asset does not match the asset being spent for that side, and when the target account's asset does not match the asset being received. The reserve call then holds the exact asset atomically rather than reading a balance and trading afterwards.
Variants to test
These are generalisations of the pattern, not claims about other Coinbase endpoints. They are useful because the same shape of mistake appears in many trading and payment systems.
- Cross-asset source account. On any trading or exchange API, submit an order whose source account holds a different asset from the product's base. A positive result is an accepted order, or a balance check that passes against the wrong wallet.
- Mismatched target account. Send proceeds to an account denominated in a different asset from the product's quote. A positive result is acceptance, or a settlement that credits the wrong asset.
- Buy-side mirror. Repeat the test on the buy side, where the spend asset is the quote currency. A positive result is a buy order funded from a base-asset wallet.
- Ownership swap. Name a source or target account belonging to another user. A positive result is acceptance rather than an authorisation error.
- UI versus API divergence. Capture a legitimate order from the web page, then change only the account or product fields and replay it. A positive result is the backend accepting values the page would never produce.
- Reserve versus read. Place two orders in quick succession against the same balance to see whether the check is an atomic hold or a read followed by a trade. A positive result is both orders accepted against a single balance.
Key takeaways
- A balance check that reads the wrong account is not a balance check.
- Consistency in the web page is not a security control. The server must check for itself.
- Publish an easy-to-find security contact. The researcher's first move here was a public tweet asking where to report.
Credit and sources
The bug was found by Tree of Alpha, a pseudonymous researcher credited by Coinbase as Tree_of_alpha. The primary source is Coinbase's blog post "Retrospective: Recent Coinbase Bug Bounty Award" from 18 February 2022, which covers the timeline, root cause and bounty. The researcher credit also appears in Coinbase's 10-year bug bounty post. The facts come from those sources; the analysis and the code above are the write-up author's own.
Glossary
- API: the part of a service that programs talk to, with fixed rules for what can be asked and what comes back.
- Backend: the servers and code behind a website that users never see directly.
- Base asset: in a trading pair, the thing being bought or sold, such as bitcoin in BTC-USD.
- Quote asset: in a trading pair, the money used to price the base asset, such as US dollars in BTC-USD.
- Order book: a live list of buy and sell orders for a market, with the prices people will accept.
- Order: a request to buy or sell an asset, naming the product, the source account and the target account.
- Source account: the wallet the funds for an order come from.
- Target account: the wallet the proceeds of an order go to.
- Wallet / account: a record inside the exchange holding one particular asset for a user.
- Business logic error: a flaw in the rules a system enforces, rather than in its syntax or memory handling.
- Cross-field validation: checking that several pieces of a request make sense together, not just each one alone.
- Input validation: checking that data arriving from a client is acceptable before acting on it.
- CWE: a public catalogue of categories of software weakness, such as CWE-20 (Improper Input Validation) and CWE-840 (Business Logic Errors).
- CVE: a public catalogue number for a specific flaw in specific software; not applicable to a hosted service fixed on the provider's own servers.
- Bug bounty: a programme paying people who find and report security problems.
- Severity rating: a score describing how serious a flaw is; not reported here.
- Limited beta: a release to a small group of users while still being tested.
- Circuit breaker: an automatic pause in trading when prices move too far too fast.
- Trade surveillance: monitoring trades for suspicious patterns.
- Cancel-only mode: a state where the platform accepts no new orders and only allows existing ones to be cancelled.
- Kill switch: a way to stop a system quickly when something goes wrong.
- Patch: a fix deployed to a live system.
- Atomic: happening as one indivisible step, with no moment in between where another action could interfere.
- Ledger: the record of who owns what.
- Reserve: to set aside funds for an order as one atomic step, rather than reading a balance and trading afterwards.
- Pseudonymous: using a name other than one's real identity.