PropertyGPT: LLM-driven Formal Verification of Smart Contracts through Retrieval-Augmented Property Generation

  • Ye LIU
  • , Yue XUE
  • , Daoyuan WU*
  • , Yuqiang SUN
  • , Yi LI
  • , Miaolei SHI
  • , Yang LIU
  • *Corresponding author for this work

Research output: Book Chapters | Papers in Conference ProceedingsConference paper (refereed)Researchpeer-review

Abstract

Formal verification is a technique that can prove the correctness of a system with respect to a certain specification or property. It is especially valuable for security-sensitive smart contracts that manage billions in cryptocurrency assets. Although existing research has developed various static verification tools (or provers) for smart contracts, a key missing component is the automated generation of comprehensive properties, including invariants, pre-/post-conditions, and rules. Hence, industry-leading players like Certora have to rely on their own or crowdsourced experts to manually write properties case by case.
With recent advances in large language models (LLMs), this paper explores the potential of leveraging state-of-the-art LLMs, such as GPT-4, to transfer existing human-written properties (e.g., those from Certora auditing reports) and automatically generate customized properties for unknown code. To this end, we embed existing properties into a vector database and retrieve a reference property for LLM-based in-context learning to generate a new property for a given code. While this basic process is relatively straightforward, ensuring that the generated properties are (i) compilable, (ii) appropriate, and (iii) verifiable presents challenges. To address (i), we use the compilation and static analysis feedback as an external oracle to guide LLMs in iteratively revising the generated properties. For (ii), we consider multiple dimensions of similarity to rank the properties and employ a weighted algorithm to identify the top-K properties as the final result. For (iii), we design a dedicated prover to formally verify the correctness of the generated properties. We have implemented these strategies into a novel LLM-based property generation tool called PropertyGPT. Our experiments show that PropertyGPT can generate comprehensive and high-quality properties, achieving an 80% recall compared to the ground truth. It successfully detected 26 CVEs/attack incidents out of 37 tested and also uncovered 12 zero-day vulnerabilities, leading to $8,256 in bug bounty rewards.
Original languageEnglish
Title of host publicationProceedings: 2025 Network and Distributed System Security Symposium
PublisherInternet Society
ChapterSession 11A
Number of pages17
ISBN (Electronic)9798989437283
DOIs
Publication statusPublished - Feb 2025
Externally publishedYes
EventNetwork and Distributed System Security (NDSS) Symposium 2025 - San Diego, United States
Duration: 24 Feb 202528 Feb 2025

Symposium

SymposiumNetwork and Distributed System Security (NDSS) Symposium 2025
Abbreviated titleNDSS 2025
Country/TerritoryUnited States
CitySan Diego
Period24/02/2528/02/25

Bibliographical note

Acknowledgment:
We thank all the reviewers for their constructive feedback on this paper.

Funding

This research/project is supported by the Singapore Ministry of Education Academic Research Fund Tier 1 (RG12/23), the Nanyang Technological University Centre for Computational Technologies in Finance (NTU-CCTF), the National Research Foundation Singapore and DSO National Laboratories under the AI Singapore Programme (AISG Award No: AISG2-RP-2020019), and the National Research Foundation, Prime Minister’s Office, Singapore under its Campus for Research Excellence and Technological Enterprise (CREATE) programme. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not reflect the views of NTU-CCTF, National Research Foundation, Singapore and Cyber Security Agency of Singapore.

Fingerprint

Dive into the research topics of 'PropertyGPT: LLM-driven Formal Verification of Smart Contracts through Retrieval-Augmented Property Generation'. Together they form a unique fingerprint.

Cite this