Smart Contract Vulnerability Detection Using Combined Sequence and Graph Features from Source Code
摘要
Smart contract vulnerabilities represent a significant threat to the security and reliability of blockchain ecosystems, highlighting the need for efficient and accurate detection methods. Existing methods struggle to capture the rich semantic and structural information in smart contracts. To address these issues, this work proposes SeqGraphFusion (SGF), a framework that leverages the complementary strengths of token sequence and graph-based representations extracted from smart contract source code. SGF’s key insight lies in its heterogeneous fusion of these sequence and graph features, enabling a more comprehensive understanding of the contract. To enhance the modeling of long-range dependencies, which have been constrained in traditional Graph Neural Networks due to the nature of message passing, SGF incorporates a Graph Transformer-based architecture, facilitating more effective information propagation. The experimental results demonstrate that our method significantly outperforms existing approaches, achieving a notable improvement in the F1 score, with an average increase of 2.82% across arithmetic and reentrancy vulnerability detection tasks compared to the best-performing baseline. Specifically, our method achieves F1 scores of 92.26% and 95.1% for arithmetic and reentrancy vulnerabilities, respectively. By effectively harnessing the complementary strengths of token sequence and graph-based representations to form a more comprehensive model of smart contract code, this work establishes a valuable new technique that not only enhances smart contract security but also promotes the development of more robust blockchain applications.