Large Language Model based Smart Contract Auditing with LLMBugScanner
Yining Yuan, Yifei Wang, Yichang Xu, Zachary Yahn, Sihao Hu, Ling Liu · 2025
Read Large Language Model based Smart Contract Auditing with LLMBugScanner by Yining Yuan, Yifei Wang, Yichang Xu, Zachary Yahn, Sihao Hu, Ling Liu (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2512-02069.txt.
Introduction
Smart contracts move real money on blockchains, and a single bug can drain them. Yining Yuan and five co-authors present LLMBugScanner in 2025, a system that uses large language models, fine-tuned and combined in an ensemble, to audit smart contract code for vulnerabilities.
The authors begin by identifying what makes language models hard to apply to auditing, from subtle bug patterns to noisy judgments. Fine-tuning adapts the models to contract code, and ensemble learning pools several models' verdicts for reliability. Automated auditing that catches real flaws early would strengthen a software ecosystem where fixes after deployment are nearly impossible.
Catalog record
| CREATOR | Yining Yuan, Yifei Wang, Yichang Xu, Zachary Yahn, Sihao Hu, Ling Liu |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 39 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2512-02069
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Large Language Model based Smart Contract Auditing with LLMBugScanner Yining Yuan, Yifei Wang, Yichang Xu, Zachary Yahn, Sihao Hu, Ling Liu Abstract This paper presents LLMBugScanner − - a large language model (LLM) powered approach to smart contract vulnerability detection with fine-tuning and ensemble learning. First, the paper identifies the challenges of leveraging for auditing and bug detection of smart contract programs. For example, different pre-trained LLMs may have different reasoning capabilities, and a single LLM may not be consistently effective for all vulnerability types and/or all type of smart contract programs. Such problems also persist across fine-tuned LLMs. To address such challenges, this article explores the adaptation of domain knowledge and ensemble learning and integrates these two synergistic strategies for effective and enhanced generalization performance of smart contract vulnerability detection. With domain knowledge adaptation, we fine-tune LLMs on complementary datasets to provide both general code interpretation and instructional supervision, using parameter-efficient techniques to reduce computational cost. With LLM-ensemble, we capitalize on the complimentary wisdom of diverse LLMs to generate improved reasoning results through consensus based conflict resolution. Extensive experiments are performed on multiple popular LLMs. We compare LLMBugScanner with both individual pre-trained LLMs and their fine-tuned versions in terms of their smart contract vulnerability detection performance. Our measurement results show that LLMBugScanner delivers consistent accuracy gains and better generalization, highlighting LLMBugScanner as a principled, cost-effective, and extensible framework for smart contract auditing. 1 Introduction Smart contracts are self-executing programs that are managed and executed on the blockchain, enabling decentralized applications such as DeFi and NFTs to operate without intermediaries, collectively managing digital assets [ 26 ] . This immutability (the contract code cannot be directly modified once deployed) serves as a foundation for trust and transparency in decentralized systems. However, it also faces critical risk: Even small bugs in smart contracts can cause catastrophic consequences, including theft, token devaluation, or permanent/unauthorized locking of funds. Research analysis confirms that common programming pitfalls in Ethereum contracts create exploitable security risks that can enable attackers to steal assets or disrupt functionality [ 22 , 41 ] . A quintessential example is the 2016 The DAO exploit, where a reentrancy bug allowed attackers to siphon off about $60 million worth of Ether, resulting in a controversial hard fork of the Ethereum blockchain [ 31 ] . More recently, DeFi platforms have seen security breaches on an even larger scale, underscoring the immense financial risks involved [ 20 , 17 ] . As a result, there’s growing demand for reliable detection tools that can identify vulnerabilities before deployment. A systematic literature review identified nearly 192 different types of Ethereum smart contract vulnerabilities and over 200 detection tools [ 21 ] . Traditional static and dynamic program analyzers [ 7 , 15 , 40 , 32 ] form the core of current auditing pipelines. However, prior empirical studies reveal persistent weaknesses, including high rates of false-positives, incomplete coverage of complex control flows, function-specific blind sports, and limited robustness to new vulnerability patterns [ 22 , 41 ] . These limitations arise because rule-based analyzers depend on pre-defined patterns and fail to capture the actual logic or intent expressed in the code [ 18 ] . Recent advances in large language models (LLMs) present an opportunity for developing a new paradigm for vulnerability detection [ 3 ] . We argue that LLMs offer key advantages over static analyzers through their generality, contextual reasoning, and interpretability. For example, studies show that LLMs trained on code corpora achieve superior semantic code understanding and generation [ 37 ] . Unlike rule-based tools, LLMs holds the potential to detect both known and new vulnerabilities, by reasoning across different semantics of smart contract programs, from logic, comments, to specifications, reducing false negatives in complex issues, e.g., reentrancy or access control flaws. Moreover, LLMs can explain their reasoning in natural language, providing interpretable insights that help auditors and developers validate and prioritize bug fixes. Several projects [ 18 , 39 ] have pioneered the use of LLMs as foundational components in smart contract auditing frameworks. Despite these advances, existing LLM-based approaches remain limited. First, single-model fine-tuning can overfit to specific vulnerability types or datasets, leading to inconsistent predictions across domains [ 13 ] . Second, different LLMs exhibit different reasoning capabilities and no single LLM or its fine-tuned version can correctly and persistently outperform others for smart contract vulnerability detection [ 18 ] . To address these issues, we present LLMBugScanner, an LLM-based smart contract vulnerability detection framework with parameter-efficient adaptation. The design of LLMBugScanner explores the Synergism of domain knowledge adaptation and LLM-ensemble to improve its generalization performance. First, we incorporate Domain knowledge adaptation with heterogeneous smart contract benchmark datasets and parameter-efficient optimization [ 16 ] . This allows LLMBugScanner to capture diverse semantic patterns of smart contract programs, while keeping fine-tuning of LLMs resource-efficient. Second, we develop an LLM-Ensemble approach to combine the reasoning results of multiple independently fine-tuned LLMs to fortify the robustness of the vulnerability detection of LLMBugScanner across diverse vulnerability categories. We performed experiments on 108 real-world smart contracts, all of which were reported to contain vulnerabilities in the Common Vulnerabilities and Exposures (CVEs) database [ 8 ] . Empirically, LLMBugScanner achieves a 60% top 5 detection accuracy on 108 real-world vulnerable contracts from the curated subset of CVE-labeled Solidity contracts [ 18 ] , outperforming single-model baselines by 19% while maintaining efficiency. The results highlight LLMBugScanner as a scalable and robust approach for smart contract vulnerability detection. Table 1 : Categorization of smart contract vulnerabilities. Adapted from Atzei et al. [ 4 ] and extended with insights from later works [ 30 , 48 ] . Vulnerabilities are grouped by layer (Solidity language, the Ethereum Virtual Machine (EVM), and blockchain design) to provide a holistic view of common pitfalls and attack surfaces in Ethereum smart contracts. Layer Vulnerability Description Solidity programming language Denial of Service (block gas limit) Transactions fail if gas usage exceeds the block gas limit (e.g., large loops or arrays). Denial of Service (failed call) Repeated failing external calls in loops can block contract progress. Randomness via blockhash blockhash is predictable and miner-influenced; unsafe for randomness. tx.origin misuse Using tx.origin for authentication enables phishing-style attacks. Integer over/underflow Arithmetic beyond type bounds can corrupt contract state. Re-entrancy External calls before state updates enable repeated withdrawals (e.g., DAO attack). Mishandled exceptions Failing to propagate or handle call errors creates hidden faults. Gasless send Fallbacks exceeding the 2300 gas stipend fail, potentially exploitable. Gas-costly patterns Inefficient loops or storage use waste gas (e.g., flagged by GASPER). Call to unknown Fallback invoked on undefined functions or raw Ether transfers. Hash collision in abi.encodePacked Using abi.encodePacked() with variable-length arguments (e.g., strings) can produce identical byte sequences for different inputs (e.g., ”abc”,”def” vs. ”ab”,”cdef”), leading to hash or signature collisions in verification logic. Insufficient gas griefing Starving subcalls of gas forces upstream reverts. Unprotected Ether withdrawal Missing access control permits unauthorized withdrawals. Floating pragma Unpinned compiler version risks inconsistent builds or compiler bugs. Default visibility Omitted visibility exposes unintended public functions. DELEGATECALL misuse Executes foreign code in caller context, risking state contamination. Unprotected selfdestruct Allows deletion or asset loss without proper authorization. Ethereum Virtual Machine (EVM) Immutable bugs Deployed