Enhancing Smart Contract Vulnerability Detection in DApps Leveraging Fine-Tuned LLM

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Bu, Jiuyang, Li, Wenkai, Li, Zongwei, Zhang, Zeng, Li, Xiaoqi
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866917237455060992
author Bu, Jiuyang
Li, Wenkai
Li, Zongwei
Zhang, Zeng
Li, Xiaoqi
author_facet Bu, Jiuyang
Li, Wenkai
Li, Zongwei
Zhang, Zeng
Li, Xiaoqi
contents Decentralized applications (DApps) face significant security risks due to vulnerabilities in smart contracts, with traditional detection methods struggling to address emerging and machine-unauditable flaws. This paper proposes a novel approach leveraging fine-tuned Large Language Models (LLMs) to enhance smart contract vulnerability detection. We introduce a comprehensive dataset of 215 real-world DApp projects (4,998 contracts), including hard-to-detect logical errors like token price manipulation, addressing the limitations of existing simplified benchmarks. By fine-tuning LLMs (Llama3-8B and Qwen2-7B) with Full-Parameter Fine-Tuning (FFT) and Low-Rank Adaptation (LoRA), our method achieves superior performance, attaining an F1-score of 0.83 with FFT and data augmentation via Random Over Sampling (ROS). Comparative experiments demonstrate significant improvements over prompt-based LLMs and state-of-the-art tools. Notably, the approach excels in detecting non-machine-auditable vulnerabilities, achieving 0.97 precision and 0.68 recall for price manipulation flaws. The results underscore the effectiveness of domain-specific LLM fine-tuning and data augmentation in addressing real-world DApp security challenges, offering a robust solution for blockchain ecosystem protection.
format Preprint
id arxiv_https___arxiv_org_abs_2504_05006
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Enhancing Smart Contract Vulnerability Detection in DApps Leveraging Fine-Tuned LLM
Bu, Jiuyang
Li, Wenkai
Li, Zongwei
Zhang, Zeng
Li, Xiaoqi
Cryptography and Security
Decentralized applications (DApps) face significant security risks due to vulnerabilities in smart contracts, with traditional detection methods struggling to address emerging and machine-unauditable flaws. This paper proposes a novel approach leveraging fine-tuned Large Language Models (LLMs) to enhance smart contract vulnerability detection. We introduce a comprehensive dataset of 215 real-world DApp projects (4,998 contracts), including hard-to-detect logical errors like token price manipulation, addressing the limitations of existing simplified benchmarks. By fine-tuning LLMs (Llama3-8B and Qwen2-7B) with Full-Parameter Fine-Tuning (FFT) and Low-Rank Adaptation (LoRA), our method achieves superior performance, attaining an F1-score of 0.83 with FFT and data augmentation via Random Over Sampling (ROS). Comparative experiments demonstrate significant improvements over prompt-based LLMs and state-of-the-art tools. Notably, the approach excels in detecting non-machine-auditable vulnerabilities, achieving 0.97 precision and 0.68 recall for price manipulation flaws. The results underscore the effectiveness of domain-specific LLM fine-tuning and data augmentation in addressing real-world DApp security challenges, offering a robust solution for blockchain ecosystem protection.
title Enhancing Smart Contract Vulnerability Detection in DApps Leveraging Fine-Tuned LLM
topic Cryptography and Security
url https://arxiv.org/abs/2504.05006