Adversarial generation method for smart contract fuzz testing seeds guided by chain-based LLM

被引:0
|
作者
Sun, Jiaze [1 ,2 ,3 ]
Yin, Zhiqiang [1 ]
Zhang, Hengshan [1 ,2 ,3 ]
Chen, Xiang [4 ]
Zheng, Wei [5 ]
机构
[1] Xian Univ Posts & Telecommun, Sch Comp Sci & Technol, Xian 710121, Peoples R China
[2] Xian Univ Posts & Telecommun, Shaanxi Key Lab Network Data Anal & Intelligent Pr, Xian 710121, Peoples R China
[3] Xian Univ Posts & Telecommun, Xian Key Lab Big Data & Intelligent Comp, Xian 710121, Peoples R China
[4] Nantong Univ, Sch Informat Sci & Technol, Nantong 226019, Peoples R China
[5] Northwestern Polytech Univ, Sch Software, Xian 710072, Peoples R China
基金
中国国家自然科学基金;
关键词
Fuzz testing; Smart contracts; LLM; Seed set generation; Prompts;
D O I
10.1007/s10515-024-00483-4
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
With the rapid development of smart contract technology and the continuous expansion of blockchain application scenarios, the security issues of smart contracts have garnered significant attention. However, traditional fuzz testing typically relies on randomly generated initial seed sets. This random generation method fails to understand the semantics of smart contracts, resulting in insufficient seed coverage. Additionally, traditional fuzz testing often ignores the syntax and semantic constraints within smart contracts, leading to the generation of seeds that may not conform to the syntactic rules of the contracts and may even include logic that violates contract semantics, thereby reducing the efficiency of fuzz testing. To address these challenges, we propose a method for adversarial generation for smart contract fuzz testing seeds guided by Chain-Based LLM, leveraging the deep semantic understanding capabilities of LLM to assist in seed set generation. Firstly, we propose a method that utilizes Chain-Based prompts to request LLM to generate fuzz testing seeds, breaking down the LLM tasks into multiple steps to gradually guide the LLM in generating high-coverage seed sets. Secondly, by establishing adversarial roles for the LLM, we guide the LLM to autonomously generate and optimize seed sets, producing high-coverage initial seed sets for the program under test. To evaluate the effectiveness of the proposed method, 2308 smart contracts were crawled from Etherscan for experimental purposes. Results indicate that using Chain-Based prompts to request LLM to generate fuzz testing seed sets improved instruction coverage by 2.94% compared to single-step requests. The method of generating seed sets by establishing adversarial roles for the LLM reduced the time to reach maximum instruction coverage from 60 s to approximately 30 s compared to single-role methods. Additionally, the seed sets generated by the proposed method can directly trigger simple types of vulnerabilities (e.g., timestamp dependency and block number dependency vulnerabilities), with instruction coverage improvements of 3.8% and 4.1%, respectively.
引用
收藏
页数:28
相关论文
共 2 条
  • [1] SoliAudit: Smart Contract Vulnerability Assessment Based on Machine Learning and Fuzz Testing
    Liao, Jian-Wei
    Tsai, Tsung-Ta
    He, Chia-Kang
    Tien, Chin-Wei
    2019 SIXTH INTERNATIONAL CONFERENCE ON INTERNET OF THINGS: SYSTEMS, MANAGEMENT AND SECURITY (IOTSMS), 2019, : 458 - 465
  • [2] Towards Effective Guidance of Smart Contract Fuzz Testing Based on Static Analysis
    Park, Jeongwon
    Choi, Jaeseung
    ELECTRONICS, 2025, 14 (04):