AdvSCanner: Generating Adversarial Smart Contracts to Exploit Reentrancy Vulnerabilities Using LLM and Static Analysis
Open Access
- 27 October 2024
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 1019-1031
Abstract
Smart contracts are prone to vulnerabilities, with reentrancy attacks posing significant risks due to their destructive potential. While various methods exist for detecting reentrancy vulnerabilities in smart contracts, such as static analysis, these approaches often suffer from high false positive rates and lack the ability to directly illustrate how vulnerabilities can be exploited in attacks. In this paper, we tackle the challenging task of generating ASCs for identified reentrancy vulnerabilities. To address this difficulty, we introduce AdvSCanner, a novel method that leverages the Large Language Model (LLM) and static analysis to automatically generate adversarial smart contracts (ASCs) designed to exploit reentrancy vulnerabilities in victim contracts. The basic idea of AdvSCanner is to extract attack flows associated with reentrancy vulnerabilities using static analysis and utilize them to guide LLM in generating ASCs. To mitigate the inherent inaccuracies in LLM outputs, AdvSCanner incorporates a self-reflection component, which collects compilation and attack-triggering feedback from the generated ASCs and refines the ASC generation if necessary. Experimental evaluations demonstrate the effectiveness of AdvSCanner, achieving a significantly higher success rate (76.41%) compared to baseline methods, which only achieve 6.92% and 18.97%, respectively. Furthermore, a case study illustrates that AdvSCanner can greatly reduce auditing time from 24 hours (without assistance) to approximately 3 hours when used during the auditing process.Keywords
Funding Information
- National Key Research and Development Program of China (2022YFB2703503)
- National Natural Science Foundation of China (62372367, 62232014, 62272377, 62372368)
- Shaanxi Province Innovation Fund (QCYRCXM-2022-345)
- Shaanxi Province Sanqin Talent Introduction Program
This publication has 32 references indexed in Scilit:
- Evaluating Ethereum Reentrancy Detection Tools via Mutation Testing2023
- An Empirical Study on Fine-Tuning Large Language Models of Code for Automated Program Repair2023
- VALAR: Streamlining Alarm Ranking in Static Analysis with Value-Flow Assisted Active Learning2023
- Reentrancy Vulnerability Detection Based on Conv1D-BiGRU and Expert Knowledge2023
- Turn the Rudder: A Beacon of Reentrancy Detection for Smart Contracts on Ethereum2023
- Refactoring Solidity Smart Contracts to Protect Against Reentrancy Exploits2022
- DeeSCVHunter: A Deep Learning-Based Framework for Smart Contract Vulnerability Detection2021
- Oracle-Supported Dynamic Exploit Generation for Smart ContractsIEEE Transactions on Dependable and Secure Computing, 2020
- Slither: A Static Analysis Framework for Smart Contracts2019
- A Survey of Tools for Analyzing Ethereum Smart Contracts2019