Reproduced Exploit
Debita: TaxTokensReceipt cannot be sold into a buy order
sellNFT transfers the wanted receipt into the buy order. TaxTokensReceipt.transferFrom reverts unless from or to is a borrow order, a lend order, or a loan. A buy order is none of those. Alice's sale reverts, she is paid 0, and the 1000 USDC Bob escrowed never moves.
Loss
Alice cannot sell receipt 1. Bob's 1000 USDC stays in the buy order
Chain
Ethereum
Category
access-control
Date
Nov 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: 44227-h-4-no-one-can-sell-taxtokensreceipts-nft-receipt-to-the-buy. Standalone Foundry PoC and full write-up: 44227-h-4-no-one-can-sell-taxtokensreceipts-nft-receipt-to-the-buy_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/access-control/broken-logic·vuln/logic/wrong-condition
Key info#
| Field | Value |
|---|---|
| Loss | Alice cannot sell receipt 1. Bob's 1000 USDC stays in the buy order |
| Vulnerable contract | TaxTokensReceipt.transferFrom |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2024-11 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | allowlist omits buy orders |
TL;DR#
sellNFT transfers the wanted receipt into the buy order. TaxTokensReceipt.transferFrom reverts unless from or to is a borrow order, a lend order, or a loan. A buy order is none of those. Alice's sale reverts, she is paid 0, and the 1000 USDC Bob escrowed never moves.
The vulnerable code#
bool isReceiverAddressDebita = registry.isBorrowOrderLegit(to)
|| registry.isLendOrderLegit(to)
|| registry.isSenderALoan(to);
bool isSenderAddressDebita = registry.isBorrowOrderLegit(from)
|| registry.isLendOrderLegit(from)
|| registry.isSenderALoan(from);
require(
isReceiverAddressDebita || isSenderAddressDebita,
"TaxTokensReceipts: Debita not involved"
); // @> VULN
The recommended fix also accepts isBuyOrderLegit on both sides.
Root cause#
The transfer override was written for the three contracts that already move receipts. Buy orders were added later and were not added to the same allowlist. sellNFT has no other way to take the NFT.
Preconditions#
- Alice owns a
TaxTokensReceipt. - A buy order for that receipt is active and holds 1000 USDC.
- Alice is not herself a loan, borrow order, or lend order.
Attack walkthrough#
- Mint receipt 1 to Alice and fund the buy order with 1000 USDC.
- Mark unrelated borrow, lend, and loan addresses so the allowlist is non-empty.
- Alice calls
sellNFT(1). transferFromreverts withTaxTokensReceipts: Debita not involved.- The receipt owner is still Alice. Her USDC balance is 0. The order still holds 1000.
Diagrams#
Impact#
The limit-order path for this receipt cannot be used. Buyers who escrowed USDC against a TaxTokensReceipt cannot be filled. A control that marks the seller as a loan pays Alice the 1000 and moves the receipt, which is the transfer the buy-order allowlist was supposed to permit.
Remediation#
Treat a legitimate buy order as a Debita counterparty in both the sender and receiver checks, matching the patch in the Sherlock issue.
How to reproduce#
cd 44227-h-4-no-one-can-sell-taxtokensreceipts-nft-receipt-to-the-buy_exp
forge test -vv
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/44227-h-4-no-one-can-sell-taxtokensreceipts-nft-receipt-to-the-buy.md
- Sherlock issue 560: https://github.com/sherlock-audit/2024-10-debita-judging/issues/560
- Receipt: https://github.com/sherlock-audit/2024-11-debita-finance-v3/blob/main/Debita-V3-Contracts/contracts/Non-Fungible-Receipts/TaxTokensReceipts/TaxTokensReceipt.sol#L98
- Buy order: https://github.com/sherlock-audit/2024-11-debita-finance-v3/blob/main/Debita-V3-Contracts/contracts/buyOrders/buyOrder.sol#L99
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 44227-h-4-no-one-can-sell-taxtokensreceipts-nft-receipt-to-the-buy_exp (evm-hack-registry mirror).
- AuditVault finding: 44227-h-4-no-one-can-sell-taxtokensreceipts-nft-receipt-to-the-buy.
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.