From Programming Bugs to Multimillion-Dollar Scams: An Analysis of Trapdoor Tokens on Uniswap
Abstract: We investigate in this work a recently emerged type of scam ERC-20 token called Trapdoor, which has cost investors billions of US dollars on Uniswap, the largest decentralised exchange on Ethereum, from 2020 to 2023. In essence, Trapdoor tokens allow users to buy but preventing them from selling by embedding logical bugs and/or owner-only features in their smart contracts. By manually inspecting a number of Trapdoor samples, we established the first systematic classification of Trapdoor tokens and a comprehensive list of techniques that scammers used to embed and conceal malicious codes, accompanied by a detailed analysis of representative scam contracts. In particular, we developed TrapdoorAnalyser, a fine-grained detection tool that generates and crosschecks the error-log of a buy-and-sell test and the list of embedded Trapdoor indicators from a contract-semantic check to reliably identify a Trapdoor token. TrapdoorAnalyser not only outperforms the state-of-the-art commercial tool GoPlus in accuracy, but also provides traces of malicious code with a full explanation, which most of the existing tools lack. Using TrapdoorAnalyser, we constructed the very first dataset of about 30,000 Trapdoor and non-Trapdoor tokens on UniswapV2, which allows us to train several machine learning algorithms that can detect with very high accuracy even Trapdoor tokens with no available Solidity source codes.
- Labeled Trapdoor dataset (2023), https://github.com/bsdp2023/trapdoor_data
- Binance: Binance Exchange (Jul 2017), https://www.binance.com/en
- Blocktelegraph: The Rise of decentralized exchanges: Pros and cons unveiled (2023), https://blocktelegraph.io/decentralized-exchanges-pros-and-cons/
- Brownie: Python-based development and testing framework for Ethereum smart contracts (2019), https://github.com/eth-brownie/brownie
- Chainanalysis: The 2022 Crypto Crime Report. http://demo.chainalysis.com/2022- crypto-crime-report/ (2022), accessed: 2022-04-24
- Coinbase: Coinbase Exchange (May 2012), https://www.coinbase.com/au
- Coindesk: Centralized exchange (CEX) vs. decentralized exchange (DEX): What’s the difference? (2022)
- Coingecko: Decentralized exchanges (2023), https://www.coingecko.com/en/exchanges/decentralized
- Coingecko: Uniswapv2 Ethereum (2023), https://www.coingecko.com/en/exchanges/uniswap-v2-ethereum
- Coinmarketcap: Total Cryptocurrency Market Cap (2021), https://coinmarketcap.com/charts/
- Cointelegraph: Centralized vs. decentralized crypto exchanges, https://cointelegraph.com/learn/centralized-vs-decentralized-crypto-exchanges
- Defillama: UniswapV2 Folks (2023), https://defillama.com/forks
- Ethereum: ERC-20 Token Standard (2015), https://ethereum.org/en/developers/docs/standards/tokens/erc-20/
- Ethereum: Solidity (2015), https://docs.soliditylang.org/en/v0.8.16/
- KuCoin: Kucoin Exchange (Sep 2017), https://www.kucoin.com
- Pancakeswap: Pancakeswap (2023), https://pancakeswap.finance/
- Sushiswap: Sushiswap (2023), https://www.sushi.com/
- Uniswap: Uniswap (2023), https://uniswap.org/
- Uniswap: UniswapV2 source code (2023), https://github.com/Uniswap/v2-core/
- Web3Python: Python library for interacting with Ethereum (2016), https://github.com/ethereum/web3.py
Paper Prompts
Sign up for free to create and run prompts on this paper using GPT-5.
Top Community Prompts
Collections
Sign up for free to add this paper to one or more collections.