تحليل تجريبي لأدوات اكتشاف الثغرات لعقود سوليديتي الذكية An empirical analysis of vulnerability detection tools for solidity smart contracts

شارك:
المجلة: Empirical Software Engineering، المجلد: 31، العدد: 5
DOI: https://doi.org/10.1007/s10664-026-10867-7
تاريخ النشر: 2026-05-16
المؤلف: Francesco Salzano وآخرون
الموضوع الرئيسي: تطبيقات تكنولوجيا البلوكشين والأمان

نظرة عامة

تقيّم هذه الورقة البحثية أمان العقود الذكية (SCs) المكتوبة بلغة Solidity، مع التركيز على فعالية أدوات تحليل الثغرات الآلية. باستخدام إطار عمل SmartBugs 2.0، الذي يشمل 20 أداة تحليل، تقيم الدراسة مجموعة بيانات تحتوي على 2,182 حالة تم وضع علامات عليها يدويًا للثغرات المصنفة حسب تصنيف DASP TOP 10. تكشف النتائج عن اختلافات كبيرة في دقة وموثوقية الأدوات، حيث حققت مجموعة من ثلاث أدوات محددة معدل اكتشاف ثغرات يصل إلى 76.78% في أقل من دقيقة واحدة. بالإضافة إلى ذلك، تقدم الورقة أكبر مجموعة بيانات من تعليقات الثغرات على مستوى السطر لعقود Solidity الذكية وتقوم بإجراء أوسع تقييم تجريبي لأدوات التحليل حتى الآن.

تستكشف الدراسة أيضًا أداء طريقة الكشف المعتمدة على نموذج لغة كبير (LLM)، تحديدًا ChatGPT، عبر مجموعتين من البيانات. بينما أظهر ChatGPT نتائج مرضية على مجموعة بيانات واحدة، كانت أداؤه على العقود الذكية في العالم الحقيقي ضعيفًا بشكل ملحوظ، مما يشير إلى الحاجة إلى تحسين قدرات الكشف. تسلط الورقة الضوء على التحديات المستمرة، مثل ارتفاع معدلات الإيجابيات الكاذبة والحاجة إلى تحسين الكشف عن فئات الثغرات المحددة مثل العشوائية السيئة والسباق الأمامي. يتم اقتراح اتجاهات البحث المستقبلية، بما في ذلك تطوير معايير متوازنة ودمج محاكاة على مستوى المعاملات لتعزيز الكشف عن الثغرات في سياق ديناميات blockchain.

مقدمة

تسلط مقدمة هذه الورقة البحثية الضوء على التأثير التحويلي لتكنولوجيا blockchain، وخاصة من خلال استخدام العقود الذكية (SCs)، التي تقوم بأتمتة تنفيذ منطق الأعمال وتنتشر في المعاملات المالية ذات المخاطر العالية. ومع ذلك، فإن أمان العقود الذكية يمثل مصدر قلق كبير، كما يتضح من الحوادث مثل هجوم DAO، الذي أسفر عن خسائر مالية كبيرة. وقد أدى ذلك إلى أبحاث موسعة حول الثغرات في العقود الذكية، مما أسفر عن العديد من أدوات الكشف الآلي عن الثغرات، مثل تلك المجمعة في إطار عمل SmartBugs 2.0. على الرغم من توفرها، غالبًا ما تظهر هذه الأدوات معدلات إيجابيات كاذبة مرتفعة، مما يدفع المطورين للاعتماد على اكتشاف الثغرات يدويًا.

تناقش الورقة قيود الممارسات الحالية لتقييم أدوات الكشف عن الثغرات، وخاصة الاعتماد على مجموعات بيانات تم وضع علامات عليها تلقائيًا قد ترث تحيزات. للتغلب على ذلك، قام المؤلفون بإنشاء مجموعة بيانات تم وضع علامات عليها يدويًا تحتوي على 2,182 عقدًا ذكيًا مع علامات ثغرات على مستوى السطر، مما يتيح تقييمًا أكثر دقة لأدوات الكشف. تكشف تحليلاتهم التجريبية عن تفاوتات كبيرة في فعالية الأدوات المختلفة، حيث لا توجد أداة واحدة قادرة على اكتشاف جميع فئات الثغرات. كما تقيم الدراسة نهج الكشف المعتمد على نموذج لغة كبير (LLM)، وتجد أنه أقل فعالية على العقود في العالم الحقيقي مقارنة بالمعايير المنسقة. في النهاية، يقترح المؤلفون مجموعة تكاملية من ثلاث أدوات—Conkas وSlither وSmartcheck—التي تعزز بشكل جماعي تغطية الكشف عن الثغرات مع تقليل عبء التنفيذ.

طرق

في هذا القسم، يحدد المؤلفون المنهجية التجريبية المستخدمة لتقييم أداء الأدوات ضمن إطار عمل SmartBugs 2.0. لتعزيز الكفاءة، تم توزيع التحليل عبر أربع آلات؛ ومع ذلك، لغرض الحصول على مقاييس أداء غير متحيزة، تم تحليل جميع الحالات الـ 1,500 التي تم تقييمها على آلة واحدة. كانت هذه الآلة مزودة بمعالج Ryzen 9 9700x يحتوي على 12 نواة و24 خيطًا، بالإضافة إلى 32 جيجابايت من ذاكرة الوصول العشوائي، وكانت تعمل على نظام Ubuntu 24.04 LTS.

تم اشتقاق مقاييس الأداء باستخدام البرنامج النصي results2csv المقدم مع SmartBugs، والذي ينشئ ملف CSV يحتوي على بيانات التنفيذ. يتضمن هذا الملف عمودًا يسجل مدة تنفيذ كل أداة، مما يسمح بحساب متوسط أوقات التنفيذ. من الجدير بالذكر أن التحليل واجه 643 حالة من النتائج غير المكتملة، كما هو موضح في عمود “infos” في ملف CSV. يتم تلخيص متوسط أوقات التنفيذ لكل أداة في الجدول 9، مما يوفر نظرة شاملة على مقاييس الأداء التي تم الحصول عليها من التجارب.

نتائج

أسفر الاستطلاع الذي تم إجراؤه عن 65 استجابة، تم استبعاد ثلاثة منها لردها بـ “لا” على الأسئلة الأولية. تشير النتائج، الملخصة في الجدول 3، إلى تفضيل قوي بين المستجيبين للتصنيف الدقيق للثغرات على مستوى السطر في العقود الذكية، بدلاً من التصنيف على مستوى الوظيفة أو الملف. يشير هذا التفضيل إلى أن التعليقات الأكثر تفصيلاً يمكن أن تعزز قدرة المطورين على تحديد ومعالجة المشكلات بكفاءة. أظهر المشاركون الذين لديهم خبرة سابقة في كتابة وتحديد وإصلاح الثغرات في عقود Solidity (المصنفون كذوي خبرة) تقديرًا مرتفعًا بشكل خاص للتعليقات على مستوى السطر، مما يعزز الأهمية العملية لهذه الدقة.

في معالجة أسئلة البحث (RQs)، وجدت الدراسة أن عدة أدوات، بما في ذلك Ethainter وEthor وTeether، فشلت في اكتشاف ثغرات DASP، بينما حددت أدوات أخرى مثل Semgrep أنواعًا مختلفة من المشكلات التي لم تصنف كـ DASP. تم الإشارة إلى Conkas لوسمها أكبر عدد من الثغرات، وكانت Slither الأكثر فعالية في تحليل عقود Solidity بعد الإصدار 0.8+. أدت وجود الإيجابيات الكاذبة (FPs) والسلبيات الكاذبة (FNs) إلى تقويض موثوقية هذه الأدوات بشكل كبير، مما يبرز ضرورة وجود مجموعة متنوعة من أدوات الكشف لتغطية فئات الثغرات المختلفة. بالإضافة إلى ذلك، كشفت تحليل قدرات الكشف لـ ChatGPT عن تباين كبير، مع فعالية متناقصة على العقود الذكية الكبيرة في العالم الحقيقي، مما يشير إلى أن تسرب البيانات والعمومية المحدودة قد تعيق الأداء.

مناقشة

يوفر قسم المناقشة في الورقة البحثية نظرة شاملة على تكنولوجيا blockchain، مع التركيز بشكل خاص على العقود الذكية (SCs) وثغراتها. يتم وصف blockchain كنظام معاملات لامركزي ونظير إلى نظير يضمن عمليات آمنة دون وسطاء، باستخدام خوارزمية توافق للحفاظ على دفتر أستاذ غير قابل للتغيير للمعاملات. يتم تسليط الضوء على العقود الذكية، التي هي عقود ذاتية التنفيذ مع شروط الاتفاق مكتوبة مباشرة في الشيفرة، لطبيعتها المدفوعة بالأحداث وعدم قابليتها للتغيير، على الرغم من أنه يمكن تحديثها عبر الوكلاء. يتم التأكيد على منصة Ethereum كأهم بيئة للعقود الذكية، حيث يتم قياس المعاملات بالغاز، وهو وحدة تمثل الجهد الحاسوبي.

يتناول القسم أيضًا الثغرات المرتبطة بالعقود الذكية، مشيرًا إلى تصنيف DASP TOP 10، الذي يتضمن مشكلات مثل إعادة الدخول، وعيوب التحكم في الوصول، والأخطاء الحسابية. يتم تصنيف أدوات الكشف المختلفة إلى تحليل ثابت وديناميكي، والتحقق الرسمي، وطرق تعتمد على الذكاء الاصطناعي، كل منها له منهجيات مميزة لتحديد الثغرات. تستعرض الورقة أيضًا الأدبيات الموجودة حول الكشف عن ثغرات العقود الذكية، مشيرة إلى أن العديد من الدراسات قد ركزت على تقييمات على مستوى العقد بدلاً من الدقة على مستوى السطر، وهو أمر حاسم لتحديد الثغرات بدقة. يقترح المؤلفون دراسة لتقييم فعالية أدوات الكشف المختلفة، بهدف تقديم رؤى حول موثوقيتها وإمكانية تحسين معدلات الكشف من خلال التحليل الدقيق.

Journal: Empirical Software Engineering, Volume: 31, Issue: 5
DOI: https://doi.org/10.1007/s10664-026-10867-7
Publication Date: 2026-05-16
Author(s): Francesco Salzano et al.
Primary Topic: Blockchain Technology Applications and Security

Overview

This research paper evaluates the security of smart contracts (SCs) written in Solidity, focusing on the effectiveness of automated vulnerability analysis tools. Utilizing the SmartBugs 2.0 framework, which encompasses 20 analysis tools, the study assesses a dataset of 2,182 manually annotated instances for vulnerabilities categorized by the DASP TOP 10 taxonomy. The findings reveal significant discrepancies in the accuracy and reliability of the tools, with a combination of three specific tools achieving a vulnerability detection rate of up to 76.78% in under one minute. Additionally, the paper introduces the largest dataset of line-level vulnerability annotations for Solidity SCs and conducts the most extensive empirical evaluation of analysis tools to date.

The study also explores the performance of a Large Language Model (LLM)-based detection method, specifically ChatGPT, across two datasets. While ChatGPT demonstrated satisfactory results on one dataset, its performance on real-world SCs was notably poor, indicating a need for improved detection capabilities. The paper highlights ongoing challenges, such as high false positive rates and the need for better detection of specific vulnerability classes like Bad Randomness and Front Running. Future research directions are suggested, including the development of balanced benchmarks and integration of transaction-level simulations to enhance vulnerability detection in the context of blockchain dynamics.

Introduction

The introduction of this research paper highlights the transformative impact of blockchain technology, particularly through the use of Smart Contracts (SCs), which automate business logic execution and are prevalent in high-stakes financial transactions. However, the security of SCs is a significant concern, as evidenced by incidents like the DAO attack, which resulted in substantial financial losses. This has led to extensive research on vulnerabilities in SCs, resulting in numerous automated vulnerability detection tools, such as those aggregated in the SmartBugs 2.0 framework. Despite their availability, these tools often exhibit high false positive rates, prompting developers to rely on manual vulnerability discovery.

The paper addresses the limitations of existing evaluation practices for vulnerability detection tools, particularly the reliance on automatically labeled datasets that may inherit biases. To overcome this, the authors constructed a manually annotated dataset of 2,182 smart contracts with line-level vulnerability labels, enabling a more precise assessment of detection tools. Their empirical analysis reveals significant disparities in the effectiveness of various tools, with no single tool capable of detecting all vulnerability classes. The study also evaluates a Large Language Model (LLM)-based detection approach, finding it less effective on real-world contracts compared to curated benchmarks. Ultimately, the authors propose a complementary combination of three tools—Conkas, Slither, and Smartcheck—that collectively enhance vulnerability detection coverage while minimizing execution overhead.

Methods

In this section, the authors outline the experimental methodology employed to evaluate the performance of tools within the SmartBugs 2.0 framework. To enhance efficiency, the analysis was distributed across four machines; however, for the purpose of obtaining unbiased performance metrics, all 1,500 evaluated instances were analyzed on a single machine. This machine was equipped with a Ryzen 9 9700x processor featuring 12 cores and 24 threads, along with 32 GB of RAM, and operated on Ubuntu 24.04 LTS.

The performance metrics were derived using the results2csv script provided with SmartBugs, which generates a CSV file containing execution data. This file includes a column that records the duration of each tool’s execution, allowing for the calculation of average execution times. Notably, the analysis encountered 643 instances of incomplete results, as indicated in the CSV’s ‘infos’ column. The average execution times for each tool are summarized in Table 9, providing a comprehensive overview of the performance metrics obtained from the experiments.

Results

The survey conducted yielded 65 responses, with three excluded for answering “No” to initial questions. The results, summarized in Table 3, indicate a strong preference among respondents for fine-grained, line-level labeling of vulnerabilities in smart contracts, as opposed to function-level or file-level labeling. This preference suggests that more detailed annotations could enhance developers’ ability to identify and address issues efficiently. Participants with prior experience in writing, identifying, and fixing vulnerabilities in Solidity contracts (labeled as Experienced) showed a particularly high appreciation for line-level annotations, reinforcing the practical relevance of this granularity.

In addressing the research questions (RQs), the study found that several tools, including Ethainter, Ethor, and Teether, failed to detect DASP vulnerabilities, while others like Semgrep identified different types of issues not classified as DASP vulnerabilities. Conkas was noted for tagging the most vulnerabilities, and Slither was most effective in analyzing post-0.8+ Solidity contracts. The presence of false positives (FPs) and false negatives (FNs) significantly undermined the reliability of these tools, emphasizing the necessity for a diverse array of detection tools to cover various vulnerability classes. Additionally, the analysis of ChatGPT’s detection capabilities revealed high variability, with diminished effectiveness on larger, real-world smart contracts, suggesting that data leakage and limited generalization may hinder performance.

Discussion

The discussion section of the research paper provides a comprehensive overview of blockchain technology, particularly focusing on smart contracts (SCs) and their vulnerabilities. Blockchain is described as a decentralized, peer-to-peer transaction system that ensures secure operations without intermediaries, utilizing a consensus algorithm to maintain an immutable ledger of transactions. Smart contracts, which are self-executing contracts with the terms of the agreement directly written into code, are highlighted for their event-driven nature and immutability, although they can be updated via proxies. The Ethereum platform is emphasized as the leading environment for SCs, where transactions are measured in gas, a unit representing computational effort.

The section further delves into the vulnerabilities associated with SCs, referencing the DASP TOP 10 taxonomy, which includes issues such as reentrancy, access control flaws, and arithmetic errors. Various detection tools are categorized into static and dynamic analysis, formal verification, and AI-based methods, each with distinct methodologies for identifying vulnerabilities. The paper also reviews existing literature on SC vulnerability detection, noting that many studies have focused on contract-level evaluations rather than line-level granularity, which is crucial for accurately identifying vulnerabilities. The authors propose a study to assess the effectiveness of various detection tools, aiming to provide insights into their reliability and the potential for improving detection rates through fine-grained analysis.