APSEC 2024
Tue 3 - Fri 6 December 2024 China

Smart contracts have brought revolutionary advancements to the credit landscape. However, their security remains intensely scrutinized due to numerous hacking incidents and inherent logical challenges. One well-known and representative issue is reentrancy vulnerability, exemplified by DAO attacks that lead to substantial economic losses. Conventional approaches to detect and repair reentrancy vulnerability often suffer from numerous limitations, encompassing disregard for the intricate vulnerability features and the overfitting problems associated with imbalanced datasets. Large language models are distinguished for their excellent language understanding and have achieved explosive success in artificial intelligence. However, direct prompt-based LLMs-driven approaches for reentrancy vulnerability are plagued by inefficiencies and a lack of domain-specific vulnerability knowledge. This paper proposes a hybrid framework to enhance reentrancy vulnerability detection and repair and safeguard smart contract security. This unified framework comprises two crucial modules: enhanced DL-driven vulnerability detection and knowledge-aware LLMs-driven vulnerability repair. Our approach can significantly enhance reentrancy vulnerability detection and repair efficiency by integrating advanced techniques such as feature extraction, data balancing, deep learning networks, and knowledge-aware prompting. Extensive experimental results validate the superiority of our approach over state-of-the-art baselines, emphasizing its potential to fortify the security of smart contracts and blockchain-based systems. For instance, our approach can achieve 3.51%, 2.31%, 0.42%, and 0.85% improvements in accuracy, recall, precision, and F1 score while detecting reentrancy vulnerability. Additionally, our approach also can achieve a 9.62% improvement in reentrancy vulnerability repair.