PromFuzz: Leveraging LLM-Driven and Bug-Oriented Composite Analysis for Detecting Functional Bugs in Smart Contracts

Xingshuang Lin, Qinge Xie, Binbin Zhao, Yuan Tian, Saman Zonouz, Na Ruan, Jie Li, Raheem Beyah, Shouling Ji

TL;DR

This paper introduces PromFuzz, a novel system that uses Large Language Models (LLMs) and a dual-agent approach to automatically detect functional bugs in smart contracts. By bridging the gap between high-level business logic and low-level code, PromFuzz significantly improves bug detection accuracy and has identified numerous zero-day vulnerabilities in real-world DeFi projects, safeguarding billions in assets.

What Problem Does This Paper Address?

Smart contracts are the backbone of many blockchain applications, enabling complex financial transactions. However, they are notoriously susceptible to bugs, particularly "functional bugs," which are often subtle and can lead to substantial financial losses. Existing tools struggle to detect these bugs because they often require a deep understanding of the contract's intended business logic, which is difficult to extract from the low-level code. This gap between understanding the "what" (business logic) and the "how" (implementation) makes automated detection of functional bugs a significant challenge.

Methods

PromFuzz tackles this challenge with a multi-pronged approach:

  • LLM-Driven Multi-Perspective Analysis: At its core, PromFuzz leverages LLMs (specifically GPT-4-turbo) to understand the complex business logic. It employs a unique "dual-agent" strategy:
  • Auditor Agent: Mimics a meticulous human auditor, focusing on code semantics and correctness.
  • Attacker Agent: Emulates an attacker's mindset, looking for exploitable weaknesses. By fusing the insights from both agents, PromFuzz can more accurately pinpoint potentially vulnerable functions.

  • Invariant Checker Generation: To overcome LLM's inherent randomness, PromFuzz generates "invariant checkers." These are practical bug detectors that leverage logic extracted from vulnerable functions. This is achieved through a two-stage process:

  • Hierarchical Matching: LLMs identify critical variables and principal statements related to potential bugs.
  • Template-based Checker Generation: Predefined checker templates are populated with the extracted information to create robust invariant checkers.
  • Bug-Oriented Analysis Engine: This engine strategically inserts the generated invariant checkers into the smart contract code. Instead of random exploration, it focuses fuzzing efforts on these critical areas, significantly improving efficiency and effectiveness.

Datasets

PromFuzz was evaluated on a comprehensive set of datasets:

  • DExploit-SC: 7 real-world attack cases with 47 contracts.
  • DBV-SC: 10 real-world audit cases with 36 contracts.
  • DSynth-SC: 6 synthetic cases with 44 contracts, designed to expand on existing datasets.
  • DSE-SC: 26 contracts with 59 extracted symbols, used for evaluating invariant checker generation accuracy.
  • DReal-DeFi: 10 real-world DeFi projects with 108 smart contracts, used for discovering zero-day bugs.

The authors also introduced the first ground-truth dataset for verified functional bugs in smart contracts, comprising 261 contracts from various DeFi projects.

Key Insights and Ideas

  • Dual-Agent LLM Approach is Key: The combination of an "auditor" and an "attacker" perspective for LLM analysis is crucial for comprehensive bug detection, outperforming a single-perspective approach.
  • Bridging Logic and Code: The core challenge in functional bug detection is the disconnect between high-level business intent and low-level implementation. PromFuzz's success lies in its ability to bridge this gap.
  • Invariant Checkers as Practical Oracles: Generating specific, logic-driven invariant checkers is more effective than relying on generic oracles for functional bug detection.
  • Bug-Oriented Fuzzing is More Efficient: Targeting fuzzing efforts based on identified vulnerabilities and invariant checkers is far more effective than random fuzzing for functional bugs.
  • Real-World Impact is Significant: The detection of numerous zero-day bugs in high-value DeFi projects highlights the critical need for such advanced detection tools.

Key Results

PromFuzz demonstrated impressive performance:

  • Accuracy: Achieved 86.96% recall and 93.02% F1-score in detecting functional bugs, representing at least a 50% improvement over state-of-the-art methods.
  • Zero-Day Bugs: Identified 30 zero-day bugs in 6 out of 10 real-world DeFi projects, with 24 bugs assigned CVE IDs.
  • Asset Safeguarded: The discoveries have helped safeguard assets totaling $18.2 billion.
  • Efficiency: Scans smart contracts in an average of 43.8 seconds at a cost of approximately $0.15 per scan.

Limitations and Future Work

The authors acknowledge several limitations:

  • False Negatives: Some false negatives can occur due to inaccuracies in extracting critical variables and the inherent randomness of LLMs.
  • Limited Bug Categories: The current system targets four main categories and ten subcategories of functional bugs, potentially missing more complex or novel bug types.
  • Reliance on Existing Tools: PromFuzz's analysis partially relies on ItyFuzz, which is not specifically designed for functional bugs and may not fully utilize contract status information.

Future work includes:

  • Fine-tuning LLMs: Developing specialized LLMs for enhanced functional bug detection.
  • Expanding Bug Categories: Creating new prompts and strategies to cover a wider range of bug types.
  • Better LLM-Dynamic Analysis Integration: Improving the integration of LLMs with dynamic analysis techniques to more comprehensively utilize contract status information.

Summary updated

BibTeX
@misc{lin2025promfuzz,
  author = {Xingshuang Lin and Qinge Xie and Binbin Zhao and Yuan Tian and Saman Zonouz and Na Ruan and Jie Li and Raheem Beyah and Shouling Ji},
  title = {{PromFuzz: Leveraging LLM-Driven and Bug-Oriented Composite Analysis for Detecting Functional Bugs in Smart Contracts}},
  year = {2025},
  eprint = {2503.23718},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.23718},
}
Figure