Reentrancy Vulnerability Detection Based on Improved Attention Mechanism
摘要
With smart contracts rapidly proliferating, the efficiency of existing detection methods is inadequate. Detecting loopholes in contracts is a critical concern, and in this article, we present a fragmented, symbolic representation of smart contracts aimed to capture vital vulnerability semantic information and control flow correlation. Furthermore, for in-depth analysis of vulnerabilities in extensive code fragments, we refine the conventional attention mechanism to balance attention weights based on code semantics and context-specific features. We also integrate the text classification model TextRNN with the improved attention mechanism (LinkAttention) to precisely identify reentrancy vulnerabilities. Our experimental studies conducted on diverse real-world smart contracts suggest that our method outperforms existing vulnerability detection tools.