SPCBIG-EC: A Robust Serial Hybrid Model for Smart Contract Vulnerability Detection
Abstract
:1. Introduction
- We propose the SPCBIG-EC model, which shows excellent performance advantages in multi-task vulnerability detection. For multi-task vulnerability detection in this study, we performed a vulnerability detection task for six typical existing smart contract vulnerabilities. Details of the specific types of vulnerabilities are given below. Meanwhile, we propose a CNN structure, Serial-Parallel CNN (SPCNN), suitable for this serial hybrid model. The SPCNN structure is used for feature extraction to capture the local and global features of the code sequences. The multi-scale series-parallel convolution structure parallelizes the output of low-level and high-level features. It makes the feature combinations of the extracted word vectors more informative.
- The SPCBIG-EC model uses an Ensemble Classifier. The Ensemble Classifier combines multiple base classifiers to form a powerful classifier. It improves the robustness of the model by combining the decisions of multiple classifier experts.
- We collected smart contracts from the Ethereum platform and constructed the CESC dataset and the UCESC dataset. They are used for multiple types of vulnerability detection and hybrid vulnerability detection tasks, separately. The CESC dataset consists of snippets of smart contract code after data preprocessing, and UCESC consists of original smart contract code. In our experiments, we focused on six smart contract vulnerabilities, i.e., reentrancy, timestamp dependency, infinite loop, callstack depth attack, integer overflow, and integer underflow.
- We compared SPCBIG-EC with 11 advanced vulnerability detection methods. Experimental results show that our model has strong advantages in reentrancy, timestamp dependency, and infinite loop vulnerability detection, with F1-scores of 96.74%, 91.62%, and 95.00%. For the hybrid vulnerability dataset, our model also achieved an accuracy and F1-score of over 85%, outperforming most existing detection tools.
2. Related Work
2.1. Smart Contract Security
2.2. Existing Methods for Detecting Smart Contract Vulnerabilities
3. Design of the Model
- (1)
- The smart contracts that we process are sequential information. Both CNNs and RNNs can be used for sequence modeling, but they perform differently. RNNs emphasize the order in the time dimension, and the input order of the sequence affects the output. CNNs obtain the overall information by aggregating local information, and they can extract hierarchical information from the input.
- (2)
- RNNs read and interpret the input information of a code vector in a single pass, so the deep neural network must wait to process the next code vector until the current information has been processed. This means that RNNs cannot take advantage of massively parallel processing (MPP) as CNNs can [45].
- (3)
- CNNs, while achieving good results in feature extraction, do not even consider the contextual relationships of the sequence. The occurrence of each word in the code is considered independent of other words. However, a smart contract code is a long sequence of words, and the occurrences of individual words are contextually interrelated.
- (4)
- A single neural network is limited in its ability to process information. The combination of CNN and RNN enables the temporal structure and location information of sequence data to be fully preserved. It facilitates the extraction of multivariate combinatorial features.
3.1. SPCBIG-EC Model
3.2. Dataset Processing
- (1)
- Converting smart contract source code into code fragments.
- (2)
- Labeling smart contracts.
3.3. Code Embedding Layer
- (1)
- Preprocessing data, such as removing blank lines, comments, and special characters, while retaining brackets, operators, etc. The source code is divided into small, logically executable pieces of code by extracting the relevant code pieces around a key point and combining them.
- (2)
- Splitting code segments with lexical analysis. Keywords, operators, and delimiters in the code are converted to their corresponding tokens, preserving the semantic order to convert the code segment into a list of tokens.
- (3)
- Representing the list of tokens as a vector. There are many traditional word vector representations, such as TF-IDF [53,54], One-Hot [55,56,57], etc. They cannot represent word-to-word information. In this paper, Word Embedding [58] is used to model word vectors by converting contract fragment tokens into vectors via Word2Vec. The network maps tokens to integers and then converts them into fixed dimensional vectors.
3.4. Feature Extraction Layer
3.4.1. Serial-Parallel Convolutional Layer
- (1)
- Input layer: the input data are smart contract data that have been lexically analyzed and vectorized.
- (2)
- Convolution layer 1: Two sizes of convolution kernels (i.e., × , × ) are used to convolve the input data separately. Smart contracts have two scales: intra-contractual and inter-contractual. The × convolution kernel convolves only on the intra-contract scale so that the internal features of each smart contract can be extracted without destroying inter-contractual information. The × convolution kernel performs simultaneous convolution within and between contracts, allowing correlation features to be extracted between individual contracts. The number of convolution kernels in the layer is , the convolution step size is in all directions, the activation function is a linear correction unit (ReLu), and the padding parameter is SAME. Concatenate layer 1 splices the features obtained from the two convolutional channels in the corresponding rows, keeping the output sequence of the layer.
- (3)
- Convolutional layer 2: Two sizes of convolution kernels (i.e., × and × ) are each used to convolve the output of splicing layer 1. The number of convolution kernels in the layer is , the convolution step is in all directions, the activation function is also ReLu, and the padding parameter is SAME. Concatenate layer 2 splices the features obtained from the two convolutional channels according to their correspondence, while the output sequence retained by splicing layer 1 is spliced with the output sequence of splicing layer 2.
- (4)
- Two fully connected layers: The number of neurons in fully connected layer 1 is 300. Since the model in this paper performs a binary classification task for smart contract vulnerability detection, there are 2 neurons in fully connected layer 2. In addition, a dropout operation is added between the two fully connected layers to prevent the overfitting of the network.
- (5)
- Output layer: The convolved feature matrix is output and used as input to the BiGRU neural network.
3.4.2. Time Sequence Modeling Layer
3.5. Classification Optimization Layer
Algorithm 1 Integration Algorithm to Implement Ensemble Classifier |
Input:: Training data for classification. |
Initialization: : the weights of the training data. . |
Output: Ensemble Classifier |
1: for and < do |
2: Calculate by Equation (19) |
3: |
4: if then |
5: |
6: Base |
7: Calculate the weight of the Base by Equation (21) |
8: |
9: end for |
10: Calculate by Equation (24) |
11: Calculate by Equation (25) |
12: return |
4. Experiments and Results
- RQ1: Can our SPCBIG-EC model detect multiple kinds of smart contract vulnerabilities, and what is the performance of vulnerability detection?To answer this question, we conducted experiments using the SPCBIG-EC model for the CESC dataset that we constructed. The CESC dataset contains six typical vulnerabilities. We used CESC for multi-task vulnerability detection.
- RQ2: Did the serial combination of SPCNN and BiGRU in the feature extraction phase make our model more effective? By how much?To answer this question, two sets of experiments were carried out. (a) First, we compared the reentrancy, timestamp dependency, and infinite loop vulnerability detection performance of the SPCNN model, BiGRU model, and SPCBIG-EC model in the CESC dataset. (b) Then, we performed hybrid vulnerability testing for UCESC using our framework to test the performance evaluation results for all combined patterns.
- RQ3: Can our proposed SPCNN for the vulnerability feature extraction phase of the CNN module make our model more effective? By how much?To answer this question, we used the SCR Detection Framework to evaluate the performance of three models, CNN-BiGRU, SCNN-BiGRU, and SPCBIG-EC, for three typical vulnerabilities.
- RQ4: How effective is our model when compared with state-of-the-art methods?To answer this question, we compared SPCBIG-EC with state-of-the-art smart contract vulnerability detection methods. Firstly, a comparison was made with existing automated security auditing tools, namely, Oyenete [25], Mythril [26], Smartcheck [27], and Securify [28]. Secondly, we compared it with deep learning-based vulnerability detection methods, namely, DeeSCV [38], Eth2Vec [33], DR-GCN, TMP, GCE, AME [35], and AFS [36].
4.1. Dataset
4.2. Experimental Settings
4.3. Experimental Results
5. Analysis of Results and Outlook for Future Work
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Tawalbeh, L.; Muheidat, F.; Tawalbeh, M.; Quwaider, M. IoT Privacy and Security: Challenges and Solutions. Appl. Sci. 2020, 10, 4102. [Google Scholar] [CrossRef]
- Christidis, K.; Devetsikiotis, M. Blockchains and Smart Contracts for the Internet of Things. IEEE Access 2016, 4, 2292–2303. [Google Scholar] [CrossRef]
- Zhang, Y.; Wen, J. The IoT electric business model: Using blockchain technology for the internet of things. Peer Netw. Appl. 2017, 10, 983–994. [Google Scholar] [CrossRef]
- Ali, J.; Sofi, S.A. Ensuring Security and Transparency in Distributed Communication in IoT ecosystems using Blockchain Technology: Protocols, Applications and Challenges. IJCDS 2022, 11, 20. [Google Scholar] [CrossRef]
- Hassan, M.U.; Rehmani, M.H.; Chen, J. Privacy preservation in blockchain based IoT systems: Integration issues, prospects, challenges, and future research directions. Future Gener. Comput. Syst. 2019, 97, 512–529. [Google Scholar] [CrossRef]
- Sadawi, A.A.; Madani, B.; Saboor, S.; Ndiaye, M.; Abu-Lebdeh, G. A comprehensive hierarchical blockchain system for carbon emission trading utilizing blockchain of things and smart contract. Technol. Forecast. Soc. Chang. 2021, 173, 121124. [Google Scholar] [CrossRef]
- Wang, Q.; Wang, D.; Cheng, C.; He, D. Quantum2FA: Efficient Quantum-Resistant Two-Factor Authentication Scheme for Mobile Devices. IEEE Trans. Dependable Secur. Comput. 2022. [Google Scholar] [CrossRef]
- Jarecki, S.; Krawczyk, H.; Xu, J. OPAQUE: An Asymmetric PAKE Protocol Secure Against Pre-computation Attacks. In Advances in Cryptology—Eurocrypt 2018; Nielsen, J.B., Rijmen, V., Eds.; Springer: Cham, Switzerland, 2018; pp. 456–486. ISBN 978-3-319-78371-0. [Google Scholar]
- Zhao, G.; Jiang, Q.; Huang, X.; Ma, X.; Tian, Y.; Ma, J. Secure and Usable Handshake Based Pairing for Wrist-Worn Smart Devices on Different Users. Mob. Netw. Appl. 2021, 26, 2407–2422. [Google Scholar] [CrossRef]
- Krizhevsky, A.; Sutskever, I.; Hinton, G.E. ImageNet classification with deep convolutional neural networks. Commun. ACM 2017, 60, 84–90. [Google Scholar] [CrossRef]
- Shrivastava, K.; Kumar, S.; Jain, D.K. An effective approach for emotion detection in multimedia text data using sequence based convolutional neural network. Multimed. Tools Appl. 2019, 78, 29607–29639. [Google Scholar] [CrossRef]
- Shen, Z.; Zhang, Y.; Lu, J.; Xu, J.; Xiao, G. A novel time series forecasting model with deep learning. Neurocomputing 2020, 396, 302–313. [Google Scholar] [CrossRef]
- Xing, Y.; Lv, C.; Cao, D. Personalized Vehicle Trajectory Prediction Based on Joint Time-Series Modeling for Connected Vehicles. IEEE Trans. Veh. Technol. 2020, 69, 1341–1352. [Google Scholar] [CrossRef]
- Lehui, Z.; Ying, H. Overview of Integrated Equipment Fault Diagnosis Methods Based on Deep Learning. In Proceedings of the 2021 IEEE 5th Advanced Information Technology, Electronic and Automation Control Conference (IAEAC), Chongqing, China, 12–14 March 2021; pp. 599–608. [Google Scholar]
- Hua, Y.; Guo, J.; Zhao, H. Deep Belief Networks and deep learning. In Proceedings of the 2015 International Conference on Intelligent Computing and Internet of Things, Harbin, China, 17–18 January 2015; pp. 1–4. [Google Scholar] [CrossRef]
- Liu, Y.; Zhang, Q.; Lv, Z. Real-Time Intelligent Automatic Transportation Safety Based on Big Data Management. IEEE Trans. Intell. Transport. Syst. 2021. [Google Scholar] [CrossRef]
- Wang, Y.; Tang, L.; He, T. Attention-Based CNN-BLSTM Networks for Joint Intent Detection and Slot Filling. In Chinese Computational Linguistics and Natural Language Processing Based on Naturally Annotated Big Data; Sun, M., Liu, T., Wang, X., Liu, Z., Liu, Y., Eds.; Springer: Cham, Switzerland, 2018; pp. 250–261. ISBN 978-3-030-01715-6. [Google Scholar]
- Qian, P.; Liu, Z.; He, Q.; Zimmermann, R.; Wang, X. Towards Automated Reentrancy Detection for Smart Contracts Based on Sequential Models. IEEE Access 2020, 8, 19685–19695. [Google Scholar] [CrossRef]
- Liu, G.; Guo, J. Bidirectional LSTM with attention mechanism and convolutional layer for text classification. Neurocomputing 2019, 337, 325–338. [Google Scholar] [CrossRef]
- Amiet, N. Blockchain Vulnerabilities in Practice. Digit. Threat. 2021, 2, 1–7. [Google Scholar] [CrossRef]
- Destefanis, G.; Marchesi, M.; Ortu, M.; Tonelli, R.; Bracciali, A.; Hierons, R. Smart contracts vulnerabilities: A call for blockchain software engineering? In Proceedings of the 2018 International Workshop on Blockchain Oriented Software Engineering (IWBOSE), Campobasso, Italy, 20 March 2018; pp. 19–25. [Google Scholar]
- Sun, T.; Yu, W. A Formal Verification Framework for Security Issues of Blockchain Smart Contracts. Electronics 2020, 9, 255. [Google Scholar] [CrossRef] [Green Version]
- Mazorra, B.; Adan, V.; Daza, V. Do not Rug on me: Zero-Dimensional Scam Detection. arXiv 2022, arXiv:2201.07220. [Google Scholar]
- Wang, S.; Ouyang, L.; Yuan, Y.; Ni, X.; Han, X.; Wang, F.-Y. Blockchain-Enabled Smart Contracts: Architecture, Applications, and Future Trends. IEEE Trans. Syst. Man Cybern. Syst. 2019, 49, 2266–2277. [Google Scholar] [CrossRef]
- Luu, L.; Chu, D.-H.; Olickel, H.; Saxena, P.; Hobor, A. Making Smart Contracts Smarter. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, Vienna, Austria, 24–28 October 2016; pp. 254–269. [Google Scholar]
- Hegedűs, P. Towards Analyzing the Complexity Landscape of Solidity Based Ethereum Smart Contracts. Technologies 2019, 7, 6. [Google Scholar] [CrossRef] [Green Version]
- Tikhomirov, S.; Voskresenskaya, E.; Ivanitskiy, I.; Takhaviev, R.; Marchenko, E.; Alexandrov, Y. SmartCheck. In Proceedings of the 1st International Workshop on Emerging Trends in Software Engineering for Blockchain and ICSE ‘18: 40th International Conference on Software Engineering, Gothenburg, Sweden, 27 May 2018; pp. 9–16. [Google Scholar]
- Tsankov, P.; Dan, A.; Cohen, D.D.; Gervais, A.; Buenzli, F.; Vechev, M. Securify: Practical Security Analysis of Smart Contracts. 2018. Available online: http://arxiv.org/pdf/1806.01143v2 (accessed on 15 October 2018).
- Song, J.; He, H.; Lv, Z.; Su, C.; Xu, G.; Wang, W. An Efficient Vulnerability Detection Model for Ethereum Smart Contracts. In Network and System Security; Liu, J.K., Huang, X., Eds.; Springer: Cham, Switzerland, 2019; pp. 433–442. ISBN 978-3-030-36937-8. [Google Scholar]
- Wang, W.; Song, J.; Xu, G.; Li, Y.; Wang, H.; Su, C. ContractWard: Automated Vulnerability Detection Models for Ethereum Smart Contracts. IEEE Trans. Netw. Sci. Eng. 2021, 8, 1133–1144. [Google Scholar] [CrossRef] [Green Version]
- Menglin, F.U.; Lifa, W.U.; Zheng, H.O.N.G.; Wenbo, F.E.N.G. Research on vulnerability mining technique for smart contracts. J. Comput. Appl. 2019, 39, 1959. [Google Scholar]
- Yu, X.; Zhao, H.; Hou, B.; Ying, Z.; Wu, B. DeeSCVHunter: A Deep Learning-Based Framework for Smart Contract Vulnerability Detection. In Proceedings of the 2021 International Joint Conference on Neural Networks (IJCNN), Shenzhen, China, 18–22 August 2021; pp. 1–8. [Google Scholar]
- Ashizawa, N.; Yanai, N.; Cruz, J.P.; Okamura, S. Eth2Vec: Learning Contract-Wide Code Representations for Vulnerability Detection on Ethereum Smart Contracts. In Proceedings of the 3rd ACM International Symposium on Blockchain and Secure Critical Infrastructure and ASIA CCS’21: ACM Asia Conference on Computer and Communications Security, Hong Kong, China, 7 June 2021; pp. 47–59. [Google Scholar]
- Huang, J.; Zhou, K.; Xiong, A.; Li, D. Smart Contract Vulnerability Detection Model Based on Multi-Task Learning. Sensors 2022, 22, 1829. [Google Scholar] [CrossRef] [PubMed]
- Liu, Z.; Qian, P.; Wang, X.; Zhu, L.; He, Q.; Ji, S. Smart Contract Vulnerability Detection: From Pure Neural Network to Interpretable Graph Feature and Expert Pattern Fusion. arXiv 2021, arXiv:2106.09282. [Google Scholar]
- Wang, B.; Chu, H.; Zhang, P.; Dong, H. Smart Contract Vulnerability Detection Using Code Representation Fusion. In Proceedings of the 2021 28th Asia-Pacific Software Engineering Smart Contract Vulnerability Detection Using Code Representation Fusion, Taipei, Taiwan, 6–9 December 2021; pp. 564–565. [Google Scholar]
- Liao, J.W.; Tsai, T.T.; He, C.K.; Tien, C.W. Soliaudit: Smart contract vulnerability assessment based on machine learning and fuzz testing. In Proceedings of the 2019 Sixth International Conference on Internet of Things: Systems, Management and Security (IOTSMS), Granada, Spain, 22–25 October 2019. [Google Scholar]
- Mi, F.; Wang, Z.; Zhao, C.; Guo, J.; Ahmed, F.; Khan, L. VSCL: Automating Vulnerability Detection in Smart Contracts with Deep Learning. In Proceedings of the 2021 IEEE International Conference on Blockchain and Cryptocurrency (ICBC), Sydney, Australia, 3–6 May 2021; pp. 1–9. [Google Scholar]
- Zhang, L.; Wang, J.; Wang, W.; Jin, Z.; Zhao, C.; Cai, Z.; Chen, H. A Novel Smart Contract Vulnerability Detection Method Based on Information Graph and Ensemble Learning. Sensors 2022, 22, 3581. [Google Scholar] [CrossRef]
- Tetko, I.V.; Livingstone, D.J.; Luik, A.I. Neural network studies. 1. Comparison of overfitting and overtraining. J. Chem. Inf. Comput. Sci. 1995, 35, 826–833. [Google Scholar] [CrossRef]
- Liu, J.; Yang, Y.; Lv, S.; Wang, J.; Chen, H. Attention-based BiGRU-CNN for Chinese question classification. J. Ambient Intell. Humaniz. Comput. 2019. [Google Scholar] [CrossRef]
- Qiu, S.; Wang, D.; Xu, G.; Kumari, S. Practical and Provably Secure Three-Factor Authentication Protocol Based on Extended Chaotic-Maps for Mobile Lightweight Devices. IEEE Trans. Dependable Secur. Comput. 2020, 19, 1338–1351. [Google Scholar] [CrossRef]
- Jiang, Q.; Zhang, N.; Ni, J.; Ma, J.; Ma, X.; Choo, K.-K.R. Unified Biometric Privacy Preserving Three-Factor Authentication and Key Agreement for Cloud-Assisted Autonomous Vehicles. IEEE Trans. Veh. Technol. 2020, 69, 9390–9401. [Google Scholar] [CrossRef]
- Eberz, S.; Rasmussen, K.B.; Lenders, V.; Martinovic, I. Evaluating Behavioral Biometrics for Continuous Authentication. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security and ASIA CCS’17: ACM Asia Conference on Computer and Communications Security, Abu Dhabi, United Arab Emirates, 2–6 April 2017; pp. 386–399. [Google Scholar]
- Sangaiah, A.K. Deep Learning and Parallel Computing Environment for Bioengineering Systems; Academic Press: Cambridge, MA, USA, 2019; ISBN 0128172932. [Google Scholar]
- Rong, X. Word2vec parameter learning explained. arXiv 2014, arXiv:1411.2738. [Google Scholar]
- Goldberg, Y.; Levy, O. word2vec Explained: Deriving Mikolov et al.’s negative-sampling word-embedding method. arXiv 2014, arXiv:1402.3722. [Google Scholar]
- Lilleberg, J.; Zhu, Y.; Zhang, Y. Support vector machines and word2vec for text classification with semantic features. In Proceedings of the 2015 IEEE 14th International Conference on Cognitive Informatics & Cognitive Computing (ICCI* CC), Beijing, China, 6–8 July 2015. [Google Scholar]
- Islam, M.S.; Sultana, S.; Roy, U.K.; Al Mahmud, J.; Jahidul, S. HARC-New Hybrid Method with Hierarchical Attention Based Bidirectional Recurrent Neural Network with Dilated Convolutional Neural Network to Recognize Multilabel Emotions from Text. J. Ilm. Tek. Elektro Komput. Dan Inform. 2021, 7, 142–153. [Google Scholar] [CrossRef]
- Yu, Y.Q.; Fan, L.; Li, W.J. Ensemble additive margin softmax for speaker verification. In Proceedings of the ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Brighton, UK, 12–17 May 2019. [Google Scholar]
- Gao, B.; Pavel, L. On the properties of the softmax function with application in game theory and reinforcement learning. arXiv 2017, arXiv:1704.00805. [Google Scholar]
- Bouchard, G. Efficient bounds for the softmax function, applications to inference in hybrid models. In Presentation at the Workshop for Approximate Bayesian Inference in Continuous/Hybrid Systems at NIPS-07; Citeseer: Princeton, NJ, USA, 2007. [Google Scholar]
- Zhang, W.; Yoshida, T.; Tang, X. A comparative study of TF * IDF, LSI and multi-words for text classification. Expert Syst. Appl. 2011, 38, 2758–2765. [Google Scholar] [CrossRef]
- Liu, C.Z.; Sheng, Y.X.; Wei, Z.Q.; Yang, Y.Q. Research of text classification based on improved TF-IDF algorithm. In Proceedings of the 2018 IEEE International Conference of Intelligent Robotic and Control Engineering (IRCE), Lanzhou, China, 24–27 August 2018. [Google Scholar]
- Pham, D.-H.; Le, A.-C. Exploiting multiple word embeddings and one-hot character vectors for aspect-based sentiment analysis. Int. J. Approx. Reason. 2018, 103, 1–10. [Google Scholar] [CrossRef]
- Ng, P. dna2vec: Consistent vector representations of variable-length k-mers. arXiv 2017, arXiv:1701.06279. [Google Scholar]
- Braud, C.; Denis, P. Comparing word representations for implicit discourse relation classification. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, Lisbon, Portugal, 17–21 September 2015. [Google Scholar]
- Zhang, M.; Li, Z.; Fu, G.; Zhang, M. Dependency-based word embeddings. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics, Baltimore, MD, USA, 22–27 June 2014; Volume 2. [Google Scholar]
- Wang, F.; Cheng, J.; Liu, W.; Liu, H. Additive margin softmax for face verification. IEEE Signal Process. Lett. 2018, 25, 926–930. [Google Scholar] [CrossRef] [Green Version]
- Fernández, A.; Garcia, S.; Herrera, F.; Chawla, N.V. SMOTE for learning from imbalanced data: Progress and challenges, marking the 15-year anniversary. J. Artif. Intell. Res. 2018, 61, 863–905. [Google Scholar] [CrossRef]
- Chawla, N.V.; Bowyer, K.W.; Hall, L.O.; Kegelmeyer, W.P. SMOTE: Synthetic minority over-sampling technique. J. Artif. Intell. Res. 2002, 16, 321–357. [Google Scholar] [CrossRef]
- Xu, G.; Dong, J.; Ma, C.; Liu, J.; Cliff, U.G.O. A Certificateless Signcryption Mechanism Based on Blockchain for Edge Computing. IEEE Internet Things J. 2022. [Google Scholar] [CrossRef]
Symbolic Representation | Token |
---|---|
function | FUN |
contract | CON |
for | FOR |
if | IF |
else | ELSE |
number | NUM |
constant | CONS |
variable | VAR |
Vulnerability | Key Points |
---|---|
Reentrancy | fallback (), call.value () |
Timestamp dependence | block.number |
Infinite loop | for, while loop |
Integer overflow | integer variables |
Integer underflow | integer variables |
Callstack depth attack | .call (), transfer () and the return values of instructions |
Dataset | Vulnerability | Models Selected by Our Framework | ACC (%) | TPR (%) | FPR (%) | PRE (%) | F1 (%) |
---|---|---|---|---|---|---|---|
CESC | Reentrancy | SPCBIG-EC | 96.66 | 98.04 | 5.71 | 94.55 | 96.74 |
Timestamp | SPCBIG-EC | 91.11 | 96.84 | 14.64 | 86.93 | 91.62 | |
Infinite loop | SPCBIG-EC | 94.87 | 93.16 | 3.41 | 96.46 | 95.00 | |
Callstack depth attack | SPCBIG-EC | 90.02 | 86.32 | 7.24 | 92.25 | 89.14 | |
Integer overflow | SPCBIG-EC | 85.11 | 97.10 | 16.90 | 83.80 | 85.42 | |
Integer underflow | SPCBIG-EC | 86.47 | 89.24 | 16.29 | 84.57 | 86.83 |
Metrics | ACC (%) | TPR (%) | FPR (%) | PRE (%) | F1 (%) | |
---|---|---|---|---|---|---|
Model | ||||||
Reentrancy | BiGRU | 85.38 | 86.57 | 11.42 | 85.23 | 85.55 |
SPCNN | 87.14 | 87.12 | 12.23 | 85.45 | 86.77 | |
SPCBIG-EC | 96.66 | 98.04 | 5.71 | 94.55 | 96.74 | |
Timestamp | BiGRU | 82.45 | 83.82 | 13.28 | 71.29 | 76.82 |
SPCNN | 83.48 | 82.56 | 12.84 | 75.27 | 79.19 | |
SPCBIG-EC | 91.11 | 96.84 | 14.64 | 86.93 | 91.62 | |
Infinite loop | BiGRU | 80.11 | 83.54 | 21.45 | 73.98 | 76.27 |
SPCNN | 79.79 | 85.14 | 11.84 | 75.17 | 78.86 | |
SPCBIG-EC | 94.87 | 93.16 | 3.41 | 96.46 | 95.00 |
Metrics | ACC (%) | TPR (%) | FPR (%) | PRE (%) | F1 (%) | |
---|---|---|---|---|---|---|
Serial Neural Network | ||||||
CNN-RNN | 75.25 | 62.56 | 12.06 | 83.84 | 71.65 | |
CNN-LSTM | 79.77 | 79.90 | 20.35 | 79.70 | 79.80 | |
CNN-GRU | 80.52 | 71.11 | 10.05 | 87.61 | 78.50 | |
CNN-BLSTM | 80.65 | 76.63 | 15.32 | 83.33 | 79.85 | |
CNN-BiGRU | 81.41 | 81.91 | 19.09 | 81.10 | 81.50 | |
SCNN-RNN | 79.02 | 72.36 | 14.32 | 83.47 | 77.52 | |
SCNN-LSTM | 78.64 | 82.16 | 24.87 | 76.76 | 79.37 | |
SCNN-GRU | 81.40 | 73.11 | 10.30 | 87.65 | 79.72 | |
SCNN-BLSTM | 82.41 | 72.11 | 10.29 | 90.82 | 80.39 | |
SCNN-BiGRU | 82.92 | 80.90 | 15.07 | 84.30 | 82.56 | |
SPCNN-RNN | 79.27 | 87.69 | 29.14 | 75.05 | 80.88 | |
SPCNN-LSTM | 80.15 | 80.00 | 19.50 | 80.30 | 80.10 | |
SPCNN-GRU | 82.03 | 81.66 | 17.58 | 82.28 | 81.97 | |
SPCNN-BLSTM | 82.66 | 81.16 | 15.82 | 83.68 | 82.40 | |
SPCBIG-EC | 85.89 | 85.00 | 9.23 | 91.41 | 85.71 |
Metrics | ACC (%) | TPR (%) | FPR (%) | PRE (%) | F1 (%) | |
---|---|---|---|---|---|---|
Model | ||||||
Reentrancy | CNN-BiGRU | 84.76 | 76.19 | 6.67 | 91.95 | 83.33 |
SCNN-BiGRU | 86.19 | 93.33 | 20.95 | 81.67 | 87.11 | |
SPCBIG-EC | 96.66 | 98.04 | 5.71 | 94.55 | 96.74 | |
Timestamp | CNN-BiGRU | 87.61 | 92.72 | 23.42 | 80.73 | 88.83 |
SPCNN-BiGRU | 90.47 | 91.77 | 10.83 | 89.5 | 90.62 | |
SPCBIG-EC | 91.11 | 96.84 | 14.64 | 86.93 | 91.62 | |
Infinite loop | CNN-BiGRU | 80.77 | 72.65 | 11.11 | 86.73 | 79.0 |
SPCNN-BiGRU | 89.74 | 88.03 | 8.55 | 91.15 | 89.57 | |
SPCBIG-EC | 94.87 | 93.16 | 3.41 | 96.46 | 95.00 |
Methods | Reentrancy | Timestamp | ||||||
---|---|---|---|---|---|---|---|---|
ACC (%) | TPR (%) | PRE (%) | F1 (%) | ACC (%) | TPR (%) | PRE (%) | F1 (%) | |
Oyenete | 71.50 | 50.84 | 51.72 | 51.28 | 60.54 | 31.94 | 48.94 | 38.66 |
Mythril | 60.00 | 39.21 | 68.96 | 50.00 | 64.87 | 34.53 | 58.54 | 42.48 |
Smartcheck | 52.00 | 24.32 | 31.03 | 27.27 | 61.08 | 29.17 | 50.00 | 36.84 |
Securify | 53.50 | 37.41 | 89.66 | 52.79 | - | - | - | - |
SPCBIG-EC | 96.66 | 98.04 | 94.55 | 96.74 | 91.11 | 96.84 | 86.93 | 91.62 |
Methods | Reentrancy | Timestamp | Infinite Loop | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
ACC (%) | TPR (%) | PRE (%) | F1 (%) | ACC (%) | TPR (%) | PRE (%) | F1 (%) | ACC (%) | TPR (%) | PRE (%) | F1 (%) | |
GR-GCN | 81.47 | 80.89 | 72.36 | 76.39 | 78.68 | 78.91 | 71.29 | 74.91 | 68.34 | 67.82 | 64.89 | 66.32 |
TMP | 84.48 | 82.63 | 74.06 | 78.11 | 83.45 | 83.82 | 75.05 | 79.19 | 74.61 | 74.32 | 73.89 | 74.10 |
CGE | 89.15 | 87.62 | 85.24 | 86.41 | 89.02 | 88.10 | 87.41 | 87.75 | 83.21 | 82.29 | 81.97 | 82.13 |
AME | 90.19 | 89.69 | 86.25 | 87.94 | 86.52 | 86.23 | 82.07 | 84.10 | 80.32 | 79.08 | 78.69 | 78.88 |
Eth2Vec | 85.50 | 74.32 | 86.60 | 61.50 | - | - | - | - | - | - | - | - |
AFS | 93.07 | 94.60 | 90.00 | 93.21 | - | - | - | - | - | - | - | - |
DeeSCV | 93.02 | 83.46 | 90.70 | 86.87 | 80.50 | 74.86 | 85.53 | 79.93 | - | - | - | - |
SPCBIG-EC | 96.66 | 98.04 | 94.55 | 96.74 | 91.11 | 96.84 | 86.93 | 91.62 | 94.87 | 93.16 | 96.46 | 86.93 |
Model | Dataset | ACC (%) | TPR (%) | FPR (%) | PRE (%) | F1 (%) |
---|---|---|---|---|---|---|
SPCBIG-EC | UCESC | 85.89 | 85.00 | 9.23 | 91.41 | 85.71 |
SCVDIE-Ensemble [39] | 91.80 | 95.25 | 11.67 | 90.00 | 92.10 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zhang, L.; Li, Y.; Jin, T.; Wang, W.; Jin, Z.; Zhao, C.; Cai, Z.; Chen, H. SPCBIG-EC: A Robust Serial Hybrid Model for Smart Contract Vulnerability Detection. Sensors 2022, 22, 4621. https://doi.org/10.3390/s22124621
Zhang L, Li Y, Jin T, Wang W, Jin Z, Zhao C, Cai Z, Chen H. SPCBIG-EC: A Robust Serial Hybrid Model for Smart Contract Vulnerability Detection. Sensors. 2022; 22(12):4621. https://doi.org/10.3390/s22124621
Chicago/Turabian StyleZhang, Lejun, Yuan Li, Tianxing Jin, Weizheng Wang, Zilong Jin, Chunhui Zhao, Zhennao Cai, and Huiling Chen. 2022. "SPCBIG-EC: A Robust Serial Hybrid Model for Smart Contract Vulnerability Detection" Sensors 22, no. 12: 4621. https://doi.org/10.3390/s22124621
APA StyleZhang, L., Li, Y., Jin, T., Wang, W., Jin, Z., Zhao, C., Cai, Z., & Chen, H. (2022). SPCBIG-EC: A Robust Serial Hybrid Model for Smart Contract Vulnerability Detection. Sensors, 22(12), 4621. https://doi.org/10.3390/s22124621