Heterogeneous Data Fusion Based Vulnerability Detection for Ethereum Smart Contracts
摘要
Smart contracts, as a critical application of blockchain technology, play a pivotal role in automating contract rules and enhancing the transparency of transactions. They are programmed to define rules and automate protocols on the blockchain, ensuring that transactions are decentralized, efficient, and immutable. Once deployed, smart contracts cannot be altered, and any existing vulnerabilities can be maliciously exploited, leading to potential financial losses or data breaches. Consequently, the security of smart contracts has become a critical focus in blockchain security. This paper presents the XLNET-HyBA model for Ethereum smart contract vulnerability detection based on the fusion of heterogeneous data. Initially, the source code is transformed into Abstract Syntax Tree (AST) serialized information by the SmartConvert preprocessing algorithm, which effectively integrates the scattered control flow elements. Subsequently, a novel information fusion embedding technique is proposed to optimize the contribution weights of source code and AST serialized code, aiming for a more accurate localization of potential vulnerabilities. Finally, a hybrid loss function strategy based on metric learning is constructed, enhancing the model’s sensitivity to subtle differences. The experimental results show that the accuracy of all four vulnerabilities is over 96% and the recall is over 93%. In the case of the arithmetic vulnerability, the experimental results show an improvement of 6.87%, 5.24%, 10.40%, and 7.85% in accuracy, precision, recall, and F1 value, respectively, compared to previous work. The method shows strong adaptability and wide applicability in dealing with different contract data and has important value and relevance in smart contract security research.