When Crypto Fails: Demystifying Cryptographic Defects in Ethereum Smart Contracts
Ethereum has officially provided a set of system-level cryptographic APIs to enhance smart contracts with cryptographic capabilities. These APIs have been utilized in over 13.8% of Ethereum transactions, motivating developers to implement various on-chain cryptographic tasks, such as digital signatures. However, since developers may not always be cryptographic experts, their ad-hoc and potentially defective implementations could compromise the theoretical guarantees of cryptography, leading to real-world security issues. To mitigate this threat, we conducted a comprehensive study aimed at demystifying and detecting cryptographic defects in smart contracts. Through the analysis of 3,762 real-world security reports, we defined 12 types of cryptographic defects in smart contracts with detailed descriptions and practical detection patterns. Based on this categorization, we proposed <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">CryptoScan</small>, the first static analyzer to automate the pre-deployment detection of cryptographic defects in smart contracts. <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">CryptoScan</small> utilizes cross-contract and inter-procedure static analysis to identify crypto-related execution paths and employs taint analysis to extract fine-grained crypto-specific semantics for defect detection. Furthermore, we collected a large-scale dataset containing 79,598 real-world crypto-related smart contracts and evaluated <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">CryptoScan</small>'s effectiveness on it. The results demonstrated that <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">CryptoScan</small> achieves an overall precision of 96.1% and a recall of 93.3%. Notably, <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">CryptoScan</small> revealed that 19,707 (24.8%) out of 79,598 smart contracts contain at least one cryptographic defect. Although not all defects directly cause financial losses, they indicate prevalent non-standard cryptographic implementations that should be addressed in real-world practices.
Authors
- Jiashuo Zhang (ORCID: https://orcid.org/0000-0002-8140-9208)
- Jiachi Chen (ORCID: https://orcid.org/0000-0002-0192-9992)
- Jianbo Gao (ORCID: https://orcid.org/0000-0002-6760-5552)
- Yanlin Wang (ORCID: https://orcid.org/0000-0001-7761-7269)
- Tao Zhang (ORCID: https://orcid.org/0000-0002-6272-4069)
- Ting Chen (ORCID: https://orcid.org/0000-0001-9165-8331)
- Zhong Chen (ORCID: https://orcid.org/0000-0002-5785-2912)
- Yiming Shen
Institutions
- Macau University of Science and Technology (MO)
- University of Electronic Science and Technology of China (CN)
- Sun Yat-sen University (CN)
- Peking University (CN)
- Beijing Jiaotong University (CN)
Publication Details
- Journal
- IEEE Transactions on Software Engineering
- Published
- 2025-03-18
- DOI
- https://doi.org/10.1109/tse.2025.3551776
- Primary Topic
- Blockchain Technology Applications and Security
- Type
- article
- Field-Weighted Citation Impact
- 0.00