Netinfo Security ›› 2025, Vol. 25 ›› Issue (4): 664-673.doi: 10.3969/j.issn.1671-1122.2025.04.014

Previous Articles     Next Articles

Smart Contract Vulnerability Detection Method Combining Prompt Tuning

ZHANG Yuxuan1, HUANG Cheng1, LIU Rong1, LENG Tao2()   

  1. 1. School of Cyber Science and Engineering, Sichuan University, Chengdu 610207, China
    2. Intelligent Policing Key Laboratory of Sichuan Province, Sichuan Police College, Luzhou 646000, China
  • Received:2025-01-15 Online:2025-04-10 Published:2025-04-25

Abstract:

With the rapid development of blockchain trading platforms, the deployment of smart contracts has increased significantly. However, in recent years, vulnerabilities in smart contracts have led to substantial economic losses for block-chain transaction platforms, drawing considerable attention from researchers to the field of smart contract security. Existing methods either heavily rely on expert rules or complex data processing steps, or employ models or learning strategies that are misaligned with the objectives of this field, resulting in poor detection performance. Therefore, this paper proposed PC-Detector, a vulnerability detection method for smart contracts utilizing prompt fine-tuning of large language models. By introducing task-specific prompt knowledge, this method ensured consistency between the target task and the model’s pretraining tasks, thereby enhancing model adaptability and improving detection performance. Specifically, the paper proposed four prompt design strategies tailored to smart contract vulnerability detection and examined the impact of embedding prompts at different positions on detection performance. Furthermore, the paper prompt-tuning on the CodeT5 series models using code-embedded prompts to detect vulnerabilities in smart contracts. Extensive experiments demonstrate that this method significantly improved detection performance.

Key words: smart contract, blockchain, vulnerability detection, prompt tuning

CLC Number: