[Paper Review] Large Language Model-Powered Smart Contract Vulnerability Detection: New Perspectives
Proposes GPTLens, a two-stage, purely LLM-driven framework (generation and discrimination) to improve smart contract vulnerability detection and reduce false positives, showing substantial gains over one-shot detection on CVE-reported contracts.
This paper provides a systematic analysis of the opportunities, challenges, and potential solutions of harnessing Large Language Models (LLMs) such as GPT-4 to dig out vulnerabilities within smart contracts based on our ongoing research. For the task of smart contract vulnerability detection, achieving practical usability hinges on identifying as many true vulnerabilities as possible while minimizing the number of false positives. Nonetheless, our empirical study reveals contradictory yet interesting findings: generating more answers with higher randomness largely boosts the likelihood of producing a correct answer but inevitably leads to a higher number of false positives. To mitigate this tension, we propose an adversarial framework dubbed GPTLens that breaks the conventional one-stage detection into two synergistic stages $-$ generation and discrimination, for progressive detection and refinement, wherein the LLM plays dual roles, i.e., auditor and critic, respectively. The goal of auditor is to yield a broad spectrum of vulnerabilities with the hope of encompassing the correct answer, whereas the goal of critic that evaluates the validity of identified vulnerabilities is to minimize the number of false positives. Experimental results and illustrative examples demonstrate that auditor and critic work together harmoniously to yield pronounced improvements over the conventional one-stage detection. GPTLens is intuitive, strategic, and entirely LLM-driven without relying on specialist expertise in smart contracts, showcasing its methodical generality and potential to detect a broad spectrum of vulnerabilities. Our code is available at: https://github.com/git-disl/GPTLens.
Motivation & Objective
- Assess opportunities and challenges of using LLMs for smart contract vulnerability detection.
- Identify the trade-off between generating diverse outputs and false positives in LLM-based detection.
- Propose GPTLens to separate generation and discrimination to improve detection accuracy.
- Evaluate GPTLens against real-world CVE-reported contracts and baselines.
- Highlight the generality and practicality of an end-to-end LLM-driven approach without expert smarts-contract tooling.
Proposed method
- Open-ended prompting to enable broad vulnerability description beyond predefined categories.
- Two-stage GPTLens framework with auditor (generation) and critic (discrimination) agents operating on a single LLM.
- Auditors produce multiple high-diversity vulnerability candidates with reasoning.
- Critic ranks and scores candidates on correctness, severity, and profitability to select top outputs.
- Experimental evaluation on 13 CVE-linked smart contracts with GPT-4 backend.
- Comparison across several configurations (A, R, C, O) and varying numbers of auditors (n) and outputs per auditor (m).
Experimental results
Research questions
- RQ1Can open-ended prompting enable broad vulnerability discovery beyond predefined categories?
- RQ2Does separating generation and discrimination reduce false positives while preserving true positives in LLM-powered vulnerability detection?
- RQ3What is the impact of the number of auditors (n) and outputs per auditor (m) on detection performance?
- RQ4How does GPTLens perform relative to one-stage detection baselines on real CVEs?
- RQ5Is the approach purely LLM-driven and generalizable across vulnerability types?
Key findings
- GPTLens substantially increases contract-level hit rate for CVE detection (76.9% top-1 hit) versus 38.5% for one-stage detection.
- At the trial level, top-1 hit rate improves from 33.3% to 59.0% with GPTLens configurations.
- Using a critic (A+C) markedly improves precision by filtering false positives compared to pure generation.
- Increasing the number of auditors (n) further improves trial-level performance (e.g., from 46.2% to 59.0%).
- GPTLens is pure LLM-driven and does not rely on smart-contract expert knowledge, showing generality across vulnerability types.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.